Repository navigation
[PR] fix(#5951): replay a stream cut that lands after reasoning-only output - #5956
ranxianglei merged 4 commits into
Conversation
…-only output A cut that lands inside the reasoning phase used to be a dead turn: the client held a thinking fragment, no answer and no tool call, and the pipe handed the host a truncation error instead of re-sending the request. retryZeroByteCut() is the only replay path for a cut stream and its zero-visible predicate rejects anything that already forwarded reasoning; the read-error branch never attempted a replay at all. Add retryReasoningOnlyCut(): a one-shot replay for a cut (EOF or read error) whose only client-visible output was reasoning. It shares the single stream-level re-issue budget with the ranxianglei#2171 zero-byte path and reuses the mid-turn framing so the retry's blocks land after the ones the client already saw. Answer text, tool calls, partial argument streams, released markup, a stripped echo or a forwarded content block still keep the ranxianglei#721 in-band signal. TruncationDiag gains readError so a cut that is not replayed names its cause instead of only its classification.
[bot] 🏷 (ai: opencode/qwen3.8-27b) Duplicate screening: not a duplicate — this is a deliberate narrow extension of the merged zero-byte-cut retry (#2171, shipped as PR #2173). Related-but-different threads exist but none share the mechanism: #2516 keeps unsigned thinking out of client history on re-fetch (different path, no interaction here), #4712/#4681 hold round≥2 signed thinking off the wire until its signature lands (KDD #10 territory). No other open PR targets #5951. Labels applied: CI (live, mirror cache, fetched 2026-11-08T13:15Z): 30 checks — 0 failed, 12 passed, 6 skipped (env-gated e2e lanes), 12 still running. Merge state reads "blocked" = required checks in progress, not a conflict (the PR is clean/mergeable). No failures so far; I'll follow up once the suite settles. 结构化八问
Non-blocking findings
VerdictSolid, well-scoped, well-tested change. The predicate, the shared single re-issue budget, and the Anthropic exclusion all check out against the surrounding state machine, and the 7 new tests have teeth (3 positive replays, 3 keep-the-signal negatives including budget-exhaustion, 1 diag). Mergeable pending green CI. Every finding above is non-blocking — none warrant holding the merge. |
[bot] 🏷 (ai: opencode/qwen3.8-27b) Following up on my review above (it stands in full). One addition on CI: I re-checked through an independent source after the suite kept running — still zero failures across every run of the head commit ( Verdict unchanged — mergeable pending green CI; the four findings remain non-blocking. I'll post the final green/red call once the suite actually settles (if red, I'll isolate the failing lane and check inherited-master-red vs. this PR's fault first). No other action taken: PR left open for owner merge, no issues opened, nothing pushed to your fork branch. |
|
Non-blocking findings should be fixed, conflicts should be resolved |
…nglei#5956 conflict resolution) Resolves the single src/plugin.ts conflict in the chat-pipe read-error catch block by keeping BOTH sides' intent: master's noteTruncatedUpstream(session, protocol, "read-error") session note AND the PR's buildTruncationDiag( "read-error", e) that names the failed read in the truncation diag.
…e its read error Non-blocking finding from conflict resolution: the ranxianglei#5951 change added the optional readError parameter to BOTH pipes' buildTruncationDiag definitions, but only the chat pipe's read-error call site was updated to pass the caught error. The responses pipe's definition gained the parameter and the conditional field, yet its call site never passed e, leaving the readError diag field dead in that lane. Pass e so a non-replayed responses cut names its cause, symmetric with the chat pipe.
(ai: vllm-qwen/qwen3.8-27b) Blocker + what I did this run (upstream PR #5956) The PR was Conflict resolution (exactly 1 conflict, Non-blocking finding fixed (per your note): the #5951 change added the optional Verification: typecheck green · #5951 regression test 7/7 · targeted truncation/diag/stream-error suite 63/63. New CI run on the pushed head: all gate checks already green (kernel-guard, version-guard, lock-sync, unused-exports, config-surface-guard, …), remaining test/e2e lanes queued, zero failures. Merge state is now
结构化八问(中文,供 reviewer 核查)
判定:冲突已解、非阻塞项已修、本地定向验证全绿,已推回 fork(head = |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1113-master.e2ff3a0 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…ocale translations, ranxianglei#5956 reasoning-replay after cut, ranxianglei#5957 non-stream anthropic proxy loop, ranxianglei#5958 degenerate retry error shape
Summary
A stream cut that lands inside the reasoning phase is currently a dead turn: the host has a thinking fragment, no answer, no tool call, and the pipe answers with a truncation error. Two paths lead there — a clean EOF and a read error — and neither re-issues the request.
chat pipe, cut detected if (!sawTerminal && …) { - if (await retryZeroByteCut()) continue; // requires nothing forwarded at all + if ((await retryZeroByteCut()) || (await retryReasoningOnlyCut())) continue; } try { step = await reader.read(); } - catch (e) { throw e; } // straight to the truncation signal + catch (e) { if (await retryReasoningOnlyCut(e)) continue; throw e; }retryReasoningOnlyCut()replays once when the only thing the client has seen is reasoning: no answer text, no tool call, no partial argument stream, no released markup, no stripped echo. It shares the single stream-level re-issue budget with the #2171 zero-byte path, so a second cut still surfaces the #721 signal instead of looping. Anything the host could merge badly keeps the old behaviour.TruncationDiaggainsreadError, so a cut that is not replayed names the socket error instead of onlyclassification: "no-terminal-seen".Evidence
Before: the reasoning-only cut reaches the host as:
After: that same shape is re-issued once and, if the retry answers, the host receives the answer and the reasoning together.
The 13 failures are pre-existing and environmental, not caused by this change: the nine affected files give
501 tests / 488 pass / 13 failboth with the patch stashed and applied (tests/test-suite-lock.test.tsCLI leak guard,opencode-v2,pi-native,opencode-native,issue5627,issue3304,launcher,issue3544,identity-harvest).Merge Danger
Door: two-way — the replay path is additive and gated by a predicate that only accepts reasoning-only cuts; reverting it restores the previous error behaviour with no state to migrate.
Blast Radius: narrow — one function plus one diag field, chat pipe only; the responses pipe (codex) keeps its behaviour because replaying item ids there needs its own review.
Closes #5951