Repository navigation
fix(providers): show rejected logins and sign in again from the app - #696
Merged
Merged
Conversation
codex login status only reads auth.json, so an expired refresh token still showed "Signed in" while every turn failed with unauthorized. A turn rejected for its login now marks the account as needing sign-in on the gateway until the login file changes or a turn succeeds; Sign in under the error starts the ChatGPT device login, also for instances on the device login, and Retry waits for it. Fixes: #125
Device login replaces the CLI login of the worker's computer: only the worker's own owner may start it, never on a platform-wide worker or from a linked computer. Turn outcomes of a worker update its accounts in arrival order, the UI confirms which computer a sign-in changes and waits for that sign-in's own outcome, and concurrent starts share one login. Fixes: #125
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Canopy previously showed no provider plan limits. This adds durable account snapshots from official harnesses, compact provider settings meters, composer warnings at 90%, reached-limit notices, and limit-specific failure headings on web and mobile. - Codex 0.164.0: read limits at app-server startup/account read and forward account notifications. Preserve the reported 5-hour/weekly percentages and resets; discard credit balances. - Claude Agent SDK 0.3.316: merge rate-limit events, recognize official warning/error/transition prefixes, and optionally read usage from an existing active session at most once per 15 minutes. Paid-turn notices stay visible outside collapsed activity, including after success. - Store sanitized snapshots per worker/provider/profile and runtime/home identity. Reject obsolete reports and enforce worker/instance ownership. Deliver changed workers through the existing incremental overview stream. Bot and text-generation harness events update the same source account. - Add migration 0141 and additive protobuf fields with generated contracts. Keep expired-login handling separate. ### Billing boundaries Codex reports credit availability, **not whether this turn uses credits**. An exhausted plan with available credits therefore says “Plan limit reached. Further turns may use credits.” Claude's explicit extra-usage signal shows the account state and preserves “This turn uses extra usage credits.” in the thread. Neither pinned harness exposes a supported per-turn switch that prevents paid fallback. There is no fake stop setting, direct provider API call, reset-credit action, or inferred billing from token/cost data. Grok ACP exposes no account plan windows, so nothing is shown. A harness may report a transition after work starts; Canopy cannot promise pre-charge prevention. ### Validation - Install, generation consistency, whole-repo typecheck, lint, formatting, and web production build passed. - Focused checks passed: 57 tests covering official fake Codex/Claude harnesses over WorkerHost/gRPC/Postgres, startup and account refresh after notifications, changed runtime identity, incremental delivery, restart/offline persistence, owner scoping, stale reports, error mapping, bot collection, adapter shutdown, and schema checks. The final turn/adapter rerun passed 9 tests. - Full `check:tmp` completed with 2,978 passed, 175 skipped, and one SQL diagnostics failure. The usage query now uses the existing `workers.store` diagnostics family; its rerun passed. CI also caught loss of Codex's original error code without a reported plan window; that code is now preserved. All 41 bot/usage/diagnostics regression tests passed after both fixes. The full suite was not repeated locally. - iOS and Android exports passed. Native fingerprints exactly match dev: iOS `138e0c6b171c82b4933e86808cdfef56da73b8c6`, Android `906dc944f94eb8333fa384ed9f198834fdd30d13`. - Manual browser review used real isolated gateway/worker fixtures: light/dark, desktop/390 px phone, settings meters, 92% composer warning, reached-limit heading, and visible paid-turn notice with activity collapsed. Short, typical, and long labels stayed within the viewport. Review services/container and temporary checkout were removed. Native simulator visuals remain unverified: device discovery twice failed with “Could not communicate with device support.” No live provider tests or charges. Rebased onto the expired-login change (#696), retaining its sign-in flow and adding meters alongside it. Regenerated contracts preserve both additive changes; migration 0141 remains the next number on dev. On the rebased head, generation consistency, typecheck, lint, formatting, web build, both mobile exports, and all 45 usage/bot/diagnostics/expired-login tests passed. New CI checks are running; no review has been submitted. ### Copy audit (§8) | Before | After | Reason | |---|---|---| | No usage text | “5-hour · 25% used”, “Weekly · 92% used”, localized reset times | Name the reported window and keep meters compact. | | No near-limit action | “Weekly limit 92% used · resets …” + “Check usage in provider settings” | State the condition and provide an action without blocking the composer. | | Generic failure heading | “Weekly limit reached · resets …” | Preserve the window/reset from the failed turn; retain existing actions and technical details disclosure. | | No billing notice | “Extra usage credits are active.” for account state; “This turn uses extra usage credits.” for durable turn history | Distinguish current account state from the specific turn, using explicit harness signals. | | No Codex credit warning | “Plan limit reached. Further turns may use credits.” | Credit availability alone cannot establish that a charge occurred. | New copy uses short active sentences, sentence case, glossary terms, localized numbers/dates, visible text alongside meter colours, and live status announcements. No new empty states, destructive actions, jargon, blame, or humour. Long-name and phone-width review passed; unavailable data stays hidden.
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
## Problem Settings → Providers → Grok on two linked computers showed **Changed on two computers** with two rows: "Connects with" (Endpoint) and "Proxy" (A different proxy). **Restore** failed with "Computer link operation failed. Check the address, code and Network access settings." The link itself was fine. ## Root cause Not #696. The remote policy and the device-login refusal are not involved: Restore runs locally (`manageConfigNotice`). - Restore wrote `kind` or `proxy` **alone** (one history row per field). For example, the instance ended up `native` while still pointing at the proxy. `applyInstance` stored `proxy_id` on a native instance. `instanceSync` then copied the proxy's base URL and key onto it (`UPDATE provider_instances … FROM proxies`), and Postgres refused the row: `provider_instances_endpoint` (non-endpoint instances must have no base URL and no key). - `computerGuard` turned every error that is not a `ConnectError` (here a `SqlError`) into the pairing message. The field-by-field Restore of instance records comes from #164 (already on stable), so this PR uses `Related:` and not `Fixes:`. Linking #164 would hold everything merged since 2026-11-05. ## Change - **One connection notice.** An instance's `kind`, `proxy`, `baseUrl` and `apiKey` that were lost in the same merge with the same computer are one notice, `field = "connection"`. Its value is a JSON object (the key shows only as "A different key"). Restore, **Use the other’s** and **Keep this computer’s** write those fields together, taking the newest lost version of each. - **Defence in depth.** `applyInstance` sets `proxy_id` only on endpoint instances. A record that combines `native` with a proxy (from Restore or from a field-by-field merge) can no longer break the worker sync. - **Whose value.** New additive field `ConfigNotice.own_value = 11`: the kept value was set on this computer. - **Errors.** `computerGuard(run, failure)`: only pairing and the link service keep "Check the address, code and Network access settings". The other actions name what failed (see the copy audit). - **#696 untouched.** `StartProviderLogin` stays out of `SERVED`/`WORKER_SETTINGS`. - Docs: `docs/linked-computers.md` (notices). ## Verification - New `tests/integration/config-sync-connection.test.ts` (two linked gateways): - A: Grok native → endpoint through a proxy. B: endpoint → back to device login. After linking, B has **one** `connection` notice (`choice`, `own_value=false`). Restore on B: both computers are endpoint through the proxy, both workers get its address and key, and no notices are left on either computer. - A `merged` connection in A's history (as left by an earlier link): one notice (`own_value=true`, "Studio B"). Restore: both converge, no notices are left. **Keep current** (Dismiss) clears it and leaves both on device login. - Before the fix, the same scenario failed on the second Restore with the `provider_instances_endpoint` violation, which the user saw as the generic link message. - The device-login refusal still holds: `config-sync-workers` (a linked computer can't start `StartProviderLogin` through its API or directly over the link), 9/9. - Multi-gateway files run one at a time: `config-sync-connection` 2/2, `-workers` 9/9, `-providers` 7/7, `-intent` 3/3, `-identity` 4/4, `-recovery` 6/6, `-bootstrap` 4/4, `config-sync` 7/7, `-environment` 8/8. - `bun install`, `gen:check`, `typecheck`, `lint`, `format:check`, web build: clean. `check:tmp` (full run) was not run; only the focused files above. - **Not checked in a browser**: the change only replaces text in the existing notice row, which already wraps (`break-words`, `flex-wrap` buttons). Mobile still shows its plain notice list (field name and raw value); the `connection` field shows there as raw JSON, as other fields already do. ## Copy audit (docs/copy.md §8) | Where | Before → after | Why | |---|---|---| | Instance notice title | `Connects with` + `Proxy` (two rows) → `Connects with` (one row) | One thing changed: how the instance connects. "Connection" is a banned synonym for instance, so the title keeps "Connects with". | | Connection value | `Endpoint` / `A different proxy` → `This computer’s value: Endpoint through a different proxy` (also `Device login`, `Endpoint at <url>`, `… with a different key`) | Says what differs and whose value it is; proxies are never shown as ids. | | Merged notice | `Merged with <computer>.` → `Replaced when this computer linked with <computer>.` / `Not used when this computer linked with <computer>.` | Says what happened; active voice; ≤ 10 words. | | Restore button (merged/concurrent) | `Restore` → `Restore this computer’s` / `Use the other’s` | Verb first; says what Restore does; same wording as the existing choice notice. | | Dismiss button (merged/concurrent) | `Dismiss` → `Keep current` | Says the effect instead of hiding a notice. | | Notice action failed | `Computer link operation failed. Check the address, code and Network access settings.` → `Could not apply this value on this computer. Try again, or change it in its settings.` | What happened, then what to do; the link message fits only pairing. | | Other linked-computer actions | same generic link message → `Could not load linked computers. Try again.`, `Could not change this linked computer. Try again.`, `Could not move the threads. Check that the other computer is online, then try again.`, `Could not load moves. Try again.`, `Could not load workers of linked computers. Try again.`, `Could not read thread sync diagnostics. Try again.` | Each names the failed action and ends with an action. | | Settings → Linked computers fallback | `Computer link operation failed` → `Could not update linked computers. Try again.` | Ends with an action. | Glossary: "instance", "proxy", "computer" used as defined; no new terms; no "soul" sentences. Long computer names wrap (`break-words`). Related: #164, #696
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
The delayed-rejection test sometimes reads `expired` before the successful turn's account update runs, even though the turn is already committed. This is a test race: ingestion commits the turn, then awaits settling, broadcasts and agent-bus handling before calling `coreTurnLogin`. A database count therefore cannot establish that the success has entered `ProviderAccounts.afterTurn`; the test's no-op queue barrier can run ahead of it. Observe the real account-update enqueue, keep the rejected account read held until the success is queued, then wait for both real updates to finish before asserting `signed_in`. Waiting for both independently also catches a stale rejection when ordering is broken. Remove the database-count helper and the two-second sampling loop. Product ordering in `provider-accounts.ts` and `turn-logins.ts` stays unchanged. Related: #696, #700, #703 ### Verification - Stress: **171 passed, 29 failed out of 200 (14.5% failures)** before; **200 passed, 0 failed** after. Each repetition runs the focused file, including the earlier device-login scenario this case depends on; the target case executes once per repetition. The after run passed all **800/800** tests in **310.99 s**. No retries, sleeps or timeout increases were added. - The baseline used 48 completed direct repetitions, then 152 with the repository's shared-Postgres runner. The after run used `nice -n 10 bun run check:tmp <focused-file> --rerun-each=200`; its identical source was staged under a temporary test filename so the unchanged baseline could run alongside it. Both used a private `TMPDIR` under `/var/tmp`. - Mutation check: bypassing the real queue with `update()` makes the new test fail with `Expected: signed_in / Received: expired`. The mutation was confined to a temporary test copy and removed. - `bun install`, `bun run typecheck`, `bun run lint`, `bun run format:check`, and the final focused file: **passed**, all with `nice -n 10` and temp under `/var/tmp`. The shared-Postgres runner reported no test temp directories left behind. No UI, protocol or runtime behavior changes.
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Claude device logins stored in macOS Keychain appeared as **Not signed in** because Canopy changed `CLAUDE_CONFIG_DIR` to its shadow home. Claude scopes its keychain service by that directory; linking `.credentials.json` cannot share a login that has no file. The existing JSON parser already accepts the reported 2.1.325 response. Select the login separately with Claude's `CLAUDE_SECURESTORAGE_CONFIG_DIR` for both account probes and instance turns. Preserve the empty value for the default, unhashed keychain service, and preserve explicit config directories for scoped logins. Sessions, settings, hooks and plugins remain in the isolated home. Own-login instances and workers with device login disabled keep their isolated credential store. Reserve this environment variable against profile overrides; no tokens are read or exported by Canopy. ### Evidence - Inspected #696 and #697: empty `login_revision` does not create a signed-out state; rejected-login marks produce `expired`, and usage reports stay separate. This predates those changes. Desktop already preserves `HOME`, `USER` and `LOGNAME`. - Fake CLI through real WorkerHost, gRPC and PostgreSQL covers the reported keychain-backed JSON without a credentials file, a file-backed login, signed out with exit code 1, and the older JSON shape without the new optional fields. It also completes a real SDK turn while asserting that shadow home and default keychain scope remain separate, and rejects fallback from an empty own-login instance. - Account adapter coverage uses the desktop's actual `serviceEnvironment()` allowlist and the worker's process-governor spawn path. - macOS SSH check found Claude 2.1.325 and no credentials file. Both plain `auth status --json` and the sanitized desktop-like environment reported `loggedIn:false` in that SSH session, so a live GUI-session keychain login and real model turn remain unverified. No keychain tokens were read and no inference was requested. ### Validation Run with `nice -n 10` and `TMPDIR=/var/tmp`: - `bun install`, `bun run gen:check`, whole-repo `bun run typecheck`, `bun run lint`, `bun run format:check`: passed. The integration typecheck was repeated after the final test edits. - Focused tests: **28 passed, 0 failed**, across `provider-account-status`, `provider-accounts.integration`, `provider-sign-in-expired`, `provider-usage`, `provider-usage-bots`, and profile environment validation. - No UI copy changed. No browser/E2E or live inference tests were run. Related: #125 Related: #696 Related: #697
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Claude, Codex and Grok device-login instances now use the terminal's live credential store while retaining isolated agent configuration. Web, desktop and mobile can sign in and sign out through the official CLIs; own-login instances mutate only their isolated store. Claude uses `CLAUDE_SECURESTORAGE_CONFIG_DIR` for both keychain and file storage, including bots and text generation. Codex keeps a refreshable link instead of a stale copy; Windows can use a hard link when symlinks are unavailable. Grok retains `GROK_AUTH_PATH` and reports saved credentials without claiming their validity. Auth commands require strict worker ownership, reject platform workers and linked peers, share one flight per credential store, and keep outcomes tied to a specific login. Confirmations name the computer and explain terminal effects. The additive `provider_cli_auth_v1` capability protects old workers. Authorization codes remain transient and CLI output is never logged or forwarded. Related: #696, #724. Validation: - Review regressions covered: custom `GROK_AUTH_PATH` makes the device instance available while isolated homes remain separate; removing or disabling a sibling during Claude sign-in still publishes that login's completion. ConfigApplied also queues a fresh account read after an older in-flight report. - Install, gen:check, typecheck, lint, format:check, web build and both mobile exports passed. - Focused gateway↔worker tests cover start/complete/failure, logout, ownership/platform/linked refusals, single-flight, own-login isolation and refreshed source credentials. Codex link and bot/Grok text-generation coverage passed. - Native fingerprints match base dev: iOS `138e0c6b171c82b4933e86808cdfef56da73b8c6`; Android `906dc944f94eb8333fa384ed9f198834fdd30d13`. - Browser review passed on an isolated stack with fake CLIs: light/dark, desktop/phone, named-computer confirmations, Claude code submission, Grok device code, completion/failure and sign-out status refresh. The review found and fixed long computer names stretching the status table. Browser console: no errors or warnings. - Real accounts and native macOS/Windows sessions were not exercised. Only the release workflow publishes OTA after merge into dev; this PR does not publish updates, builds, tags or releases. Copy audit (§8): | Before → after | Reason | | --- | --- | | Codex-only sign-in → “Sign in”, “Sign out” for native instances | Imperative actions, same words across web and mobile. | | Terminal-only Claude/Grok guidance → named-computer confirmation and explicit terminal effects | Explains the affected login before mutation; own-login copy names the isolated instance. | | ChatGPT-only device instructions → browser code or Claude code-paste instructions | One action per sentence; password entry clears after submission. | | Unknown Grok account → “Login saved” / “Not signed in” | Reports file presence without claiming a verified account. | | Raw CLI errors → short actionable failure/update message plus named-computer terminal fallback | No token, diagnostic output or protocol jargon on the surface. | All changed copy uses sentence case, action verbs and text cues independent of colour. No empty states or personality copy were added. Reviewed desktop/phone widths, both themes and short, typical and long computer names; confirmations retain full names while the status label truncates.
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
## Why
Feedback from Settings → Providers → Codex (Device login): a signed-in
account offered **"Sign in again"**, which suggests something signed the
user out.
## What
One state-aware action label, shared by web and mobile through
`accountAction()` / `ACCOUNT_ACTION_LABELS` in
`@canopy/domain/provider-accounts`. It applies to every harness (Codex,
Claude, Grok).
| Login state | Action |
|---|---|
| none, error or unknown | **Sign in** |
| expired, or a turn rejected it (`expired`) | **Sign in again** |
| signed in, or login saved (Grok) | **Change account** |
- **Provider card (web LoginPanel, mobile ProviderLoginActions):** uses
the label. The confirm step keeps "This changes the CLI account on
<computer>, as <cli> does." Its button repeats the action (§8.3). **Sign
out** stays beside the action and hides only when the CLI is not signed
in.
- **Account status row (web):** the command popover uses the same label.
It is hidden when the in-app sign-in panel is next to it, so the action
does not show twice. It stays in "All workers" and Workers → Provider
accounts.
- **Failed turn card (web):** the login just failed, so the action is
"Sign in again", or "Sign in" when the CLI reports no login. The hint
("…, then retry.") and the confirm button match.
- **Summary line** ("Authenticated · ChatGPT") and the status labels
have no action, so they are unchanged. Mobile turn errors show only CLI
hints, with no button.
- Docs: `docs/provider-accounts.md` (status row) and a `provider
account` glossary entry in `docs/copy.md`.
Related: #696, #732
## Copy audit (docs/copy.md §8)
| Where | Before | After | Reason |
|---|---|---|---|
| Provider card button, signed in (web + mobile) | Sign in again / Sign
in | Change account | The login works. "Again" reads as a sign-out.
"Change" fits better than "Switch", because the new login replaces the
old one and there is no second account to switch back to. |
| Provider card button, expired/rejected | Sign in again (web) / Sign in
(mobile) | Sign in again | Correct here. Web and mobile now agree. |
| Provider card button, not signed in | Sign in | Sign in | Unchanged. |
| Confirm button (web SignInConfirm, mobile dialog) | Sign in | Sign in
/ Sign in again / Change account | A confirmation repeats the title's
verb (§8.3). |
| Mobile confirm title | Sign in? | Sign in? / Sign in again? / Change
account? | Matches the button. |
| Own-login confirm text | This signs in only this instance on X. | This
changes only this instance’s account on X. | Correct for all three
actions. One idea, 8 words. |
| Status row popover trigger (web) | Sign in / Sign in again | Sign in /
Sign in again / Change account | Same rule. Not shown next to the in-app
action (§2.12). |
| Failed turn hint + button (web) | Sign in, then retry. / Sign in |
Sign in again, then retry. / Sign in again (or Sign in) | The turn
showed the login was rejected. |
| Sign out (web + mobile) | Always shown | Hidden when not signed in |
Nothing to sign out. |
- Glossary: added `provider account`. Banned for its action: "switch
account", and "sign in again" while the login works.
- Buttons start with a verb, use sentence case and have no period. No
new errors or empty states. No sentences with "soul".
- Length: "Change account" is shorter than "Sign in again", so wrapping
is the same or better at phone width.
## Checks
- `bun install`, `gen:check`, `typecheck`, `lint`, `format:check`:
clean.
- Web build (`vite build`): clean.
- Mobile `expo export --platform all` (Android + iOS): clean.
- Expo fingerprint unchanged against `dev` (android `906dc944…`, ios
`138e0c6b…`). The change is JS only and ships OTA.
- Not run: `check:tmp` (full suite; no tests cover these labels and none
were added, per the no-UI-tests rule) and a live browser pass.
This was referenced Nov 16, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 23, 2026
A native Codex thread could keep a rejected ChatGPT login after its owner signed in again in a terminal. Canopy could report the new account as signed in while the next turn on the same thread still failed. Account Refresh and worker reprobes now compare the selected credential file's metadata with the last applied configuration. An affected app-server restarts after its turns and background tasks drain. Unchanged credentials keep the process running. Codex's reused or revoked refresh-token diagnostics lead to the existing sign-in action. A turn started after sign-out reports the selected instance's missing login. Isolated Codex homes share the device file store’s write lock and keep a valid credential link across the gap between terminal sign-out and sign-in. When device login is selected and available, a detached credential file in a managed home is backed up before restoring the link. Custom homes retain their existing protection. Codex 0.171 serializes writes after the OAuth exchange. Two independent clients sharing a ChatGPT grant can still request refresh concurrently. A separate instance login gives Canopy its own grant when the terminal is also in use. File sharing on Windows requires file-symlink permission. ## Verification - On Linux, Codex CLI 0.171.0 refreshed a synthetic ChatGPT login twice against a local OAuth endpoint, first from the isolated home and then from the device home. Both rotations reached the selected source file. - Focused worker tests exercised logout/login, lock identity, nested bot homes, legacy recovery and notification classification. Gateway↔worker integration covered both private and linked logins, in-flight work and a successful next turn on the original thread. - Worker typecheck, edited-file lint and diff checks passed locally. CI runs the store tests on Windows and macOS too. Interactive sign-in to a real ChatGPT account was outside local verification. ## Copy audit An account error for an unusable login lock explains the failure and asks the owner to check the instance directory and permissions. The existing sign-in action also covers rejected refresh tokens. The new detail has two fixed-length sentences and carries no account identifiers or paths. Fixes: #696 Related: #1150
nixuuu
added a commit
that referenced
this pull request
Nov 28, 2026
## What changed - Providers Summary now excludes workers whose instance account is reported as expired or signed out. Other workers with an available instance still count toward readiness. The worker detail shows the specific sign-in state. - A failed turn uses the worker's instance to show the correct sign-in confirmation before starting the existing CLI flow. If in-place sign-in is unavailable, the error links to that worker and instance in Providers. - The gateway-to-worker regression test now checks the readiness summary before the mock Codex turn fails, after the gateway reports the rejected sign-in, and after successful sign-in. Thanks to @marcinniewinski for reporting the mismatch. Fixes: #696 ## Verification - Locally on Linux, revision `1c80c45f2`: formatting, lint, and whitespace checks passed for the changed files. - Chromium on `b73bfc848` at 375 px and 1100 px with synthetic state and a mocked login endpoint: mixed worker readiness, scoped confirmation and request, and the scoped settings link passed. A long worker name wrapped in the confirmation. - GitHub CI runs the full static checks, the gateway-to-worker regression, and applicable builds. ## Copy audit - The Ready labels now reflect the account state. The worker detail uses the existing “Sign-in expired” and “Not signed in” labels. - The fallback link reads “Open provider settings” and the hint describes the next step. The in-place confirmation keeps the existing action label and names the login store it affects. - Text conveys the status independently of colour. The synthetic narrow and wide checks covered the confirmation text and actions.
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.
Change
A Codex turn failed with "Your provider login was rejected or has expired" (
unauthorized, refresh token expired), but Settings → Providers still said Authenticated · ChatGPT / Signed in:codex login statusonly readsauth.json. The built-in Device login instance had no in-app sign-in, so Sign in only opened settings and Retry failed the same way.auth_requiredfailure makes the gateway re-read that instance's account on that worker and remember it (worker/provider/instance, in memory like the rest of the account report) with the login file's revision. While the mark holds, the account state isexpired("Sign-in expired", detail "The provider rejected this login during a turn. Sign in again."). The mark clears when the login file changes (sign-in from the app or a terminal, token refresh), when a turn on that instance succeeds, or, for logins without a file (macOS keychain), after a manual Refresh. Proxies and API keys never get it. Same for Claude and Grok.ProviderAccountStatus.login_revision(additive field 13): a hash of the login file's inode, size and mtime, never its content. The gateway strips it before clients.codex_device_login_linked: an instance on the device login signs the device's Codex in again (CODEX_HOME= the device's Codex home, ascodex loginwould; no managed plugins written there). After a successful sign-in, the instance's Codex process restarts once it is idle.apps/worker/src/capabilities.ts(main.ts was at the 400-line limit).Security review follow-up (9d06ba6):
StartProviderLoginneeds strict ownership:workers.owner_user_idmust equal the caller. Platform-wide workers (owner_user_id IS NULL, visible to several owners) are refused. The method is no longer inSERVEDorWORKER_SETTINGS, so linked computers can't start it, and the home refuses a direct call over the link.ProviderAccountStatus.login_id/login_outcome, andStartProviderLoginResponse.login_idnames the sign-in to wait for. A failed sign-in shows "The sign-in did not finish. Start it again."Credentials stay where they were: tokens never leave the CLI home, nothing is logged, and every read stays owner-scoped.
Verification
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:check: clean.tests/integration/provider-sign-in-expired.test.tswith a fake Codex app-server (fixtures/login-codex.ts): a turn fails withunauthorized/ refresh-token-expired →ListProviderInstancesand the overview showexpired(nologin_revisionleaks); a forced Refresh keeps it;StartProviderLoginon the built-in device-login instance writes the device home'sauth.json→signed_in; the next turn succeeds. A second case clears the mark with a successful turn when the login file did not change.signed_in(this test fails with the queue bypassed); concurrent starts share onelogin_idand the account reportssigned_infor it; a platform-wide worker refuses sign-in; a linked computer can't start one, through its own API or directly over the link (config-sync-workers). Not checked in a browser: the new confirmation step.provider-accounts.integration,provider-account-status,provider-instances,provider-error-turns,codex-connections,apps/worker/src/providers,apps/gateway/src/core: all pass.expo exportiOS and Android OK, EAS fingerprints unchanged againstdev(iOSf05d9756…, Androidc0977af9…).unauthorized. The card shows "Sign in with ChatGPT, then retry.", Sign in, and a disabled Retry;break-words).Copy audit (docs/copy.md §8)
Authenticated · ChatGPT→Sign-in expired(when a turn rejected the login)Signed in→Sign-in expiredThe provider rejected this login during a turn. Sign in again.Sign in(only when signed out/expired) → alsoSign in againwhen signed inThis also signs in the Codex CLI on <worker>.Sign in from provider settings, or run codex login on the worker using this instance's CLI home.→Sign in with ChatGPT, then retry.<reason> Open provider settingsThis also changes the Codex CLI account on <worker>, as codex login does./This signs in only this instance on <worker>.+Continue with ChatGPT,CancelThis also signs in the Codex CLI on <worker>.→This also changes the Codex CLI account on <worker>, as codex login does.The sign-in did not finish. Start it again.Open the link, sign in with ChatGPT and enter this code. It expires in 15 minutes.,Waiting for the sign-in on <worker>…)Glossary: "instance", "worker", "turn", "provider" used as defined; no banned synonyms. No new "soul" sentences. Long worker names wrap (
break-words) in the code panel and login hint.Fixes an earlier change: #125