Repository navigation
feat(mobile): match web provider and proxy settings and usage - #760
Merged
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 14, 2026 22:21
nixuuu
added a commit
that referenced
this pull request
Nov 15, 2026
## Problem 1. **Every account showed "unknown plan".** Codex auth files carry OpenAI's own plan identifier in `X-Codex-Plan-Type`: `prolite`, `pro`, `promax`, `plus`. Canopy knew `pro_100`/`pro_500` but not `prolite`/`promax`, so they fell back to Other and counted as ×1. Claude auth files from upstream CLIProxyAPI have no plan identifier at all. 2. **The Provider usage popover was too busy**: account-limit disclosures, "N unknown plans counted as ×1", "N of M accounts reporting", units text and a separate "Through <proxy>" heading. ## Changes **Plans (gateway)** - Codex: `prolite` → Pro 100, `pro` → Pro 200 (the original $200 Pro), `promax` → Pro 500, `plus` → Plus. For Codex the response header wins over a stored `id_token` claim, because it describes the latest response. - Claude: upstream CLIProxyAPI (checked 2026-11-15) exposes no plan or profile identifier in `auth-files`. Signals are only `Anthropic-Ratelimit-Unified-*` and `Retry-After` (also in `model_quotas`), `account_type` is `oauth`/`api_key`, and `id_token` is Codex-only. Claude plans therefore stay unknown and count as ×1. Canopy does not guess them. - A proxy's own multiplier fields are not read. Plans come only from provider identifiers. - For `account_type: api_key`, CLIProxyAPI puts the key itself in `account`. That field is no longer used as the account label. **Weights (`@canopy/domain/proxy-capacity`)**, from the providers' statements, reviewed 2026-11-15: | Plan | Weekly | 5-hour | |---|---|---| | Claude Pro / Max 5x / Ultra (Max 20x) | 1 / 5 / 10 | 1 / 5 / no cap | | Codex Plus / Pro 100 / Pro 200 / Pro 500 | 1 / 10 / 20 / 50 | 1 / no cap | **Popover (web) and usage sheet (mobile)**: new `@canopy/domain/usage-summary`, one row per provider: - provider mark and name, % left of the weighted capacity, one bar; - the window and its nearest reset as secondary text; - a shorter window (for example 5-hour) on the same line, only when it binds; - low capacity shows as the number and bar colour plus "Low". Direct instances and proxy accounts merge into the same row, keeping the lower reading per window. The sidebar indicator uses the same rows (most restrictive window). Removed: the account-limit disclosure, unknown-plan and reporting lines, units text and the "Through <proxy>" heading. Per-account detail stays in Settings → Proxies and Providers. A proxy in use whose accounts can't be read gets one sentence with a link. Mobile changes are JS only; the native fingerprint is unchanged. ## Tests - `apps/gateway/src/proxies/management-plan.test.ts`: realistic auth-file fixtures (fake data): Codex prolite/promax/pro/plus headers, a stale claim, Claude with and without extra proxy fields, malformed extra fields (the account is still read), and an API-key credential. - Domain: Codex weights, summary rows (merge, binding window, notes). ## Browser review A separate machine ran a gateway and web from source, with a fake CLIProxyAPI management endpoint (fake accounts, Codex `prolite`/`promax`/`pro`/`plus` headers, Claude unified headers). Covered: light and dark, desktop and phone width, 1 and 2 providers, 1, 6 and 30 accounts, a low/binding 5-hour window, and an unreadable proxy. Before (dev): both Codex Pro accounts counted as unknown ×1, and the popover had the account and plan lines. After: one row per provider, Codex weighted 10/50. Mobile wasn't run on a device; it is JS only and the native fingerprint is unchanged. ## Copy audit (docs/copy.md §8) | Before | After | Reason | |---|---|---| | `Through <proxy>` (heading link) | removed | Per-proxy detail lives in Settings → Proxies. | | `0.9 of 2 units left` | removed | Units are an internal measure; % left says it once. | | `2 unknown plans counted as ×1` | removed | Internal weighting detail; it is a minor gap (§5). | | `1 of 2 accounts reporting` | removed | Detail for Settings, not for a glance. | | `Account limits` (disclosure) | removed | No disclosures in the summary. | | `Low capacity` (extra line) | `Low` (one word next to the number) | One fact once; colour has a word (§7). | | `N unavailable accounts excluded`, `No comparable limit readings.` | removed; providers without a reading have no row | Minor gap, skipped silently (§5). | | — | `Weekly · Resets in 2 d 6 h` | Existing window names and reset format. | | — | `5-hour: 12% left` | Shown only when the shorter window binds. | | — | `No limit readings yet.` | Shown only when nothing has a reading. | | proxy hint lines | `Canopy can’t read accounts from “Team”.` + `Check proxy settings` link | What happened, then what to do. | | — | `Checking accounts from “Team”…` | Ongoing action uses `…`. | Checklist: active voice and sentence case. No banned glossary terms (proxy, account). The link starts with a verb. No fact repeated. Colour always has a word or number. Checked with short and long proxy names at desktop and phone width. Related: #751, #753, #760
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings mobile Settings → Providers, Settings → Proxies and the drawer's provider usage sheet to parity with web (#751, #753). JS only: no dependencies, native modules or config-plugin changes.
Differences found (web → mobile before this PR)
Proxies
Providers
10. Harness filter + per-instance button bar instead of web's single list of all instances with mark, name, version, status dot and on/off switch per scope.
11. No instance detail: header (harness · id · connection, Built-in, threads), Status section, per-worker status list, Workers access, definition form, models and delete section were split across sheets with different wording.
12. No "Checking… / Checked just now", "Not checked: …" or offline-worker notice; no "Deleted on another computer" notices.
13. Account line showed the email unmasked (also Workers → Provider accounts and the config directory); no plan meters per worker.
14. Proxy chooser listed raw base URLs; worker override used a free-text Proxy ID field instead of the proxy picker with "Use the instance's proxy" and Add proxy.
15. Connection descriptions were not harness-specific; the form showed a "Saved key" row web does not have.
Provider usage (drawer footer)
16. Only "Through : N accounts · M cooling down"; no weighted capacity, nearest reset, low-capacity warning, "N of M accounts reporting", unknown-plan note, per-account limits, plan badges, masked identities; glance bars ignored proxy capacity; window names ignored their length.
What changed
@canopy/domain/provider-instances(new):harnessName,instanceName,kindLabel,statusOn,statusAcross,versionsOf,hasAccountStatus,accountStateLabel, moved from web; web re-exports them.proxyKindsandsupportsHarnessmoved to@canopy/domain/proxy-accounts. Capacity maths stays in@canopy/domain/proxy-capacity(no copy in the app).Sensitive/SensitiveUrl(src/ui/Sensitive.tsx): the hidden value is never rendered (one bullet per character), so screenshots, screen sharing and the accessibility tree cannot read it; the label says "… hidden". Tap reveals for 30 s, a second tap hides; leaving the foreground, a new value and unmounting hide it. Proxy hosts are masked with scheme and path kept.ProxyEntry,ProxyForm(management key,SecretValue, defaults as web),ProxyMappings, rewrittenProxyAccountswithProxyAccountRow.InstanceRow,InstanceDetail,InstanceStatus,ProviderAccountRow,ProxyThrough,ProxyPicker,WorkerOverrides(wasProviderWorker), alignedProviderForm, add sheet with agent choice.ProxyUsageAccounts+ProxyCapacitySummaryper provider, "Account limits" disclosure,proxyCapacityGlancefor the footer bars, sharedUsageMeters(window names with their length), scroll height bound to 55% of the window.proxies.md,provider-accounts.md.Copy audit (docs/copy.md §8)
All new mobile strings are web's existing strings (same source text), except:
Verification
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:check, web build: clean.expo exportfor Android and iOS: both Hermes bundles build.@expo/fingerprintsource hashes for Android and iOS are identical to the base (60/60 sources); only JS changed.bun run check:tmp: 3156 pass, 1 fail —apps/worker/src/providers/codex/connections.test.ts"Codex keeps full history when resuming across device login and proxy connections" (the local Codex CLI rejectsthread/resumewith a model-provider change). This PR does not touch the worker.eas build. Light/dark, phone/foldable widths and 1/6/30 accounts were not checked on screen; no screenshots.