Repository navigation
Conversation
OpenCode reports a spent Go window as `provider.go-limit` ("OpenCode Go 5 hour
usage limit reached…"). T3 classified that as a generic provider error with no
reset time, so limited threads never armed usage-limit recovery and stayed
failed after the window reset, unlike Claude and Codex threads.
The OpenCode 2 adapter now treats `provider.go-limit` (and the older
`provider.quota` 429 `GoUsageLimitError` shape) as a usage limit and takes its
reset time from OpenCode Go's usage windows, which the driver already reads
for the usage bars: the window the error names, or any other spent Go window
that resets later. When Go usage cannot be read the failure stays a usage limit
without a reset, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Go limit fix read Go usage inside the adapter's event handler, which holds
the lock every OpenCode thread on the instance shares. Each Go limit failure
stalled all threads for up to the 5 second usage timeout, and an account-wide
limit hitting several threads serialized those reads.
A failed Go turn now keeps its end pending, reads usage in a forked fiber, and
ends under the lock once the read returns (or fails, or times out after 10
seconds, with no reset). A new execution, a Stop, or another end for that turn
supersedes the pending end; Stop ends it as interrupted instead of reporting
that nothing was running, and a reconnect leaves it to the pending read.
Review follow-ups:
- A Go limit error that names several windows, or names one alongside another
word the old patterns matched first ("weekly ... session"), now waits for
the latest named window instead of the first pattern in the list. "session"
is no longer read as the 5 hour window. The patterns assume OpenCode's
English error text.
- provider.go-limit with HTTP 402 stays a provider error, like provider.quota.
- Known limitation: a legacy provider.quota GoUsageLimitError whose message
names no window, while the usage endpoint still shows every window below
100%, keeps the usage limit without a reset rather than guessing one.
- OpenCode 1 (the v1 adapter) is out of scope: it reports limits as a bare
APIError 429 that does not say whose limit it is, so Go reset times would be
applied to other providers' rate limits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Stop sent while OpenCode Go's usage windows were read could lose to the read, which then ended the turn failed with a reset time, so the stopped thread resumed at the reset. The read now ends a stopped turn as interrupted with no reset. A start this build cannot decode now cancels the pending read, like a decoded start, so the read cannot end the restarted execution. A reconnect still lets a pending read finish the turn when OpenCode lists the session as running: that execution's end was already delivered, and the listing does not prove a new start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — OpenCode Go limit failures now include reset times so the existing opt-in recovery feature can resume threads. Auto-resume remains off by default, and timed reads and Stop handling limit unintended continuation. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…ge-limit-resume # Conflicts: # apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts
Problem
OpenCode 2 reports Go subscription limits as
provider.go-limit, without a reset time. These failures previously remained failed instead of entering the existing automatic usage-limit recovery flow.Change
Recognise Go limits and resolve their reset from the Go usage windows, waiting for the latest named or exhausted window. Perform the lookup outside the shared event lock, with a bounded timeout. Preserve Stop and replacement-start semantics so a late lookup cannot resume a stopped thread or end a replacement execution. HTTP 402 remains non-resettable.
Scope and approval
This is a focused repair of the existing opt-in automatic usage-limit recovery capability: OpenCode Go errors were missing the classification and reset timestamp that recovery already requires. It adds no setting or broader workflow. Submitted as an obvious bug fix without a prior approval discussion; no maintainer approval is claimed.
Verification
Validation: helper tests 8/8; adapter tests 104/106 (two pre-existing Windows attachment-path failures); provider suite 164 passed, 3 skipped, one pre-existing Windows XDG-path failure. Provider/server typechecks, lint and format pass. Gated regressions cover Stop during lookup, undecodable replacement starts and reconnect with a stale active listing. No live reset was exercised.
Review log (completed locally before publication):
Scope/limitations: OpenCode v1 has only a bare 429, insufficient to attribute a limit to Go, so remains unchanged. Unnamed legacy limits with lagging usage data may lack a reset time and require manual resume. Lost replacement-start events across reconnect remain an existing limitation. Lookup failure degrades to a usage limit without a reset. Commit email metadata was changed to GitHub no-reply after review; the final tree is identical to reviewed e24edba.
Implementation: Claude Opus 5.5 in the Claude Agent harness through T3 Code. Independent reviews: Opus 5.5, GPT-6.1 Sol (Codex harness), and GLM-5.3-Flash (OpenCode harness). Coordination and publication: GPT-6.1 Sol in the Codex harness through T3 Code.