fix(runtime-fallback): detect Gemini quota errors in session.status retry events (fixes #2454)#2592
Conversation
|
All contributors have signed the CLA. Thank you! ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: The change correctly addresses the issue where certain providers like Gemini omit specific retry text. It safely adds a fallback check against existing error patterns without regressions.
…etry events When Gemini returns a quota exhausted error, OpenCode auto-retries and fires session.status with type='retry'. The extractAutoRetrySignal function requires BOTH 'retrying in' text AND a quota pattern to match, but some providers (like Gemini) include only the error text in the retry message without the 'retrying in' phrase. Since status.type='retry' already confirms this is a retry event, the fix adds a fallback check: if extractAutoRetrySignal fails, check the message directly against RETRYABLE_ERROR_PATTERNS. This ensures quota errors like 'exhausted your capacity' trigger the fallback chain even when the retry message format differs from expected. Fixes code-yeongyu#2454
1a3ce72 to
7e3c36e
Compare
|
what 0auth you use to acces gemini ? I got banned, unbanned but soon afterwards banned again with Gemini(when they unbanned people I was raping it REALLY hard for 4 hours). I really would like to acces Gemini overtime to crosscheck/third opinion. |
I am using the opencode-gemini-auth plugin, and it has not been blocked for more than a month. |
|
The antigravity auth plugin likely gets blocked more often because it routes through higher-tier models. Google is probably more aggressive about enforcing rate limits on those. |
Summary
session.statushandler whenextractAutoRetrySignalfails butstatus.typeis already"retry"Problem
When Gemini returns a quota exhausted error ("You have exhausted your capacity on this model"), OpenCode auto-retries and fires
session.statuswithtype="retry". The runtime-fallback hook'ssession.statushandler usesextractAutoRetrySignal()which requires BOTH conditions to match:retrying\s+in- the retry countdown textexhausted\s+your\s+capacity)Some providers include only the error message in the retry status without the "retrying in" phrase, causing condition 1 to fail. The handler exits early and never triggers the fallback chain.
Fix
Added a fallback check after
extractAutoRetrySignalfails:Since
status.type === "retry"already confirms this is a retry event, the "retrying in" text check is redundant. The fallback path checks the message directly against the existingRETRYABLE_ERROR_PATTERNS(which already includesexhausted\s+your\s+capacity,quota\s+will\s+reset\s+after, etc.).Changes
session-status-handler.tsextractAutoRetrySignalfailsFixes #2454
Summary by cubic
Detects Gemini quota-exhausted retry events in runtime-fallback by matching
session.statusretry messages againstRETRYABLE_ERROR_PATTERNSwhenextractAutoRetrySignalfails andstatus.type === "retry". This triggers the fallback chain even when the message lacks "retrying in", fixing #2454.Written for commit 7e3c36e. Summary will update on new commits.