fix(claude-cli): preserve reused session on empty response#99139
fix(claude-cli): preserve reused session on empty response#99139wyf027 wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 6:12 PM ET / 22:12 UTC. Summary PR surface: Source 0, Tests +42. Total +42 across 2 files. Reproducibility: yes. at source level. The cleanup path and generic empty-result classification are explicit on current main, and the linked issue supplies repeated runtime logs for the synthetic sequence; this read-only review did not execute the external Claude account scenario. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Carry a typed synthetic-placeholder outcome through the Claude CLI parser and result path, preserve the reused binding only for that observed state, retain generic empty-response invalidation, and prove with redacted live output that the later answer is delivered. Do we have a high-confidence way to reproduce the issue? Yes at source level. The cleanup path and generic empty-result classification are explicit on current main, and the linked issue supplies repeated runtime logs for the synthetic sequence; this read-only review did not execute the external Claude account scenario. Is this the best way to solve the issue? No. The patch exempts a generic failure reason used by unrelated empty-output states and does not prove that preserving the identifier recovers the later user-visible answer; typed classification is the safer boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2a479bd4ac85. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +42. Total +42 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (3 earlier review cycles)
|
…y-response-keeps-session-99131 # Conflicts: # src/agents/command/attempt-execution.cli.test.ts
What Problem This Solves
Fixes #99131.
A reused Claude CLI session can produce an empty-response failover when the CLI emits a synthetic no-response result before later transcript activity. The attempt layer currently treats every
FailoverErrorfrom a reused Claude CLI turn as a poisoned session and clears the stored CLI session binding, which turns the empty response into a destructive session discard.Why This Change Was Made
This keeps the existing cleanup behavior for aborts and hard failover reasons such as auth, billing, and rate limits, but stops clearing reused Claude CLI session IDs for
empty_response. That preserves the session binding for a later resume instead of orphaning the same transcript after a transient/synthetic empty result.User Impact
Claude CLI users who hit the synthetic empty-response path no longer lose the reusable session binding as a side effect of the failed turn, reducing the background-task/session discard cascade described in the issue.
Evidence
node scripts/run-vitest.mjs src/agents/command/attempt-execution.cli.test.ts -- -t "keeps reused Claude CLI session IDs after empty response failover"node scripts/run-vitest.mjs src/agents/command/attempt-execution.cli.test.tsgit diff --check