You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default Google account, and Google's account chooser on every sign-in - #47192
A computer can hold several Google sign-ins, but once a second one was added, every Google command and Gmail/Calendar rule that didn't name an account stopped working. Now each computer has a default Google account that those use, and signing in always lets you pick the account on Google's page.
Files
Added
Deleted
Net
Test
3
$\color{#1a7f37}{\Huge{\mathbf{+}}}$265
$\color{#cf222e}{\Huge{\mathbf{−}}}$1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$264
Prod
19
$\color{#1a7f37}{\Huge{\mathbf{+}}}$265
$\color{#cf222e}{\Huge{\mathbf{−}}}$72
$\color{#1a7f37}{\Huge{\mathbf{+}}}$193
What Changed
Sign-in sends prompt=select_account consent, so Google always shows its account chooser (before: Google could silently reuse the browser's current account).
Each computer keeps a default Google account next to its saved sign-ins (~/.orca/google/default-account.enc, encrypted like the accounts):
Commands without --account use it instead of failing with "Several Google accounts are connected".
Gmail and Calendar rules without an account listen on it (before: they listened nowhere with 2+ accounts). A signed-out default is not swapped for another account.
With no saved default (the first sign-in, or a computer that already has 2+ accounts when it updates) the oldest account becomes the default and is kept, so a later reconnect never moves it.
Removing the default makes the oldest account left the default.
google.status reports defaultAccount (null with no account). A new google.default.set sets it (owner-only, refused from an agent run's token, like the other changes).
CLI: orca google default [<email>] reads or sets it; orca google status and the connectors list mark the default; orca google disconnect says which account is the default after a removal. Every existing flag still works.
A signed-out account's error now names it: "Reconnect [email protected] in Orca."
The UI (Settings rows, "Add another Google account") is the stacked PR.
Why
Adding a second account was possible from the CLI but broke existing automations; a default is what every comparable multi-account integration does, and it keeps the one-account case unchanged.
Linked Issue
N/A (maintainer)
Visual Proof
N/A: no UI in this PR. CLI on an isolated dev build with two sandboxed accounts:
$ orca google default
[email protected] is the default. Commands and automation rules without --account use it.
$ orca google status
Accounts on this computer:
[email protected] (default): connected
$ orca google default [email protected][email protected] is now the default. Commands and automation rules without --account use it.
$ orca google default [email protected][email protected] isn't connected on this computer.
Testing
I manually tested these changes locally (macOS, isolated dev build with a sandboxed HOME; upgrade with 2 accounts picked the oldest, set and read via CLI)
Automated tests added: google-default-account.test.ts (no account, upgrade with several, reconnect doesn't move it, adding keeps it, removing promotes the oldest left) and default rule targets in google-trigger-match.test.ts
Every added test fails without this change and avoids the test anti-patterns
Performance
None, because the default is one small file read under the existing accounts lock, on calls that already list the accounts.
Risk
Level: Low
Behaviour change on update: a computer that already has 2+ accounts starts running account-less commands and rules on its oldest account (they errored or were silent before). Mixed versions: an older desktop ignores defaultAccount; a newer desktop treats its absence as an older host and hides adding accounts (stacked PR). A revert leaves an unused default-account.enc.
Agent skill upstream boundary
Not applicable
Checklist
This PR is small and focused
I explained what changed and why
I stated the risk
N/A for screenshots with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered: paths go through the existing credential store; paired servers report their own default over the runtime RPC
Typecheck, lint and the changed tests pass locally; CI covers the rest
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The change adds persistent Google default-account selection. Users can view or set the default through the CLI and RPC interfaces. Account-less API calls and automation triggers use the resolved default account. Status and connector views identify the default, and disconnect responses report the current default account.
Merge Risk: Low · previous review 1ed37
Default-account support now routes account-less commands and rules correctly. One narrow Calendar edge case remains. If two rules in one automation share an event and one is moved to another account, the other can miss a notification until the next successful check. This is low risk and should be fixed with a small key change.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names two changes: a per-computer default Google account and Google's account chooser on every sign-in. Both appear in the changeset: the default is resolved and stored in google-credential-…
Description check
The description follows the repository template. It has the ELI5, What Changed, Why, Linked Issue (marked N/A for a maintainer), Visual Proof (N/A with a CLI transcript), Testing with checkboxes, Perf…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names two changes: a per-computer default Google account and Google's account chooser on every sign-in. Both appear in the changeset: the default is resolved and stored in google-credential-store.ts and google-default-account.ts, and the sign-in URL now sends prompt=select_account consent in google-sign-in-run.ts. The title covers the main change but omits the CLI, RPC, and trigger work, which is acceptable.
Full details: Description check
Explanation
The description follows the repository template. It has the ELI5, What Changed, Why, Linked Issue (marked N/A for a maintainer), Visual Proof (N/A with a CLI transcript), Testing with checkboxes, Performance with a one-line justification, Risk with level and revert notes, the AI Disclosure section, the Agent skill boundary, and the Checklist. The Review and Notes sections from the template are absent, and the Risk section gives a level but no explicit backout path beyond a brief revert note. These gaps are non-critical, so the check passes.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 30024b5e-56bb-4528-930a-090a6f70326a
Commits
Reviewing files that changed from the base of the PR and between ac64516 and 9d07d64.
Files selected for processing: 4
src/main/google/google-connect.ts
src/main/google/google-credential-store.ts
src/main/google/google-trigger-checker.ts
src/shared/bots/bot-connectors-view.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 11534f03-a464-46ff-8017-ff1b440f5a12
Commits
Reviewing files that changed from the base of the PR and between e4a1ee8 and 1ed3775.
Files selected for processing: 2
src/main/google/google-trigger-checker.test.ts
src/main/google/google-trigger-checker.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
… sign-in
Google sign-in now always shows Google's account chooser. Each computer
keeps a default Google account: commands and Gmail/Calendar rules that
name no account use it instead of failing once a second account is
connected. A computer that already has several accounts takes the oldest
as its default, and removing the default makes the oldest one left the
default. `orca google default [<email>]` reads or sets it, and
`orca google status` marks it.
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
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.
ELI5
A computer can hold several Google sign-ins, but once a second one was added, every Google command and Gmail/Calendar rule that didn't name an account stopped working. Now each computer has a default Google account that those use, and signing in always lets you pick the account on Google's page.
What Changed
prompt=select_account consent, so Google always shows its account chooser (before: Google could silently reuse the browser's current account).~/.orca/google/default-account.enc, encrypted like the accounts):--accountuse it instead of failing with "Several Google accounts are connected".google.statusreportsdefaultAccount(null with no account). A newgoogle.default.setsets it (owner-only, refused from an agent run's token, like the other changes).orca google default [<email>]reads or sets it;orca google statusand the connectors list mark the default;orca google disconnectsays which account is the default after a removal. Every existing flag still works.The UI (Settings rows, "Add another Google account") is the stacked PR.
Why
Adding a second account was possible from the CLI but broke existing automations; a default is what every comparable multi-account integration does, and it keeps the one-account case unchanged.
Linked Issue
N/A (maintainer)
Visual Proof
N/A: no UI in this PR. CLI on an isolated dev build with two sandboxed accounts:
Testing
google-default-account.test.ts(no account, upgrade with several, reconnect doesn't move it, adding keeps it, removing promotes the oldest left) and default rule targets ingoogle-trigger-match.test.tsPerformance
None, because the default is one small file read under the existing accounts lock, on calls that already list the accounts.
Risk
Level: Low
Behaviour change on update: a computer that already has 2+ accounts starts running account-less commands and rules on its oldest account (they errored or were silent before). Mixed versions: an older desktop ignores
defaultAccount; a newer desktop treats its absence as an older host and hides adding accounts (stacked PR). A revert leaves an unuseddefault-account.enc.Agent skill upstream boundary
Checklist
N/Afor screenshots with reason