Skip to content

fix(opencode): stop v1 quota retries and surface transient waits - #39459

Draft
BearThreat wants to merge 1 commit into
pingdotgg:mainfrom
BearThreat:fix/opencode-v1-quota-retries-20261119
Draft

BearThreat wants to merge 1 commit into
pingdotgg:mainfrom
BearThreat:fix/opencode-v1-quota-retries-20261119

Conversation

@BearThreat

Copy link
Copy Markdown

OpenCode v1 reports some exhausted quotas as session.status: retry without a session.error. T3 ignores the retry details and can leave the turn running until a retry days away.

This handles v1 retry notices and ends an exhausted-quota turn with usage_limit. Explicit structured quota reasons terminate immediately; generic rate-limit text needs a retry deadline at least five minutes away. Short transient retries remain running and show a warning.

Quota finalization settles pending startup before bounded native abort, preserving the queued failure even when submission rejects or hangs. Buffered native wakes retain receipt-time classification. The stopped native session is marked broken because v1 terminal events lack turn identity; recovery opens a fresh session. No v2 behavior or quota-reset redemption changes.

Related: #28375 (merged, v2 retry warnings) and #31838 (open, v2 Go recovery).

Validation on current main 29b42d409c:

  • Full provider-opencode tests and package typecheck pass on Linux.
  • Regressions cover exact five-minute delayed wake replay, rejected/hung submission, a delayed event consumer, bounded abort and fresh-session recovery.
  • One-second per-minute limits and account_rate_limit=false remain transient.
  • An external pinned acceptance fixture passes patched nightly and main bases and rejects vanilla and the earlier revision with both races.

The live-provider report motivating this was OpenCode 1.19.4 receiving a Go quota 429 and scheduling a retry up to 24.9 days away. This PR uses deterministic SDK integration tests; it does not claim a new live quota-exhaustion test or database persistence test. Reviewed on a different Codex model; not cross-provider checked.

Classify quota at event receipt and retain the classification through wake replay. A quota terminal settles pending start admission before native abort so orchestration can persist the broken-session outcome.

Implemented with GPT-6.2 Sol in the Codex harness. not cross-provider checked.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant