fix(sse): give extended-thinking targets the reasoning readiness budget - #11959
Conversation
kiro/claude-sonnet-5-thinking 504s with "Stream produced no non-ping SSE event within 125000ms" — the 80s base plus the 45s large-history bump, capped there because nothing recognised the request as a reasoning target. The readiness policy already grants a 30s warm-up allowance to codex high-effort models and to claude-format replicas, but it keys the latter on the provider registry's format field. Kiro serves Anthropic thinking models through its own CodeWhisperer translator, so format: "kiro" excludes it, and the -thinking alias was never a reasoning signal the way -high is. Devin, antigravity and chatgpt-web publish -thinking ids from outside claude format too, so they had the same gap. Detect the -thinking alias suffix directly and apply the same 30s allowance, exclusive with the two existing reasoning bumps so a single request cannot stack them into a multi-minute readiness window. Closes diegosouzapw#11922
|
CI note, so nobody has to dig: the three red checks here are all base-branch state, not this change. No new ESLint warnings — I ran the job's exact command on both refs. Identical on this branch — same exit code, same message, byte-identical output apart from a Build (advisory) and dast-smoke are the hosted-runner OOM in #11946. All 4 unit-test shards, Vitest, semgrep, docs gates and merge integrity are green, which is the part this PR actually touches. |
Bring in diegosouzapw#11940/diegosouzapw#11955 ESLint suppressions re-freeze and later release/v3.8.51 commits so inherited stale-suppression reds can clear without widening the repo baseline. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Babysit summary (#11959)Verdict: green for required checks. Not merging (human merge). Contributor credit preserved: original commit Before (head
|
4c8074b
into
diegosouzapw:release/v3.8.51
…et (diegosouzapw#11959) Dá aos alvos de extended-thinking o orçamento de prontidão de reasoning, com cobertura de teste ampliada em `stream-readiness-policy.test.ts`. Validado no worktree combinado. Obrigado!
Summary
kiro/claude-sonnet-5-thinkingfails with[504] Stream produced no non-ping SSE event within 125000mswhen the upstream stays ping-only through a long reasoning turn.125000 is not a hardcoded Kiro timeout — it is
STREAM_READINESS_TIMEOUT_MS(80s) plus the 45s very-large-history/payload bump, capped there because nothing inresolveStreamReadinessTimeoutrecognised the request as a reasoning target.The policy already grants a 30s warm-up allowance to codex high-effort models and to Claude-format replicas, but it keys the latter on the provider registry's
formatfield. Kiro serves Anthropic thinking models through its own CodeWhisperer translator, soformat: "kiro"excludes it — and the-thinkingalias was never a reasoning signal the way-highis.devin,antigravityandchatgpt-webpublish-thinkingids from outside claude format too, so they had the same gap.This detects the
-thinkingalias suffix directly and applies the same 30s allowance, sokiro/claude-sonnet-5-thinkinggets 155s instead of 125s. The three reasoning bumps are mutually exclusive — they model the same one-off warm-up, so a single request cannot stack them into a multi-minute readiness window.Scoped to the alias suffix (
-thinking,-thinking-1m) rather than a substring, so an unrelated id that merely contains the word does not qualify.Related Issues
Validation
npm run lint— clean on both changed filesrelease/v3.8.51); focused checks rerun afterwardReproduced first: the new #11922 test failed at exactly
125000 !== 155000, matching the reporter's number before any fix was written.Focused suites, all green after the change:
npx tsc --noEmitreports the same 4782 pre-existing errors onrelease/v3.8.51with and without this change — it adds none.Each new guard was mutation-tested; every mutation killed exactly one test:
&& !extendedThinkingfrom the claude-format bump&& !codexHighReasoningfrom the thinking bumpto/thinking/`Tests Added Or Updated
tests/unit/stream-readiness-policy.test.ts— 5 added:claude-opus-4-6-thinking)claude_format_heavy_reasoningcodex_gpt_5_5_high_reasoningCoverage Notes
open-sse/utils/streamReadinessPolicy.tsis the only production file changed. Every added branch is covered by the tests above: the bump firing, both exclusivity guards, and the suffix-boundary rejection. Coverage does not move down in any touched file.Reviewer Notes
-thinkingrequest gets at most +30s of readiness budget, still clamped bymaxTimeoutMs, and nothing else in the request path changes.-thinkingas a reasoning signal for every provider. That is deliberate — the alias means the client asked for extended thinking regardless of who serves it — but if you would rather gate it to a provider allowlist, say so and I will narrow it.STREAM_READINESS_TIMEOUT_MS,STREAM_READINESS_MAX_TIMEOUT_MS) already exist and do govern this path; the reporter's real problem was the default being too low for thinking targets, not the absence of a knob. Happy to add the dashboard control as a follow-up if you want it.