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
fix(google): show Google's reason when access ends, and stop showing ended accounts as connected - #49268
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.
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.
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: 4
Check name
Status
Explanation
Title check
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
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
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 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.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
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
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.
What Changed
1. Google's exact error is kept and shown.
host-oauth-refresh.ts) now reads Google'serror_subtypeanderror_descriptionalong witherror, and hands all three to the owner when a grant ends (Linear's caller ignores them, as before).googleError: { error, subtype?, description? }. A new sign-in writes a fresh record, so it clears on Reconnect.googleRefusalText: description, then code and subtype). It shows where the status already shows:orca google status:Reconnect. <Orca's sentence> Google said: <Google's reason>. Run ...2. Status no longer says "connected" after access ends.
checkAccounts) saved its probe results withoutexpectedRefreshToken, 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.invalid_grantdoes. The list, from Google's OAuth error codes:invalid_grant(expired or revoked, unchanged),invalid_clientandunauthorized_client(unchanged)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)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):Testing
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_clientandorg_internalend access; 503, 429 andinvalid_requestleave the record untouched; a grant ended during Check again stays Reconnect; a record saved before this change reads back unchanged.host-oauth-refresh.test.tsnow 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