GeezerVison is showing github.com — fix(opencode): show usage-limit warnings while OpenCode 2 retries by only21mil · Pull Request #28375 · pingdotgg/t3code
Conversation
only21mil
commented
Oct 31, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
When OpenCode 2 hits a rate limit or a usage window (HTTP 429), it schedules a retry, and T3 shows a retry row while it waits. That row is always classed as a provider error, while the final row for the same error is classed as a usage limit. So while the retry runs, web shows the row without the usage-limit warning, and mobile shows it with the provider-error alert icon.
Change
One small helper, isUsageLimit(type, status), holds the existing terminal rule (a 429 quota or a rate limit is a usage limit; a 402 quota is not), and updateRetry and the terminal case both use it. Server-side usage-limit handling reads only failed rows, so this changes only how a running retry row looks.
Scope
A bug fix: the same error gets two classes depending only on whether OpenCode will retry it. No issue or discussion: a very small, focused fix for an obvious bug; web and mobile already have a usage-limit look for a running retry row. OpenCode v1 has no retry rows.
Verification
To see it on Linux web: (1) point OpenCode 2 at a model that answers HTTP 429 with Retry-After: 600, (2) send a prompt, (3) on main the running retry row has no usage-limit warning.
I ran that with OpenCode 2.2.7 and a local stand-in model (not a real provider) on web and the iOS simulator, main 330b9f4840, this PR 278a992f20 and a local merge b120d66d7f. Main stores the row as provider_error, this PR as usage_limit. In OpenCode2AdapterV2.test.ts, 8 cases fail on main's adapter and all 88 pass at 278a992f20.
Android 16 Pixel emulator (software rendering), each revision's own client, main b68aedfdb7, this PR 278a992f20, then a local merge (4eefec4ac0): main shows the provider-error alert icon and stores provider_error; this PR and the merge show the X glyph mobile uses for usage limits and store usage_limit.
Re-checked against main f419698aea on 2026-11-12: the test fails on that main without the change and passes with it, and the branch merges cleanly.
Web, main 330b9f4: running retry row without a warning

Web, this PR 278a992: running retry row with the usage-limit warning

Android, main b68aedf: running retry row with the provider-error alert icon

Android, this PR 278a992: running retry row with the X glyph mobile uses for usage limits

Not checked:
- A real provider's 429. The stand-in returns a fixed rate-limit error, which OpenCode classes as
provider.rate-limit.
- Desktop builds on macOS, Windows and Linux.
- A physical iOS or Android phone (simulator and emulator only).
- Mobile draws usage-limit rows with an X (its existing glyph for warnings). This PR doesn't change that mapping.
Cause detail, tests, OpenCode's own retry event and the stored row, and the other captures
updateRetry in the OpenCode 2 adapter hard-codes class: "provider_error". The terminal session.execution.failed case already classes provider.rate-limit and non-402 provider.quota errors as usage_limit. It only gets the usage-limit look once the turn has failed.
- One small helper,
isUsageLimit(type, status), holds the existing terminal rule: a 429 quota or a rate limit is a usage limit, and a 402 quota (an empty balance) is not.
updateRetry and the terminal case both use it. The retry row stays retryable: true.
Claude retry rows already do this: a 429 retry is usage_limit. Server-side usage-limit handling (recovery, auto-resume, usage refresh, the thread's last error) reads only failed rows, so a running retry row with this class changes only how the row looks. If the retry succeeds, the row turns completed and shows as recovered, as before.
apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts:
- The existing "classifies $name as $failureClass" table now schedules a retry before each failure and checks the running retry row's class.
- The retry block's shared fixture for a 429 rate limit now expects
usage_limit.
- On main's adapter (
330b9f4840) 8 of these fail: the three 429 rows and the five retry-block tests. The 402 row passes there and with the fix, so an empty balance stays a provider error.
- All 88 pass at
278a992f20, and all 149 with this branch merged locally into main.
Real run: OpenCode 2.2.7 through T3's adapter on isolated test servers. A local stand-in model (not a real provider) answers agent requests with HTTP 429 and Retry-After: 600, so OpenCode schedules a retry. Web order: main, this branch, then this branch merged locally into main (b120d66d7f, not pushed); prompts sent in T3's Browser panel.
Main (330b9f4840):
$ grep -h session.retry.scheduled events-main.sse
data: {"id":"evt_1cc9727bb001f39RmO5Pv0H6xF","created":1794433820603,"type":"session.retry.scheduled","location":{"directory":"/mnt/sample-notes"},"data":{"sessionID":"ses_e3368d92dffeNOwPZKJLr5KqNz","assistantMessageID":"msg_1cc9727a2001TkGg7E3BONJoxA","attempt":2,"at":1794434420603,"error":{"type":"provider.rate-limit","message":"Rate limit reached for sample model. Try again later.","status":429,"response":{"body":"{\"error\":{\"message\":\"Rate limit reached for sample model. Try again later.\",\"type\":\"rate_limit_error\",\"code\":\"rate_limit_exceeded\"}}"},"retryAfterMs":600000}},"durable":{"aggregateID":"ses_e3368d92dffeNOwPZKJLr5KqNz","seq":6,"version":1}}
$ read-row.sh main e8bd4f18-a706-48f5-89ca-b8e9a98eb4c8
{"type":"error","status":"running","failure_class":"provider_error","failure_code":"provider.rate-limit","retryable":1,"retry_delay_ms":600000}
This PR (278a992f20):
$ grep -h session.retry.scheduled events-head.sse
data: {"id":"evt_1cc9bac43001wn60Npcqy0dUAX","created":1794434116675,"type":"session.retry.scheduled","location":{"directory":"/mnt/sample-notes"},"data":{"sessionID":"ses_e3364550affenTtulQzsJpHfN8","assistantMessageID":"msg_1cc9bac32001FK2FxhCxLWePTF","attempt":2,"at":1794434716675,"error":{"type":"provider.rate-limit","message":"Rate limit reached for sample model. Try again later.","status":429,"response":{"body":"{\"error\":{\"message\":\"Rate limit reached for sample model. Try again later.\",\"type\":\"rate_limit_error\",\"code\":\"rate_limit_exceeded\"}}"},"retryAfterMs":600000}},"durable":{"aggregateID":"ses_e3364550affenTtulQzsJpHfN8","seq":6,"version":1}}
$ read-row.sh head 6ca6e2d9-d9df-4634-9d5b-f22408cd9058
{"type":"error","status":"running","failure_class":"usage_limit","failure_code":"provider.rate-limit","retryable":1,"retry_delay_ms":600000}
Web, merged into main b120d66d7f: running retry row with the usage-limit warning

iOS simulator (iPhone 17 Pro, iOS 26.5), same servers, Metro serving each revision's checkout. Order: merged tree, main, this branch.
iOS, main 330b9f4: retry row with the provider-error alert icon

iOS, this PR 278a992: retry row with the icon mobile uses for usage limits

iOS, merged into main b120d66d7f: retry row with the usage-limit icon

Android emulator (Pixel 10 profile, Android 16, software rendering). Test servers ran on a Mac with a scratch home, --no-seed, the machine name "Test machine", the same OpenCode 2.2.7 and stand-in model, and each revision's own checkout; the phone ran each revision's own development client and Metro bundle (the merge changes only the two server-side files, so it ran main's client). Prompt sent from the web client, row opened on the phone. Order: main, this PR, merge.
Main (b68aedfdb7):
$ read-row.sh main 9199f89b-8f5b-4340-97a2-3cce33098d27
{"type":"error","status":"running","failure_class":"provider_error","failure_code":"provider.rate-limit","retryable":1,"retry_delay_ms":600000}
$ tail -2 mock-requests.jsonl
{"at":"2026-11-12T10:14:10.918Z","url":"/v1/chat/completions","hasTools":true,"status":429}
This PR (278a992f20):
$ read-row.sh head28375 814393a9-0633-4c8d-a01c-33ae7e11e359
{"type":"error","status":"running","failure_class":"usage_limit","failure_code":"provider.rate-limit","retryable":1,"retry_delay_ms":600000}
Merged into main (4eefec4ac0):
$ read-row.sh merged28375 04a60dfd-ce5d-4c94-84cf-1fa20adea09e
{"type":"error","status":"running","failure_class":"usage_limit","failure_code":"provider.rate-limit","retryable":1,"retry_delay_ms":600000}
Android, merged into main 4eefec4ac0: running retry row with the X glyph mobile uses for usage limits

Re-check on main f419698aea (it changed adapter.ts in #35084 since the runs above), the same web steps on a fresh server each: main stores the running retry row as provider_error with no warning; the local merge 0fe88dc848 stores usage_limit and shows the warning.
Web, main f419698: running retry row without a warning

Web, merged into main 0fe88dc848: running retry row with the usage-limit warning

Prior PRs
#18315 by Marker-bit made OpenCode Go quota stops show as usage limits on the final row. This PR applies the same rule to the retry row that comes before it.
Generated with Claude Opus 5.5 and GPT-6.1 Terra in T3 Code Nightly
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
A retry scheduled for a rate limit or a 429 quota showed as a provider
error while it ran, and only the terminal failure row was classed as a
usage limit. Retry rows now share the terminal row's classification, so
an out-of-funds 402 quota stays a provider error and the row stays
retryable.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Approvability
Verdict: Approved at d181dbd
Macroscope's review found this PR approvable — OpenCode 2 quota and rate-limit retries now appear as usage-limit warnings using the existing classification rules. Retry behavior and terminal error classification remain unchanged.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 31, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
The OpenCode 2 adapter now uses a shared rule to classify retry and execution failures as usage limits or provider errors. Execution failures set resetAt from matching Claude limit messages. Tests check the retry event and terminal failure.
Changes: OpenCode 2 usage-limit classification
| Layer / File(s) |
Summary |
Classify retry and execution failures packages/provider-opencode/src/server/v2/adapter.ts |
A shared classifier treats provider.rate-limit errors, non-402 provider.quota errors, and matching Claude limit messages as usage limits. Retry and execution failure handling use this classifier. Execution failures set resetAt from a matching Claude limit message, or null otherwise. |
Verify retry and terminal events apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts |
The test checks the running retry error row, including its failure class and retryability. The retry and terminal failure fixtures use the usage_limit classification. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: fixfon
Merge Risk: Minimal · up to fbb1b
-
This change makes retry warnings for usage limits show the same classification as the final error. No concrete merge-blocking risk was found.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the fix and its scope: OpenCode 2 running retry rows now show the usage-limit warning. The raw summary and objectives confirm the change: updateRetry uses the new isUsageLimit helper, … |
| Description check |
 |
The description follows the template's sections: Problem, Change, Scope, and Verification. It explains the cause, the helper and its use in updateRetry and the terminal case, why the change is bounded… |
| 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 fix and its scope: OpenCode 2 running retry rows now show the usage-limit warning. The raw summary and objectives confirm the change: updateRetry uses the new isUsageLimit helper, so retry rows classify 429 quota and rate-limit errors as usage_limit, matching the terminal failure. The title's 'opencode' scope and 'fix' type fit a bug fix, and the 65-character length is within a readable range.
Full details: Description check
-
Explanation
The description follows the template's sections: Problem, Change, Scope, and Verification. It explains the cause, the helper and its use in updateRetry and the terminal case, why the change is bounded, and how the author verified it. Verification includes focused test counts (8 failing on main, 88 passing with the change), reproduction steps, and captured before/after evidence. It also lists what was not checked. The Scope section gives a reason for no linked issue, as the template asks, but it does not link an issue, and the 'Prior PRs' section and the 'Generated with' line are extra. The description is thorough and mostly complete, so it passes.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 278a992 and fbb1b40.
Files selected for processing: 2
-
apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts
packages/provider-opencode/src/server/v2/adapter.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Written by gpt-6.1-sol on behalf of Maria
Merged main without rebasing and resolved the OpenCode adapter conflict, preserving main's Claude limit classification and reset timestamp handling. Adjusted the retry assertion for main's provider.unknown cases so their existing provider-error retry behavior stays unchanged. The original rate-limit/quota retry fix remains intact, including 402 handling and retry recovery.
At 278a992f209a389fc7abccad391bfd5a9d731329, Blacksmith passes all 88 OpenCode2 adapter tests and vp run check:changed github/main: format, lint, knip, GraphQL, 10 package typechecks, and 89 tests. Two independent scoped reviews approve this head. The diff remains two files. Original client evidence is retained; real provider/client interaction was not repeated during this merge fix.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Written by gpt-6.1-sol on behalf of Maria
Verified in a real dev environment
partial verification at 278a992f209a389fc7abccad391bfd5a9d731329 on a linux boat vm. ran github/main (e1e520c93c) in a separate worktree first, stopped it, then ran the exact pr head. installed dependencies on both. used isolated dev state, playwright from repo dependencies, and /usr/bin/google-chrome. created the project and threads through the web app. no mocks, fixtures, or synthetic provider errors.
- real codex
gpt-6.1-sol turns completed on both revisions, reading package.json and reporting its package name and package manager.
- real opencode
2.0.28 with opencode/beam-free returned a terminal free-usage quota error on both revisions. the persisted error row was status: failed, class: usage_limit, code: provider.quota, retryable: null. the web client showed the usage warning.
- on the pr, switching that failed opencode thread to codex
gpt-6.1-sol produced a context handoff and a successful response. the usage-limit banner cleared.
- fresh blacksmith run:
vp test run apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts, 88/88 passed. no source changes or pushes.
main, terminal quota warning:

pr, same prompt and provider, terminal quota warning:

pr interaction: real terminal quota failure, model switch, context handoff, and successful codex response. a 15-second idle gap was trimmed; this is not retry-recovery evidence.

runtime transcript
Not verified
the actual changed behavior remains unverified. the real service failed immediately and never scheduled a retry on either revision. there were zero running retry rows, so i could not reproduce the original running-retry bug on main or prove its fix on the pr. i did not replace the provider with a stub or manufacture a 429. passing adapter tests and terminal-warning captures do not prove the running retry path.
also unverified: real 402 balance errors, automatic retry recovery, native ios/android clients, and native desktop builds. these require an appropriate real provider condition or native environment. this is a partial runtime check, not a ready-to-merge claim.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note 🤖 Opus 5.5 replying on behalf of Victor.
@maria-rcks thanks for the run; we ran the real OpenCode 2.2.5 binary through T3's adapter in an isolated home, against a local stub upstream (not a real provider) that answered 429 with Retry-After, then 402, then success. OpenCode emitted the same retry events on both builds, and T3 stored the running 429 retry as provider_error on main (d313b2aff3) and usage_limit with the amber row at 278a992f20, while a 402 retry stays provider_error and a successful retry shows "Provider recovered" on both (transcript). OpenCode never retries a plain 402, so the stub added x-should-retry: true to get a running 402 row; a real provider's 429 or 402 and the native builds at this head stay unverified.


|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Move the Claude limit text check into isUsageLimit so a retry row and the
failure that ends its turn are classified the same way.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Evidence
Real OpenCode 2.2.7, Linux Chromium, dark theme, 1280×800 CSS viewport, fresh isolated databases on both commits. Selected OpenCode → Limited Model (Stand-in), sent “Say hello in one sentence.”, received HTTP 429 with rate_limit_exceeded and Retry-After: 600, then expanded the running retry group and detail.
The retry-row crops were pixel-identical across captures 500 ms apart. Captures and recording contact sheets were inspected. The expanded retry detail changes from neutral to amber warning; the collapsed work-group summary stays neutral on both commits. Stored running failure.class changes from provider_error to usage_limit, retaining provider.rate-limit and retryDelayMs=600000.
Stand-in endpoint · Fixture seed script · Setup and browser steps
Manual proof was used because replay scenarios cannot cover provider-specific behavior.
Not shown:
- Mobile presentation was not exercised on a device.
- Non-402 quota errors, HTTP 402 classification, and Claude plan-limit messages were not exercised; the visual proof covers the reported HTTP 429 rate-limit reproduction.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|