Skip to content

fix(google): show Google's reason when access ends, and stop showing ended accounts as connected - #49268

Merged
Jinwoo-H merged 5 commits into
mainfrom
fix/google-access-ended-status
Nov 25, 2026
Merged

Jinwoo-H merged 5 commits into
mainfrom
fix/google-access-ended-status

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor

ELI5

When Google ends Orca's access to an account, Orca now shows Google's own reason next to its plain sentence, and the account stops saying "connected" once access is really gone.

Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​176 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​171
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​91 $\color{#cf222e}{\Huge{\mathbf{−}}}$​29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​62

What Changed

1. Google's exact error is kept and shown.

  • The shared login refresher (host-oauth-refresh.ts) now reads Google's error_subtype and error_description along with error, and hands all three to the owner when a grant ends (Linear's caller ignores them, as before).
  • The Google account record gains an optional googleError: { error, subtype?, description? }. A new sign-in writes a fresh record, so it clears on Reconnect.
  • The account view carries it as one line (googleRefusalText: description, then code and subtype). It shows where the status already shows:
    • Settings: the account row adds a line under "Signed out by Google".
    • orca google status: Reconnect. <Orca's sentence> Google said: <Google's reason>. Run ...
    • Phone: the Account page's "Google access ended." note gets Google's reason on the next line.

2. Status no longer says "connected" after access ends.

  • (a) Check again (checkAccounts) saved its probe results without expectedRefreshToken, so a refresh that marked the account Reconnect during the probes was overwritten with the old connected record and its dead tokens. That save is now conditional, like the other two Google saves.
  • (b) Google's permanent refusals end access the way invalid_grant does. The list, from Google's OAuth error codes:
    • invalid_grant (expired or revoked, unchanged), invalid_client and unauthorized_client (unchanged)
    • new: deleted_client (the OAuth client was deleted), admin_policy_enforced (Workspace admin policy blocks the scopes), org_internal (the account is outside the internal app's organization)
    • Everything else stays temporary: network failures, 5xx, 429, and request-shape errors like invalid_request.

Why

A Workspace user saw "connected" in Settings while every mail and calendar read failed, and the only message was a generic sentence. Google's own reason (for example invalid_rapt, a company re-auth policy) tells the person and their admin what happened. Both status bugs are fixed where they start: the unconditional save, and the refusal list.

Linked Issue

N/A (maintainer, no pre-existing issue)

Visual Proof

Settings, signed-out account (component fixture GoogleAccountSettings:needsFixing, dark):

Before After
before after

Testing

  • I manually tested these changes locally (component fixture screenshots above, macOS)
  • Automated tests added/updated
  • Every added test fails without this change and avoids the test anti-patterns

src/main/google/google-access-ended.test.ts (real credential store in a temp home, fake HTTP only): Google's error is stored and shown; admin_policy_enforced, deleted_client and org_internal end access; 503, 429 and invalid_request leave the record untouched; a grant ended during Check again stays Reconnect; a record saved before this change reads back unchanged. host-oauth-refresh.test.ts now pins that subtype and description reach the owner. With the source changes reverted, 6 of these tests fail.

Performance

None, because this only adds a few optional fields to a refusal path and the Google account record, and one conditional read inside an existing locked save that runs on Check again.

Risk

Level: Low

Saved data: the account record gains one optional field; older records parse unchanged (tested), and an older Orca reading a newer record ignores the extra key. Older phones ignore the new view field. The riskiest part is the new permanent codes: an account refused with one of them now shows Reconnect instead of staying "connected" while every call fails. A plain revert undoes everything; records written meanwhile keep a harmless extra field.

Review

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Google OAuth refusal responses now retain optional subtype and description details. Google account records store the refusal, and account views provide formatted error text. The CLI, renderer, and mobile interfaces display that text when present. Account checks skip records without refresh tokens and save probe results with the refresh token.

Merge Risk: Minimal · up to d11fe

This change shows Google's reason when access ends and keeps ended accounts from appearing connected. It is covered by tests and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: Google's reason is shown when access ends, and ended accounts no longer show as connected. Both match the changeset (googleError storage and display, plus permane…
Description check Passed The description follows the required template. It has ELI5, What Changed, Why, Linked Issue (marked N/A with a maintainer reason), Visual Proof (before/after fixture images), Testing with checkboxes a…
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 the two main changes: Google's reason is shown when access ends, and ended accounts no longer show as connected. Both match the changeset (googleError storage and display, plus permanent-refusal handling and the conditional save in checkAccounts). The title is long at 96 characters, but it is specific and on topic.

Full details: Description check

Explanation

The description follows the required template. It has ELI5, What Changed, Why, Linked Issue (marked N/A with a maintainer reason), Visual Proof (before/after fixture images), Testing with checkboxes and test details, Performance with a 'None, because' line, and Risk with a level and rollback notes. The AI Disclosure section is left blank, which the template allows for maintainers. The Review heading is empty, and the Agent skill upstream boundary checkbox is not ticked. These are minor gaps in non-critical sections.

  • 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

Recent 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: e1882fe3-51c7-4456-b50e-f6328e517986
Commits

Reviewing files that changed from the base of the PR and between 9a9247f and d11fef6.

Files selected for processing: 3

  • src/cli/google/google-bot-flags.test.ts
  • src/main/google/google-access-ended.test.ts
  • src/main/google/google-account-tokens.ts
Files skipped from review as they are similar to previous changes: 2

  • src/main/google/google-access-ended.test.ts
  • src/main/google/google-account-tokens.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 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: 2

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: 67309e9a-5eb6-4f54-996b-910f6bdb29a0
Commits

Reviewing files that changed from the base of the PR and between 2994440 and 50b3de2.

Files selected for processing: 12

  • mobile/src/bots/connectors/MobileBotGooglePage.tsx
  • mobile/src/session/native-chat/transcript/bot-cards/mobile-bot-card-operations.ts
  • src/cli/google/google-status-format.ts
  • src/main/google/google-access-ended.test.ts
  • src/main/google/google-account-tokens.ts
  • src/main/google/google-connect.ts
  • src/main/google/google-credential-store.ts
  • src/main/host-oauth/host-oauth-refresh.test.ts
  • src/main/host-oauth/host-oauth-refresh.ts
  • src/renderer/src/components/bots/google/GoogleAccountRow.tsx
  • src/renderer/src/components/bots/google/GoogleAccountSettings.fixture.tsx
  • src/shared/google/google-connect-types.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Comment thread src/cli/google/google-status-format.ts Resolved
@Jinwoo-H
Jinwoo-H merged commit 77f84c0 into main Nov 25, 2026
62 checks passed
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