Repository navigation
#832 Retry-after countdown and usage-limit actions on session failures - #834
Merged
Merged
Conversation
…ilures Read v2 `retryAfterMs` into SessionFailure with the failure's recorded time. Show a "Try again in N s" line under the last turn's failure mark until it passes, except while the session is retrying. Map provider.free-limit and provider.model-budget-limit to Pick a model; provider.budget-limit gets no action. v1 and failures without retryAfterMs are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A 429 with a FreeUsageLimitError body and retry-after: 75 makes v2 fail the turn as provider.free-limit with retryAfterMs 75000. v1 retries the 429 live instead, so the scenario is v2 only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Automated review: no finding that 2+ of 3 passes agreed on.
2 finding(s) from a single pass, not posted
ios/OpenCode Mobile/OpenCode Mobile/Domain/Message/MessageModels.swift:213high: Int64 overflow crash on huge retryAfterMs (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/sessionchat/failure/SessionFailureChrome.kt:93low: Countdown mixes server-stamped recorded time with device clock (glm-5.3-flash)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.195
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #832
What
v2 run failures can now tell the user when to try again, and the new usage-limit error types get the right next step. Android and iOS, one Feature Slice.
retryAfterMs. The v2 error DTO (V2UnknownErrorDto/V2UnknownErrorDTO) has an optionalretryAfterMs.SessionFailurecarries it plus the time the failure was recorded: the failed message'stime.completed, or the receive time when that is missing. The livesession.step.failedtranslation keepsretryAfterMsin the v1-shaped error data (MessageErrorDataDto.retryAfterMs), so live failures and REST history behave the same. The session cache keeps both fields.HTTP 429 · <message>caption, counting down to recorded time +retryAfterMs. Above 90 s it shows minutes ("Try again in 4 min"). The line disappears at zero, and shows nothing if the time has already passed. Earlier turns never count down.retrystatus (SessionActivity.Retrying/.retrying, including content-filter retries that have no card), no failure mark shows the line.coversLiveRetry()and the composerSessionRetryCountdownare unchanged.provider.free-limitandprovider.model-budget-limit→ "Pick a model" (FailureAction.PickModel);provider.budget-limit→ no action. The server'smessageis shown as is; the app adds no copy of its own.retryAfterMsmeansretryAfterMs/recordedAtEpochMsstay null, so theSessionFailureis equal to what it was before and the mark looks the same. Unknown types keep their caption and actions.ServerErrorMessage(HTTP request errors) is untouched. No Retry/resend button (out of scope).Checks
Tests were written before the code on both platforms.
./gradlew :app:testDebugUnitTest :app:assembleDebug: passed, 2764 tests, 0 failures (1 skipped, as before). No ktlint violations on any changed line (the rest of the repo's ktlint and lint violations are unchanged).xcodebuild test -only-testing:"OpenCode MobileTests"on an iPhone 17 simulator:** TEST SUCCEEDED **, 2704 tests in 260 suites.provider.free-limit/provider.model-budget-limit/provider.budget-limit; retry time counted fromtime.completed, or from receive time when it is missing; budget payloads shaped like feat(core): read OpenCode Console usage limits and classify budget refusals anomalyco/opencode#58694; label rules (seconds up to 90 s, then minutes, none at zero or below); negativeretryAfterMsignored; livesession.step.failedkeepsretryAfterMs; countdown only on the last turn; and v1 failures plus failures withoutretryAfterMsstay exactly as before (equalSessionFailure).dev) through the scenario harness, using the newprovider-free-limit-retry-afterscenario (429,retry-after: 75,FreeUsageLimitErrorbody). The server sendsprovider.free-limitwithretryAfterMs: 75000. On both platforms:Risks / Follow-ups
retrystatus; and the budget types, which the local v2devcheckout does not have yet.provider.budget-limit/provider.model-budget-limitare only on upstreamdev(feat(core): read OpenCode Console usage limits and classify budget refusals anomalyco/opencode#58694). Tests use payloads shaped like that PR'sto-session-error.ts.time.completed, the countdown starts at the receive time, so a REST reload before upstream stamps the completion could restart it. Upstream stampstime.completedonsession.step.failed, so this should not happen in practice.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.