Skip to content

fix(sse): judge stalled buffered turns by raw stream content - #14679

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
maxmad64bis:fix/empty-turn-idle-verdict
Sep 24, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
maxmad64bis:fix/empty-turn-idle-verdict

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #14547 — release/v3.8.51 is red at the tip (open issue #14547); API Route Typecheck fails identically on this head and on the untouched merge-base (same 4 ✗ on auggie.ts/projectCombo.ts, both untouched by this PR — see Reviewer Notes). No red is attributed to this PR without a head-vs-base proof.

Summary

Judge stalled buffered turns by raw stream content: a turn that stalled before any usable output is retried through the existing empty-turn budget instead of being exposed and killed by the content watchdog ~80 s later. When a reasoning item is still open, bounded reading continues up to the stream readiness ceiling instead of concluding early.

Related Issues

Related to #14213

Validation

  • Change type: provider
  • Focused tests and category gates from the golden path
  • npm run lint — clean on the touched files (exit 0 with suppressions); the full run is red on the base (🔴 Release branch not green: release/v3.8.51 #14547)
  • Reconciled with the current active release base; focused checks rerun afterward — base release/v3.8.51 18bbb101980c639cfabdc5663213836d917c3269, tip 0398f272d3, rev-list HEAD..base = 0; file-size/eslint/unit neighbours green locally (see Reviewer Notes); CI ready-run: full suite executed, remaining reds are inherited base-red 🔴 Release branch not green: release/v3.8.51 #14547 (typecheck 4 ✗ outside the PR, identical at head and base, Docs DEEP_HEALTH_CHECK_ENABLED present on the untouched base, unit shards flaky — same-base sibling feat(opencode): bound Responses headers wait with opt-in rotation budget #14558: same failing job families)
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/idle-verdict-14213.test.ts (new, 9 tests: pure-mute, open reasoning, closed-without-content, real content, detector vectors, continuation, ceiling, compat).

Coverage Notes

  • open-sse/utils/emptyTurnRetry.ts is covered by the new test plus the neighbouring flush-empty-retry and flush-empty-retry-hook suites (29 green locally).

Reviewer Notes

  • No default changed: maxTotalMs = 0 keeps the historic behaviour for other callers; the ceiling defaults to the static stream-readiness max.
  • File-size baseline untouched; chatCore.ts untouched (git diff HEAD -- open-sse/handlers/chatCore.ts empty).
  • Typecheck red is inherited, not proper: the 4 ✗ (auggie.ts TS2769/TS18047, projectCombo.ts TS2459/TS2724) reproduce byte-identically on an ephemeral worktree at the merge-base 18bbb10198 (same files, git diff $mb empty on both); CI API Route Typecheck log cites no file from this PR.

A buffered turn that stalls while reasoning stays silent carries no raw
model output, yet the idle verdict passed it through as usable content.
The content watchdog then killed it ~80s later: a 502 the retry budget
never got a chance to prevent.

Judge idle reads with the same raw-content classifier as the watchdog
(hasUsefulStreamContent): no useful bytes, never a pass. While a
reasoning item is still open, keep draining under an absolute ceiling
(STREAM_READINESS_MAX_TIMEOUT_MS) instead of judging a working model.
Pass verdicts on stalled turns carry an idle marker for follow-up logging.
@diegosouzapw

Copy link
Copy Markdown
Owner

Clean, well-scoped follow-up on #14213. Confirmed #14681 and #14691 (both stacked on this one)
merge cleanly on top of it with no conflicts between them either — ran all three together with
the rest of the batch (73/73 tests green). Only requirement: land this one first since the
other two are literally built on top of its commit.

@diegosouzapw
diegosouzapw merged commit 56a38a9 into diegosouzapw:release/v3.8.51 Sep 24, 2026
17 of 25 checks passed
@maxmad64bis
maxmad64bis deleted the fix/empty-turn-idle-verdict branch September 24, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants