feat(desktop): sign in to usage accounts in embedded terminals
What & why
Settings → Usage previously asked users to copy a login command into another terminal. Local Claude Code and Codex accounts now open an interactive terminal inside the account dialog, reusing the GitHub onboarding terminal. The initial form stays compact; the terminal view has a top-left Back action that preserves profile/billing choices, inline status, retry, and command details. Remote hosts retain the copy-command flow. Plain URLs (including wrapped OAuth URLs) and OSC 8 hyperlinks open the system browser with an ordinary click; opening errors surface in a toast.
GitHub setup and Usage sign-in share CommandTerminal for PTY lifecycle, queued input, cancellation, and browser links. Appearance settings and URL detection live in shared renderer modules, so the embedded component does not import workspace-pane code. The workspace terminal pane keeps its existing implementation and behavior.
Sign-in detection now matches the selected profile and requires a credential fingerprint. Embedded sign-in also requires a successful process exit, so copied Claude identity, unrelated profiles, failed Codex login, and Ctrl+C cannot trigger success. Re-login to the same email is detected through credential changes. Closing or going Back cleans up the terminal, including an in-flight launch.
Before/after screenshots and cancellation walkthrough
How I tested it
- Passed repo-wide
bun run lint,bun run typecheck(42 tasks),bun run check:i18n, andbun run check:plugins. - Passed 3,556 focused URL-provider, link-manager, and embedded-terminal tests after factoring shared dependencies.
- Passed 43 focused tests covering profile matching, missing/expired Claude credentials, same-email re-login, API billing markers, and actual shell exit-status propagation.
- Full uncached regression (
bun run test --force --continue=always): 13,089 passed, 37 failed, 2 skipped, 8 TODO. Desktop has the exact same 34 failing cases as the previous run (7,568 pass). Host-service has three additional failures: one session-folder collision with an existing~/.superset/sessions/dupe-target(reproduces independently), and two agent launch-command assertions affected by configured Claude profile state (all 60 tests in that file pass independently). All six real-Git fuzz scenarios pass. This is not a green full-suite result. - Real UI verification in this worktree's desktop renderer (
localhost:4805, CDP9485): account setup, terminal prompt, Back with preserved selections, command popover, Ctrl+C failure/retry, and close/reopen. Captured screenshots and checked for horizontal overflow. - Added automated checks for ordinary-click activation of wrapped URLs, OSC 8 hyperlinks, protocol filtering, and cleanup. A live Codex terminal displayed the wrapped authorization URL; after clicking it, the system browser was observed on
auth.openai.com. This was not a complete end-to-end authentication test. - Did not complete authentication with a real provider. Success detection is covered by automated tests; manual verification stopped at the credential prompt.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs (same-repository branch)
Summary by CodeRabbit
-
New Features
- Added an embedded command terminal for local account sign-in.
- Terminal output now detects and opens safe web links.
- Sign-in dialogs provide waiting, failure, retry, and back states.
- Account setup can display the sign-in command in a popover.
-
Bug Fixes
- Sign-in failures and cancellations now report accurate exit status.
- Completed sign-ins are detected more reliably across supported account types.
- Terminal cleanup is handled safely when closing during startup.
-
Localization
- Removed obsolete “The Codex sign-in” translation entries.
Latest regression also passed uncached type checking (42 tasks), lint, translation checks, plugin validation, and 15 release-script tests. No source changes were made for this run.