Repository navigation
fix: keep automatic reauthorization from stopping at a Google Ads passkey prompt - #1353
Conversation
Google can require passkey enrollment before it grants the Ads (adwords) scope, which blocks the whole consent screen. Automatic reauthorization replayed every stored scope, so accounts first authorized before Ads became opt-in (#1260) kept hitting the passkey gate on unrelated Gmail or Calendar commands. Drop a stored Ads scope unless the failing request needs Ads, keep Google from merging the old grant back, and print how to opt in again.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: blocked before merge. What this changesAutomatic reauthorization removes stored Google Ads access for non-Ads requests and explains how to restore it. Example: user@example.com has a revoked token containing Gmail and adwords scopes and runs a Gmail command.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it addresses a remaining automatic-reauthorization failure on current main, and its maintainer-authored direction is established; source review found no concrete introduced bug. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared OAuth recovery function receives the triggering command's requirements and stored token metadata, obtains browser consent, validates the account identity, and returns replacement metadata for persistence and request retry. flowchart TD
A[Gmail or Ads command] --> B[Invalid grant recovery]
B --> C[Stored grant and request requirements]
C --> D[Shared reauthorization scope selection]
D --> E[Google browser consent]
E --> F[Identity validation]
F --> G[Persist replacement token and retry]
Technical reviewBest possible solution: Keep the narrow Ads exception in shared reauthorization while retaining other stored grants, identity checks, and persistence-before-retry behavior. Do we have a high-confidence way to reproduce the issue? Current-main source shows that a non-Ads command replays a stored adwords scope; the author reports the associated Google passkey gate, but this review ran no target code. Is this the best way to solve the issue? The change fixes scope selection at its existing shared owner and prevents incremental authorization from restoring the removed Ads grant, without adding another recovery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 31c4e14186e8. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 24, 2026, 3:52 PM ET / 20:52 UTC. |
|
Stored-token compatibility proof for the "existing stored data" item. The persisted token format is unchanged; this run shows that tokens written by an older release, including ones that still carry the Ads scope, load and work with this branch. I built the PR head ( The new code only changes which scopes an automatic reauthorization requests. It does not affect loading or refreshing existing tokens, and the stored Gap: the automatic-recovery path for a revoked token that carries Ads is covered by |
Related: #1260
What Problem This Solves
People whose Google account was authorized before Google Ads became an explicit opt-in (#1260) still have the Ads (
adwords) scope in their stored grant. When that refresh token expires, gog's automatic reauthorization replays every stored scope, including Ads. Google can require passkey enrollment before it grants Ads access, so an ordinary Gmail or Calendar command ends up on a "Create a passkey to continue" page and cannot reauthorize at all.User Impact
Automatic reauthorization now leaves out a stored Ads scope unless the command that triggered it actually needs Ads. Gmail, Calendar, Drive, and other reauths complete without a passkey prompt. When Ads is dropped, gog says so on stderr and prints the command to restore it:
gog auth add <email> --services user,ads --force-consent. Accounts that run Ads commands keep the Ads scope.Why This Change Was Made
Reauth deliberately replays the stored scope set so a narrow command cannot silently shrink a broad grant. Ads is the exception, because requesting it now blocks the whole consent screen. When Ads is dropped, the request also stops asking Google to include previously granted scopes; otherwise the old Ads grant would be merged back in.
Evidence
TestReauthReplaysStoredAdsScopeOnlyForAdsRequests: a Gmail-triggered reauth drops the stored Ads scope and service, disables granted-scope merging, and prints the opt-in hint. An Ads-triggered reauth keeps Ads. The test fails onmainand passes with this change.go test ./internal/googleauth/ ./internal/cmd/andgolangci-lint run ./internal/googleauth/...pass locally.gog auth addOAuth flow: a consent request that includedadwordsstopped at Google's passkey enrollment page. The same request withoutadwordsreached the normal consent screen and completed. The automatic reauth path itself was covered by the unit test, not exercised live.