Skip to content

feat(providers): manage isolated cli logins from the app - #732

Merged
nixuuu merged 4 commits into
devfrom
feat/provider-cli-auth
Nov 14, 2026
Merged

nixuuu merged 4 commits into
devfrom
feat/provider-cli-auth

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

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
nixuuu marked this pull request as ready for review November 14, 2026 15:45
@nixuuu
nixuuu force-pushed the feat/provider-cli-auth branch from 7e2d5f2 to c24638c Compare November 14, 2026 16:06
@nixuuu
nixuuu force-pushed the feat/provider-cli-auth branch from bc199f8 to bca7839 Compare November 14, 2026 16:41
@nixuuu
nixuuu merged commit 4afa14e into dev Nov 14, 2026
11 checks passed
@nixuuu
nixuuu deleted the feat/provider-cli-auth branch November 14, 2026 16:53
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.
nixuuu added a commit that referenced this pull request Nov 23, 2026
Fixes: #732

Codex CLI 0.171.0 rejects atomic credential replacement when `auth.json`
has another hard link. If the source was already replaced, worker and
bot homes can still hold the old file.

- Remove the hard-link fallback and detach verified legacy aliases,
including inactive bot conversations and configured instance homes.
- Preserve detached files under a backup name in managed homes. Existing
bot conversations resume with the current login.
- Show a Windows Developer Mode hint when Canopy cannot create the
symbolic link.

## Verification

- Linux: 26 focused worker tests passed, including an existing bot
conversation with a hard link to the same old file as the thread's
backup.
- Linux: Codex CLI 0.171.0 reproduced the hard-link write error and
saved through a symbolic link using synthetic credentials.
- Worker typecheck, edited-file lint and formatting, and `git diff
--check` passed.
- The native Windows CI job now runs the two migration test files. A
real ChatGPT account and Windows desktop session are outside the local
verification.

## Copy audit

The existing account error now explains that Canopy could not use the
device login and names Windows Developer Mode as the action. The detail
uses two sentence-case sentences, contains no account data, and conveys
the action in text.
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