feat(accounts): show proxy binding as a list badge with a quick editor - #606
Conversation
The account lists never showed where an account's egress actually comes from, which hid a state that silently drops accounts out of scheduling: an account pinned to a managed proxy that is disabled, test-failed or deleted has no usable egress while the proxy pool is on, and AccountHasUsableEgress filters it away. The same holds when the pool is on with no usable entry and no global proxy configured. Both now render as a red badge instead of looking like a perfectly healthy account. A new "proxy" column on the Codex, Grok and Antigravity lists resolves the same priority as auth/store.go — account > group > pool > global > direct — and clicking the badge opens a small editor that changes only proxy_url, reusing the pool picker and the proxy test endpoint. Saving an empty value unbinds and falls back to the inherited source. No backend change is needed: PATCH /accounts/:id/scheduler already accepts proxy_url and the list projection already carries it. Inherited states name the source but never a concrete URL. Selection within a group or the pool is a sticky hash over the account ID, so reproducing it in the frontend would drift from the scheduler as soon as either side changes; an exact effective URL has to come from the backend projection instead. URLs are compared with trim only, matching buildProxyPoolSet, so a trailing slash is a different proxy rather than something the UI quietly repairs. Group lookup deliberately uses the full group list rather than the channel-filtered one, because the backend ignores channel when resolving group proxies and filtering would misreport pre-migration cross-channel members as unbound. Rows receive one memoized context object rather than loose arrays, so the memoized table rows are not defeated. Tooltips mask proxy credentials, in line with the proxy page keeping URLs behind an explicit reveal toggle — hovering a list row is not a request to see secrets.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughAdds effective proxy binding resolution, localized account proxy badges, quick proxy editing, and proxy columns to the Accounts, Antigravity, and Grok account views. ChangesAccount proxy management
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to This PR adds proxy-status visibility and a quick editor through existing administrative APIs, with credential redaction and no backend contract changes. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant AccountPage
participant AccountProxyBadge
participant resolveAccountProxyBinding
participant AccountProxyQuickEditor
participant API
AccountPage->>resolveAccountProxyBinding: Resolve effective proxy binding
resolveAccountProxyBinding-->>AccountProxyBadge: Return binding state
AccountProxyBadge-->>AccountPage: Open editor on click
AccountPage->>AccountProxyQuickEditor: Provide account and proxy context
AccountProxyQuickEditor->>API: Test or update proxy URL
API-->>AccountPage: Return result and refresh accounts
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 6 files. (3 skipped: 2 unsupported, 1 too large.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
做了什么
账号列表新增「代理」列徽章,点击直达只改
proxy_url一个字段的快速设置弹窗。Codex / Grok / Antigravity 三个视图全覆盖,表格与卡片两种布局都有。后端零改动——
PATCH /accounts/:id/scheduler {proxy_url}本来就落库并热更新运行时,分页列表投影里也一直带着proxy_url。为什么
真正的动机不是"看得见代理",而是有个致命状态此前在 UI 上完全不可见:
AccountHasUsableEgress会直接把它排除出调度——页面上却只显示一个状态正常的号。这两种情况现在都是红色徽章。
徽章状态
HK-01 · 82ms代理不可用host:port组:主力代理池/全局/直连无可用出口几个刻意的取舍
stickyProxyIndex(accountID, len)粘性散列,前端复刻必然与调度器漂移;要精确到生效 URL 只能由后端在列表投影下发。buildProxyPoolSet恒等——末尾多个斜杠就是另一条代理,UI 不"帮忙修好"。验证
npm test— 181 passed(新增 16 条单测,覆盖全部 8 种状态,含 fail-closed、代理池关闭时不误报、trim-only 匹配、凭据打码)npm run typecheck— 无错误npm run build— 通过本次不含
批量给选中账号设代理、保存自定义 URL 时「同时加入代理池」、后端下发精确
effective_proxy_url。Summary by CodeRabbit
New Features
Tests