Skip to content

fix(providers): preserve claude keychain login in shadow homes - #724

Merged
nixuuu merged 1 commit into
devfrom
fix/claude-keychain-login-status
Nov 14, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/claude-keychain-login-status

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026

Copy link
Copy Markdown
Member

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 fix(providers): show rejected logins and sign in again from the app #696 and feat(providers): surface usage limits and paid usage notices #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
nixuuu merged commit a29d2f2 into dev Nov 14, 2026
9 checks passed
@nixuuu
nixuuu deleted the fix/claude-keychain-login-status branch November 14, 2026 14:40
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.
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