fix(gmail): circuit-break watch rate limits#665
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 2:51 PM ET / 18:51 UTC. Summary Reproducibility: yes. Source inspection on current main shows Gmail 429s from history/message fetches flow back as generic handler errors and would be retried without a persisted per-account circuit. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused circuit-breaker after maintainer review, keeping the per-account persisted state and regression coverage as the durable fix for the linked watcher bug. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows Gmail 429s from history/message fetches flow back as generic handler errors and would be retried without a persisted per-account circuit. Is this the best way to solve the issue? Yes. The PR is a narrow maintainable fix: persist the Retry-After deadline, check it before Gmail API calls, return 503/Retry-After while open, and cover the history and message 429 paths. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against e4941e776504. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Summary
rateLimitedUntilMscircuit when Gmail push handling hits 429Retry-Aftergmail watch statusand add regression coverage for history/message 429sFixes #643.
Testing
go test ./internal/cmd -run 'GmailWatchServer_(History429|Message429|OpenCircuit)|UpdateStateAfterHistoryKeepsConcurrentRateLimitCircuit'go test ./internal/cmd -run 'GmailWatchServer_(History429|Message429|OpenCircuit)'go test ./internal/cmd -run 'GmailWatch(Server|RateLimit|WatchState|ServeHTTP)'go test ./internal/cmd ./internal/googleapimake testmake lintautoreview --mode localcleangmail watch statusreturned stored watch state and realgmail labels listreturned 16 labels