Repository navigation
fix(empty-completion): keep a discarded attempt's reasoning out of the retry's item - #7331
vadymhimself wants to merge 1 commit into
Conversation
…the retry's
The guard holds pre-content events across an empty-completion retry and
releases them with the retry's output. With nothing between the two attempts,
an unsigned reasoning delta from the retry is appended to the discarded
attempt's still-open reasoning item, so the client sees one reasoning item
whose text runs both attempts together ("discardedretry").
Each retry point now queues an assistant_boundary after the held events (only
when something is held), which the bridge and the direct encoders already
treat as "close the open items".
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request has been marked Ready for Review. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Intake/scoped review at The retry boundary separates retained reasoning from the discarded attempt from the next attempt's reasoning item across clean-empty, retryable-terminal and pre-content EOF paths. The newly added reasoning-item assertion is more meaningful than only checking event strings; retain usage merging and the no-post-output-replay controls. Current-head functional workflows are awaiting fork approval; that is pending execution, not a passing test result. No local suite was run for this branch in this intake. No workflow approval, new scan, live configuration change or merge was performed. Required review/readiness gates remain in force. |
Summary
"discardedretry"). A signed Anthropic block is unaffected only because its pending signature closes the item first.done, replay-safe pre-outputerror, pre-output EOF) now queues oneassistant_boundaryafter the held events, only when something is held. The bridge (bridge/sse.ts,bridge/response-json.ts) and the direct encoders (protocols/encoders/adapter-events.ts) already treat that event as "close the open items";isContentEventalready classifies it as non-content, so retry decisions are unchanged.src/server/responses/empty-completion-guard.tschanges (+5).Verification
the discarded attempt's reasoning stays out of the retry's reasoning itemintests/responses/empty-completion-guard.test.tsruns the guard throughbridgeToResponsesSSE. Before the src change: 1 fail (one reasoning item"discardedretry"instead of["discarded", "retry"]). Three existing event-sequence expectations in the same file now include the boundary; before the change they failed for exactly that missing event. After:bun test tests/responses/empty-completion-guard.test.ts tests/responses/empty-completion-hardening.test.ts tests/adapters/google/google-vertex-stream.test.ts-> 52 pass, 0 fail.bun x tsc --noEmit-> exit 0.bun scripts/file-size-ratchet.ts-> passed.bun run test:changed(Bun 1.4.3 viaOCX_TEST_RUNNER_BUN) -> 16140 pass, 34 skip, 5 fail across 656 files, on a heavily loaded machine (two of the failures ran for 139-140 s). Re-run alone,claude-desktop-first-party-guards,settings-stream-modeandserver-auth-scoped-quotapass (53 pass, 0 fail). The remaining failure,tests/cli/cli-connect-readiness.test.ts"a rejected preferred runtime falls back without rewriting the saved selection", also fails on an unmodifiedupstream/dev8640c2f checkout on this machine (local-environment dependent) and is unrelated to the guard.bun run testwas not run locally:test:changedalready covered the changed module's import graph; the remainder is left to CI.Checklist
Source: carried from the vadymhimself fork build (
empty-completion-guard.tshunk of commit 8fb1bbb), re-authored smaller: the fork's bounded-buffer fallback and its Anthropic-laneanthropic_server_block/anthropicServerToolUsechanges are not carried, and the boundary now also covers upstream's newer replay-safe error retry.🤖 Generated with Claude Code
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit