Repository navigation
fix(cli): stop run from sleeping through an exhausted quota - #42289
Closed
DaisukeYoda wants to merge 1 commit into
Closed
DaisukeYoda wants to merge 1 commit into
DaisukeYoda wants to merge 1 commit into
Conversation
Contributor
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Quota errors are retryable, and the retry schedule honors the provider's retry-after, which for a monthly limit is days. While it sleeps, halt() never runs, so no session.error and no idle are published. The non-interactive loop breaks only on idle and ignores retry status, so it waits with no output and no exit. Handle retry status in that loop: print it, and exit non-zero when action.reason marks the limit as non-transient. Transient retries carry no action.reason and still wait and retry as before. The session is aborted first because the sleeping schedule otherwise keeps the process alive after the loop breaks. Retry timing is unchanged; honoring long retry-after values is deliberate (0a2d7af). Fixes anomalyco#40747
DaisukeYoda
force-pushed
the
fix/run-exit-on-quota-limit
branch
from
August 13, 2026 10:10
411fcaf to
fc93a0f
Compare
Contributor
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
6 tasks done
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.
Fixes #40747 —
opencode runproduces no output and never returns when a model's quota is exhausted.It isn't wedged, it's sleeping. The quota error is classified as retryable, and
delay()honors the provider'sretry-after, which for a monthly limit is days. While the schedule sleeps,halt()never runs, so nosession.errorand noidleare published, andloop()incli/cmd/run.tsbreaks only onidleand has no branch forretrystatus. The TUI is unaffected because it shows the retry in its footer; a headless run has nowhere to show it.I left the retry timing alone — honoring long
retry-aftervalues was deliberate in 0a2d7af, and waiting out a short rate limit is useful. The change is only in the non-interactive loop:action.reasonisfree_tier_limit/account_rate_limit; transient retries (429/5xx) carry noaction.reasonand still wait and retry as beforeHow I verified it
New test in
test/cli/run/run-process.test.ts: the test provider returns a 429 carryingGoUsageLimitErrorwithretry-after: 345600, and the run must exit non-zero and mention the limit on stderr. On unmodifieddevit hangs until the harness kills it at 30 s; with this change it passes in ~2 s.Setting that header needed an optional
headersargument onhttpError()/llm.error()in the test harness —retry-afterdrives the delay and there was no way to set it before.bun test test/session/retry.test.ts test/cli/run/→ 250 pass, 5 skip, 0 fail.tsc --noEmitmatches thedevbaseline.