Repository navigation
feat(providers): show account status for each worker instance - #125
Merged
Merged
Conversation
nixuuu
force-pushed
the
feat/process-governor-2
branch
from
November 5, 2026 05:51
00ec470 to
99f1c3a
Compare
nixuuu
marked this pull request as ready for review
November 5, 2026 05:57
nixuuu
added a commit
that referenced
this pull request
Nov 5, 2026
Applies `docs/copy.md` to the UI text added overnight (#79 to #125). Most of those changes were written before the guide existed. Only text changes: no behaviour or layout changes, except where removing a repeated fact removed an element. | Screen | Before | After | Reason | |---|---|---|---| | Reply errors | Pick another worker (Runs on) | Change worker | §4.1 no parenthetical label | | Bot wizard | Create New Bot / Create Bot / Edit Bot appearance / Name your Bot | Create bot / Edit bot appearance / Name your bot | §2.10 sentence case | | | Customise appearance · Colour · Custom colour · Hex colour | Customize appearance · Color · Custom color · Hex color | §2.5 one spelling across the app | | | Your bot needs an available provider instance with a model before it can be created. | Your bot needs a provider instance with a model. | §2.3 | | Bot "Runs on" | Prefer the local worker in desktop mode; otherwise use the first eligible online worker. | Uses the local worker in desktop mode, or else the first online worker that can run the bot. | §2.1 | | | Offline · messages will wait | Offline · messages wait | §2.3 | | | The bot keeps its harness session on this worker. | The bot keeps its session on this worker. | §2.8 jargon | | Provider instance | Applies next turn. Running tasks finish with their current settings; threads keep their sessions. | Applies from the next turn. Threads keep their sessions. | §2.1, §3 | | | Binary path | CLI path | §3 | | Account status | Run on this worker: | Run this on the worker, then refresh. | §2.6 | | | Configuration required | Needs setup | §2.5 | | | Could not refresh account status. | … Try again. | §4.4 | | Desktop restart | Restarting now interrupts the current turns on this desktop. The app will reconnect automatically. | Restarting stops the running turns on this computer. The app reconnects by itself. | §2.3, §3 | | App update status | X is not yet available for macOS. Desktop publishing may still be running or need a retry. | X is not ready for macOS yet. Check again in a few minutes. | §2.8, §2.6 | | Gateway errors | The gateway is not available | Could not reach the gateway. Check that it is running, then retry. | §4.4 | | Worktrees | Worktree could not be removed / Folder could not be opened | Could not remove the worktree. Try again. / Could not open the directory. Try again. | §2.3, §3, §4.4 | | | Uncommitted files will be permanently lost. The local branch will be kept so its commits can be recovered. | Removing it deletes the uncommitted files for good. Canopy keeps the local branch, so you can recover its commits. | §2.3 | | | Worktrees unavailable | Could not load worktrees. Refresh to try again. | §4.4 | | Settings → Worktrees | Keep worktrees with local changes: Keep uncommitted files and unpushed commits. Turning this off still requires manual confirmation for each worktree. | When off, Canopy still asks before it removes each worktree with local changes. | §2.12, §2.2 | | | Start from remote: Use the latest commit of the base branch's tracked remote branch, else the same branch on the remote; fall back to the local branch. | New worktrees start from the base branch's latest remote commit, or from the local branch if it has no remote. | §2.1, §2.2 | | Composer | Steer instead… | Steer instead | §2.11 | | | A dedicated scratch directory is created when you send. Files are kept until you remove them manually. | Canopy creates a scratch directory when you send. Its files stay until you remove them. | §2.3 | | New side thread | Continue from the main thread's last completed turn. Turn off to start with only your task. | The side thread starts from the main thread's last completed turn. | §4.2 | | Pending questions | The agent keeps working — answer any time. | The agent keeps working. Answer any time. | §2.1 | | Themes | Choose a light palette and a dark palette. Your color scheme decides which is shown. | Your color scheme decides which palette Canopy shows. | §4.2 | | Agent environment | Marketplace meta "· Pinned catalog" (same as the badge); plugin meta "Unassigned" (badge "Not assigned") | removed from the meta line | §2.12 same fact twice | | | Pasted commands are parsed without running them. | Canopy reads pasted commands without running them. | §2.3 | The commit has a few more strings of the same kind; this table shows the main ones. **Docs and tests:** updated where they quote changed strings: `docs/bots.md`, `docs/ui-api.md`, `apps/desktop/test/updates.test.ts`, `tests/integration/update-cache.test.ts`. **Left for later:** - Older strings from before #79. - The Appearance "Chat width" label; that page gets its own audit in the settings expansion. - The account-check detail messages. They are checked against a fixed list in `packages/domain`.
This was referenced Nov 13, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
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
…696) ## 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 status` only reads `auth.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. - **Gateway mark.** A turn that ends with an `auth_required` failure 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 is `expired` ("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. - **Login revision.** Workers report `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. - **Sign in from the error.** For Codex device-login instances, **Sign in** under the failed turn starts the ChatGPT device-code sign-in in place and shows the code. New worker capability `codex_device_login_linked`: an instance on the device login signs the device's Codex in again (`CODEX_HOME` = the device's Codex home, as `codex login` would; no managed plugins written there). After a successful sign-in, the instance's Codex process restarts once it is idle. - **Retry.** Retry is disabled while the account is marked; the hint says "Sign in with ChatGPT, then retry." - **Settings.** Every Codex device-login instance shows **Continue with ChatGPT / Sign in again with ChatGPT** (with "This also signs in the Codex CLI on <worker>." for the device login). The account row always offers the sign-in command ("Sign in again" when the account looks fine). The status line reads **Sign-in expired**. - **Mobile.** Provider accounts and the instance worker screen show "Sign-in expired" (mobile has no Retry or sign-in on the error card). - Worker capability list moved to `apps/worker/src/capabilities.ts` (main.ts was at the 400-line limit). **Security review follow-up (9d06ba6):** - `StartProviderLogin` needs strict ownership: `workers.owner_user_id` must equal the caller. Platform-wide workers (`owner_user_id IS NULL`, visible to several owners) are refused. The method is no longer in `SERVED` or `WORKER_SETTINGS`, so linked computers can't start it, and the home refuses a direct call over the link. - Turn outcomes of one worker update its accounts in arrival order (a per-worker queue). A rejection still waiting on its forced account read can no longer overwrite a later successful turn. - **Sign in** under a failed turn first says which computer it changes: "This also changes the Codex CLI account on <worker>, as codex login does." It starts only after **Continue with ChatGPT**. Settings uses the same sentence. - The device code stays until that sign-in finishes or fails. The worker reports `ProviderAccountStatus.login_id` / `login_outcome`, and `StartProviderLoginResponse.login_id` names the sign-in to wait for. A failed sign-in shows "The sign-in did not finish. Start it again." - One sign-in per instance: the gateway shares concurrent starts per owner and target, and the worker returns the running sign-in's code instead of starting a second process. 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. - New gateway↔worker test `tests/integration/provider-sign-in-expired.test.ts` with a fake Codex app-server (`fixtures/login-codex.ts`): a turn fails with `unauthorized` / refresh-token-expired → `ListProviderInstances` and the overview show `expired` (no `login_revision` leaks); a forced Refresh keeps it; `StartProviderLogin` on the built-in device-login instance writes the device home's `auth.json` → `signed_in`; the next turn succeeds. A second case clears the mark with a successful turn when the login file did not change. - Follow-up tests: a held account read for a rejection plus a later successful turn ends `signed_in` (this test fails with the queue bypassed); concurrent starts share one `login_id` and the account reports `signed_in` for 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. - Focused: `provider-accounts.integration`, `provider-account-status`, `provider-instances`, `provider-error-turns`, `codex-connections`, `apps/worker/src/providers`, `apps/gateway/src/core`: all pass. - Web build: OK. Mobile: typecheck OK, `expo export` iOS and Android OK, EAS fingerprints unchanged against `dev` (iOS `f05d9756…`, Android `c0977af9…`). - Browser check (review stack: gateway, worker and web built from this branch; Codex replaced by the fixture app-server with an expired device login; Claude and Grok off): - a Codex turn fails with `unauthorized`. The card shows "Sign in with ChatGPT, then retry.", **Sign in**, and a disabled **Retry**; - Settings → Providers shows "Sign-in expired" in the instance list, the status line and the account row (with the detail), plus **Sign in again with ChatGPT** and "This also signs in the Codex CLI on Review laptop."; - **Sign in** on the card shows the device code in place. When the worker reports the new login, the code goes away and **Retry** turns on. Retry then runs a turn that completes; - checked in light at desktop width and in dark at phone width (375 px). Nothing overflows, and the code panel wraps. - Not checked: very long worker names (the code panel and login hint use `break-words`). ## Copy audit (docs/copy.md §8) | Where | Before → after | Why | |---|---|---| | Status line (Settings → Providers) | `Authenticated · ChatGPT` → `Sign-in expired` (when a turn rejected the login) | Says what happened; amber, not colour alone (text). | | Account row state | `Signed in` → `Sign-in expired` | Same term as the status line. | | Account row detail (new) | — → `The provider rejected this login during a turn. Sign in again.` | What happened, then what to do; active voice; 2 sentences ≤ 10 words. | | Account row button | `Sign in` (only when signed out/expired) → also `Sign in again` when signed in | Verb first; re-login is always reachable. | | Login panel (device-login instance, new) | — → `This also signs in the Codex CLI on <worker>.` | One sentence; names the side effect. | | Turn error hint (Codex, app sign-in) | `Sign in from provider settings, or run codex login on the worker using this instance's CLI home.` → `Sign in with ChatGPT, then retry.` | Shorter; the button does the action; says why Retry waits. | | Turn error, sign-in start failed (new) | — → `<reason> Open provider settings` | Error plus the action. | | Sign-in confirmation (failed turn, new) | — → `This also changes the Codex CLI account on <worker>, as codex login does.` / `This signs in only this instance on <worker>.` + `Continue with ChatGPT`, `Cancel` | Names the affected computer before acting; same sentence as Settings. | | Login panel note (Settings) | `This also signs in the Codex CLI on <worker>.` → `This also changes the Codex CLI account on <worker>, as codex login does.` | Says that the account changes, and how. | | Sign-in failed (new) | — → `The sign-in did not finish. Start it again.` | What happened, then what to do. | | Device code | unchanged (`Open the link, sign in with ChatGPT and enter this code. It expires in 15 minutes.`, `Waiting for the sign-in on <worker>…`) | Reused as a shared component. | 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
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
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.
Stage 2 of 2. Settings → Providers and Workers now show each instance's account status on each worker. Canopy reads it through the official CLI:
claude auth status --json, andcodex login statusplus the running app-server.Copy audit (
docs/copy.md§8):