Skip to content

Default Google account, and Google's account chooser on every sign-in - #47192

Merged
Jinwoo-H merged 6 commits into
mainfrom
google-default-account
Nov 23, 2026
Merged

Jinwoo-H merged 6 commits into
mainfrom
google-default-account

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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.

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

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

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.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

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: 32f1bd70-31f6-49a5-bab3-816a59a99f20
Commits

Reviewing files that changed from the base of the PR and between 5919469 and 04a3949.

Files ignored due to path filters: 1

  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 20

  • src/cli/bots/bot-handler-groups.ts
  • src/cli/google/google-default-account.ts
  • src/cli/google/google.ts
  • src/cli/specs/google.ts
  • src/main/google/google-account-tokens.ts
  • src/main/google/google-api-client.ts
  • src/main/google/google-connect.ts
  • src/main/google/google-credential-store.ts
  • src/main/google/google-default-account.test.ts
  • src/main/google/google-sign-in-run.ts
  • src/main/google/google-trigger-checker.ts
  • src/main/google/google-trigger-match.test.ts
  • src/main/google/google-trigger-match.ts
  • src/main/google/google-trigger-runtime.ts
  • src/main/runtime/rpc/methods/bots-connectors.ts
  • src/main/runtime/rpc/methods/google.ts
  • src/main/runtime/rpc/server/runtime-rpc-mobile-bot-methods.ts
  • src/shared/bots/bot-connectors-view.ts
  • src/shared/google/google-connect-types.ts
  • src/shared/rpc-contract/google-params.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.

Comment thread src/main/google/google-connect.ts Resolved
Comment thread src/shared/bots/bot-connectors-view.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.
…ve; stop stale Calendar timers; list a signed-out default
@Jinwoo-H
Jinwoo-H force-pushed the google-default-account branch from fe975e7 to d40712c Compare November 23, 2026 00:42
@Jinwoo-H
Jinwoo-H merged commit a11dccf into main Nov 23, 2026
38 of 39 checks passed
@Jinwoo-H
Jinwoo-H deleted the google-default-account branch November 23, 2026 01:00
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