Skip to content

feat(proxies): show proxy accounts in settings on web and mobile - #728

Merged
nixuuu merged 3 commits into
devfrom
feat/proxy-accounts-ui
Nov 14, 2026
Merged

nixuuu merged 3 commits into
devfrom
feat/proxy-accounts-ui

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Stage 2 of 2, on #727. UI for CLIProxyAPI upstream accounts on web and mobile.

  • Settings → Proxies (web):
    • A Management key field for CLIProxyAPI proxies (optional; Replace/Clear like other secrets).
    • Accounts on the proxy card: compact rows with the provider mark, account (truncated), status badge, the limits the proxy last saw (the same meters as plan limits), cooldown end and last message (two lines at most), Refresh and "Checked …".
    • Without a key, or in an error state, one short hint instead of the list. Texts render as text only.
  • Settings → Providers (web): a proxy-backed instance shows "Through · 2 Codex accounts · 1 cooling down", with a link to the proxy card. It replaces the plan meters fix(providers): hide plan limits for proxy and endpoint instances #725 removed.
  • Mobile, read-only:
    • The proxy row lists accounts with status, limits and message, plus Refresh accounts.
    • Provider instance rows add the "Through …" line.
    • JS only, so the OTA fingerprint is unchanged.
  • Shared labels, hints and summary: @canopy/domain/proxy-accounts.
  • The view reads once on open (the gateway answers from a read under 60 s old). Changes arrive incrementally through OverviewUpdate.proxy_accounts.
  • Docs: docs/proxies.md (UI), docs/copy.md glossary (proxy account, management key).

Browser review

Reviewed on a separate review machine, with a fake CLIProxyAPI giving 6 accounts:

  • typical and very long emails, a long cooldown message, HTML and a token in a message;
  • Codex and Claude limit headers;
  • Gemini and Grok accounts.

Checked in light and dark, at 1280 px and a 390 px phone width:

  • no horizontal scroll;
  • long names truncate;
  • messages clamp;
  • the badge stays on the right without shifting rows;
  • Refresh shows progress only when pressed.

The review found two problems, both fixed in this stack:

Checks

gen:check, typecheck, lint, format:check, web build, expo export (android, ios). Tests: proxy-accounts, proxies, provider-usage, provider-usage-bots, schema, domain and worker unit tests. No UI tests, per policy.

Copy audit (§8)

Before After Reason
(none) Field "Management key": "Optional. Lets Canopy show the proxy's accounts and their status. Encrypted in the gateway." Says what it does, then where it's kept. New glossary term.
(none) "Accounts · 6", "Checked just now", "Showing 20 of 240.", "The proxy has no accounts yet." Short; no repeated facts.
(none) Badges: Active, Cooling down, Off, Sign in again, Error Sentence case. Each badge has text, so color is never the only cue.
(none) "Add a management key to see this proxy's accounts." What to do, in one sentence.
(none) "The proxy rejected the management key. Replace it, then refresh." What happened, then what to do.
(none) "The proxy allows management only from its own computer. Turn on remote management there." Plain words instead of allow-remote-management.
(none) "The proxy's management API is off or unavailable." / "Canopy could not reach the proxy's management API." / "The proxy sent an account list Canopy cannot read." Errors without raw bodies.
Plan meter on a proxy instance "Through Team proxy · 2 Codex accounts · 1 cooling down" Names the proxy; the counts are about its accounts, not the user's plan.

Glossary: added proxy account (not "auth file" or "credential") and management key (not "admin key").

Also

  • Mobile bot-chat failure card gets the proxy wording for proxy instances (web already had it).

@nixuuu
nixuuu force-pushed the feat/proxy-accounts-ui branch from 9cb2743 to 6bf33eb Compare November 14, 2026 15:06
@nixuuu
nixuuu force-pushed the feat/proxy-accounts-gateway branch from 0e902de to f456d2a Compare November 14, 2026 15:17
@nixuuu
nixuuu force-pushed the feat/proxy-accounts-ui branch from 6bf33eb to b3a975d Compare November 14, 2026 15:18
@nixuuu
nixuuu force-pushed the feat/proxy-accounts-gateway branch from f456d2a to dbbcb43 Compare November 14, 2026 15:40
@nixuuu
nixuuu force-pushed the feat/proxy-accounts-ui branch from b3a975d to 83b2574 Compare November 14, 2026 15:40
@nixuuu
nixuuu force-pushed the feat/proxy-accounts-gateway branch from dbbcb43 to 48b1c63 Compare November 14, 2026 16:09
@nixuuu
nixuuu force-pushed the feat/proxy-accounts-ui branch from 83b2574 to 852520a Compare November 14, 2026 16:09
@nixuuu
nixuuu marked this pull request as ready for review November 14, 2026 16:09
@nixuuu
nixuuu changed the base branch from feat/proxy-accounts-gateway to dev November 14, 2026 16:18
Settings → Proxies gets a management key field and a compact list of the
proxy's upstream accounts with Refresh. A proxy-backed provider instance
shows which proxy it runs through and a summary of that proxy's accounts
for its agent. Mobile shows the same, read-only.
@nixuuu
nixuuu force-pushed the feat/proxy-accounts-ui branch from 852520a to 4c7c467 Compare November 14, 2026 16:22
@nixuuu
nixuuu merged commit 48212ce into dev Nov 14, 2026
11 checks passed
@nixuuu
nixuuu deleted the feat/proxy-accounts-ui branch November 14, 2026 16:33
nixuuu added a commit that referenced this pull request Nov 14, 2026
Stage 3 of 3 (on #728). Adds proxy accounts to the sidebar usage glance
from #726, using its typed `ProxyUsageSection` slot. Also has the
gateway's first account check run shortly after startup.

- **Popover, web and mobile:** one row per CLIProxyAPI proxy that a
profile uses and whose accounts the gateway has read. The row shows
"Through <proxy>" (truncated) over "N accounts · M cooling down" and
links to the proxy card. Its accessible label is the full sentence
"Through <proxy>: N accounts · M cooling down".
  - Plan windows are never inferred from these accounts.
- Proxies without a key, unused proxies, unread or rejected accounts,
and non-CLIProxyAPI proxies are left out.
- **Trigger:** without plan usage but with proxy sections, the slot
shows a connection icon instead of bars. The aria label lists both.
- **Data source:** the existing shared `ListProxies` read, patched by
`OverviewUpdate.proxy_accounts`. Reading it never calls a proxy.
- **Gateway:** the first periodic check now runs about 15 s after
startup instead of 5 min, so the sidebar fills without opening settings.
- **Also in this stack (#728):** the mobile bot-chat failure card now
uses the proxy wording for proxy instances, matching web.
- **Tests and docs:** `sidebar-usage.test.ts` covers the section
projection and text. `docs/provider-accounts.md` replaces the old "not
rendered yet" note for `ProxyUsageSection`.

## Browser review
Reviewed on a separate review host with a fake CLIProxyAPI and a Codex
instance using the proxy, in light and dark at 1280 px:
- With only a proxy (no plan usage), the trigger showed the connection
icon.
- The popover row read "Through Team CLIProxyAPI" over "3 accounts · 1
cooling down" and linked to the proxy card.
- The first version truncated the counts ("1 co…"). Moving them to a
second line fixed it.

At phone width the page has no horizontal scroll. I did not check the
popover itself on a phone: it closes when the sidebar collapses, and I
didn't open the drawer. Mobile native visuals were not checked on a
device, but the Android and iOS exports pass. The change is JS only, so
the native fingerprint is unchanged.

## Checks
typecheck, lint, format:check, gen:check, web build, `expo export`
(android, ios). Domain tests pass, and the proxy-accounts, proxies,
provider-usage and schema integration tests pass.

## Copy audit (§8)
| Before | After | Reason |
| --- | --- | --- |
| (slot unused) | "Through Team CLIProxyAPI" / "3 accounts · 1 cooling
down" | Names the proxy; counts are the proxy's accounts, not the user's
plan. Short, no repeated facts. |
| Trigger label "Show provider usage. Codex: 42% used" | "Show provider
usage. … Through Team: 3 accounts · 1 cooling down" | The section is
spoken too; the icon is never the only cue. |
| (mobile bot failure) "A usage or turn limit was reached. … check your
plan …" | "The proxy reported a usage limit. Wait for it to reset or
check the proxy's accounts, then retry." | Same wording as web and as
thread failures. |
nixuuu added a commit that referenced this pull request Nov 14, 2026
nixuuu added a commit that referenced this pull request Nov 14, 2026
nixuuu added a commit that referenced this pull request Nov 14, 2026
nixuuu added a commit that referenced this pull request Nov 14, 2026
## Change

CLIProxyAPI account identities in Settings → Proxies now use the same
click-to-reveal privacy component as Providers. Hidden values have no
plaintext title, tooltip or accessible name; keyboard activation reveals
the accessible value, Escape hides it, and the existing 30-second
timeout remains. Truncated identities keep their layout on reveal.
Account detail messages also use privacy protection because upstream
messages can repeat a login.

The sidebar Provider usage popover lists each proxy account with its
provider, limit windows, percentage, compact bars, reset time and
non-Active status. Accounts are grouped by provider, with the most-used
windows first. A bounded internal scroller keeps large lists compact.
Checked timestamps, loading, empty and error states use the existing
cached data. No polling or refresh request was added; the shared
ListProxies cache, overview feed and gateway lease remain responsible
for reads.

## Identity audit

- Settings → Proxies: account labels and detail messages protected;
plaintext title removed.
- Settings → Providers and sign-in completion: existing AccountStatusRow
already uses Sensitive for emails; shared reveal behavior retained.
- Sidebar limits and provider usage: direct providers show instance
labels and computer names, not account email fields; their meters remain
unchanged. Proxy account identities use the same protected row as
Settings.
- Proxy pickers select saved connections and contain no upstream account
identities.
- Thread import and provider sign-in flows do not separately render
upstream account emails or logins. Explicit entry fields are unchanged.

## Validation

`nice` install, typecheck, lint, format:check, web build and gen:check
passed. Focused gateway/domain unit checks: 8 passing tests, 47
assertions. No UI test suite added. Browser review uses a disposable
isolated stack and synthetic identities: light/dark, desktop/phone, DPR
1/2, short/typical/long emails, 1/6/30 accounts, internal scrolling,
reveal/Escape and accessibility attribute inspection. The measured short
email stayed 55.5 px wide on reveal; no hidden identity or host appeared
in title/aria attributes.

Window parsing now follows the reported duration, including daily,
monthly and custom periods. A weekly-only Codex plan can put its weekly
window in primary; an empty secondary is not a second quota. Empty zero
watermarks are dropped for Codex and Claude. Plan names cross the
gateway boundary as a closed enum; Codex's sanitized
`id_token.plan_type` and passive plan header are supported. Other
providers show a plan only if management exposes a recognized name. Raw
JWTs are never decoded or downloaded. Additive proto fields and
generated code are included. See docs/proxies.md for source links and
limitations.

Proxy hosts are also protected: the card, all three agent mapping lines,
the edit form's read-only mappings, and the selected connection in proxy
pickers. Scheme, port and path remain visible. Editable URL inputs
remain readable. Plain URL picker descriptions were removed to avoid
leaking through option tooltips or accessible labels.

## Copy audit

New privacy labels: “Account identity”, “Account details”, “Proxy host”
and “Proxy URL”; these describe hidden values without disclosing them.
Proxy usage reuses “Through …”, “Checked …”, limit/reset labels, account
statuses and the existing empty state. Error recovery adds “Open proxy
settings to check access, then refresh.” New loading state: “Checking
accounts…”. Plan labels use established subscription names (Free, Plus,
Pro, Team, Business, Enterprise, Max, Max 5x/20x, Ultra, Other plan).
Window names use “Daily”, “Monthly”, a numeric duration, or “Primary
limit”/“Secondary limit” when only a slot is known. Sentence case,
active voice, short sentences, action after errors, no new jargon or
glossary terms, no humor, and no color-only meaning. Reviewed
short/typical/long values at desktop and phone width.

Related: #728, #731, #745

## Reset timestamp follow-up

The stage 1 review fixture used `2099-01-01T00:00:00Z`, causing the
26,345-day countdown. This was fixture data, not a seconds/milliseconds
conversion defect. Corrected browser fixtures use resets one day and
three hours ahead.

The gateway now rejects reset timestamps more than 400 days ahead, and
the shared formatter also hides implausible dates already cached. Codex
`reset-at` and Claude reset headers remain epoch seconds; Codex
`reset-after-seconds` remains relative to the quota observation.
Realistic gateway fixtures cover these three paths, accidental
millisecond epochs, the 400-day boundary and cached invalid dates.

Follow-up checks: install, gen:check, typecheck, lint, format:check and
web build passed. Focused gateway and capacity tests passed (11 tests,
74 assertions). Corrected stage 1 browser review confirmed one-day and
three-hour countdowns.

Copy audit: no new UI wording; unknown reset times omit the existing
reset label while retaining usage readings.

The CI integration fixture also contained an obsolete 2033 reset
(`2000000000` epoch seconds), which the 400-day guard correctly
discarded. The management integration suite now fixes its clock to the
quota observation and uses a three-hour reset, restoring the real clock
during cleanup. PostgreSQL lease timing continues to use real elapsed
time. No production behavior or UI wording changed in this fixture
correction.

Repeated local validation: `proxy-accounts.test.ts`, `proxies.test.ts`
and the gateway management tests passed together three consecutive times
(24 tests, 177 assertions per run); the management integration and
gateway tests also passed in an initial focused run. Typecheck, lint and
format:check passed after the fixture correction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant