Repository navigation
feat(opencode): bound Responses headers wait with opt-in rotation budget - #14558
Merged
diegosouzapw merged 5 commits intoSep 24, 2026
Conversation
maxmad64bis
force-pushed
the
feat/opencode-headers-wait-rotation
branch
2 times, most recently
from
September 22, 2026 22:02
07bf010 to
d7aef05
Compare
maxmad64bis
marked this pull request as ready for review
September 22, 2026 22:05
maxmad64bis
force-pushed
the
feat/opencode-headers-wait-rotation
branch
from
September 22, 2026 23:05
d7aef05 to
11ec8da
Compare
No default change, off-by-default: without OPENCODE_RESPONSES_HEADERS_WAIT_MS the dispatch path is untouched (window 0, no timer). When an operator sets a positive window below the effective fetch-start ceiling, a streamed Responses attempt stops waiting for upstream headers after the window and rotates to the next account (budget OPENCODE_RESPONSES_HEADERS_WAIT_MAX_ROTATIONS, default 2); the last remaining account always keeps the full headers window. Expiry reuses the stall settle (slot release, cooldown, tried-set); client aborts propagate and never rotate. Only shortens, never extends, the fetch-start ceiling.
maxmad64bis
force-pushed
the
feat/opencode-headers-wait-rotation
branch
from
September 22, 2026 23:31
11ec8da to
229cc15
Compare
Owner
|
Clean, well-scoped addition — off by default, restricted to streaming Responses |
…ase tip The tip had shrunk open-sse/executors/opencode.ts to 1301 lines under the old 1318 ceiling, so the headers-wait seam (+37) lands at 1338, not 1355. Set the frozen ceiling to the measured 1338 and restore the original key order of the neighbouring rebaseline annotations (the branch had moved two of them to the end of the file as a merge artifact).
…ncode-headers-wait-rotation Reconcile with the base tip: keep the opt-in headers-wait seam, take the base 429 quota curve and proxyFetch growth, keep both file-size rebaseline keys.
# Conflicts: # config/quality/file-size-baseline.json
diegosouzapw
merged commit Sep 24, 2026
02bb598
into
diegosouzapw:release/v3.8.51
4 of 7 checks passed
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.
Summary
No default change, off-by-default. A streamed Responses call that waits for upstream response headers no longer holds the full headers window when another account is still available: an opt-in per-attempt budget (
OPENCODE_RESPONSES_HEADERS_WAIT_MS,0= off, suggested30000, max 2 rotations viaOPENCODE_RESPONSES_HEADERS_WAIT_MAX_ROTATIONS) stops waiting on a queued request and moves on to the next account. No host scoping: the window only shortens the effective fetch-start ceiling, so the 600 s opencode-go registry cap neutralizes it there.Related Issues
No linked issue — opt-in rotation budget for the Responses headers wait has no open tracker; #13484 (Responses first-byte stall rotation, merged) covers the post-headers phase, not the headers wait.
Validation
npm run lint— ESLint on the touched files is clean (open-sse/executors/opencode.ts,opencodeHeadersWait.ts,runtimeTimeouts.ts, rotation test); the full run is red on the base (🔴 Release branch not green: release/v3.8.51 #14547)rev-list HEAD..upstream/release/v3.8.51= 0 @3a82bbe0)Tests Added Or Updated
tests/unit/opencode-headers-wait-rotation.test.ts— 17 cases (getters, window policy incl.chat/completionsuntouched, race ok/expired/aborted, budget/last-account, abort without rotation, no-op off-by-default, seam rotation on delayed headers).Coverage Notes
N/A —
open-sse/change covered by the new suite (17/17) plus neighbors: stall 14/14, egress-throttle 22/22, park-resume 8/8, transient-rotation 11/11, retry-delay 11/11, failure-predicate 6/6, chatcore-timeouts 7/7, body-read 6/6, body-integration 8/8.Reviewer Notes
open-sse/executors/opencode.ts1301 → 1338 (irreducible seam: policy-once-per-request call plus headers-wait dispatch branch; bulk logic in newopen-sse/executors/opencodeHeadersWait.ts, 210 lines under cap); the abort path releases the pacing slot viathrowPacedError.chat/completionsand non-streamed calls never take the window (4 asserts); abort never rotates; the last account keeps the full ceiling.upstream/release/v3.8.51@7d23bcf8on top of the owner commits (3a82bbe0, no reset); single conflict inconfig/quality/file-size-baseline.jsonresolved by keeping both rebaseline keys; seam suite 17/17 locally after the merge.API Route Typecheck4 ✗ (auggie.tsTS2769/TS18047,projectCombo.tsTS2459/TS2724),open-sse-typecheck2 ✗ (sameauggie.ts) + 1 ✗chatCore.tsTS2304 from base feat(providers): correlate X-CPA-TRACE-ID auth_index with usage history #14544 (readCpaAuthIndex(providerResponse),diff $mbempty),dashboard-typecheck1 ✗ (intelligentRouting.tsTS2698,diff $mbempty);Docs Gatesmigrations drift fixed by docs: migration count 178 -> 181 in README, AGENTS.md and llm.txt #14559 (soft drifts only);env-doc-sync(DEEP_HEALTH_CHECK_ENABLED) andmutation --strict(8 missingtap.testFiles) identical on the bare base.Maintainer rework (merge-batch 2026-09-24)
release/v3.8.51(@d124bb78) into the branch with a real merge commit (08b5b1bb); no conflicts, your commit is untouched.config/quality/file-size-baseline.json(85341381): the tip had shrunkopen-sse/executors/opencode.tsto 1301 lines (gate count) under the old 1318 ceiling, so this PR's +37 seam lands at 1338, not 1355. The frozen ceiling is now the measured 1338 and the annotation carries the real numbers. I also restored the original position of the two neighbouring_rebaseline_2026_09_22_*keys that the branch had moved to the end of the file (a merge artifact, no content change).opencode.ts(keeping yourruntimeTimeouts.ts/opencodeHeadersWait.ts),opencode-headers-wait-rotationis 15/17 — the two executor-seam cases (rotates past a queued Responses dispatch to a healthy account,a client abort during the bound window never rotates) fail; with this branch it is 17/17.opencode-executor→omits accept header when stream is falseandopencode-transient-rotation→executor rotation lines carry correlationId.typecheck:core(only the known inheritedcliproxyAccountHealth.tsTS2322),check:open-sse-typecheck(only the known inheritedauggie.tsTS18047), eslint with the frozen suppressions on the touched files,check:file-sizemeasured after the commit — green.check:env-doc-synchas one inherited miss (DEEP_HEALTH_CHECK_ENABLED, absent from the tip's.env.example); your two new vars are documented in both files.