-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Heartbeat turns silently drop claude-cli session bindings — CLI context lost after every heartbeat (regression in 0314819f918) #98895
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.no-staleExclude from stale automationExclude from stale automation
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.no-staleExclude from stale automationExclude from stale automation
Type
Fields
Priority
None yet
What happened
Heartbeat turns silently drop claude-cli session-binding updates, losing CLI-side conversation context and orphaning forked sessions under
~/.claude/projects.src/auto-reply/reply/session-usage.ts:148-151computespreserveSessionModelState = params.isHeartbeat === true || ...and both persist blocks (:237-239,:288-290) skipapplyCliSessionIdToSessionPatchentirely when it is set — discarding bothcliSessionBindingandclearCliSessionBindingproduced by the run.Claude CLI print-mode
--resumemints a new session id every turn (this is whybuildCliRunResultrewrites the binding each turn, and why theisCliBindingFlushedprobe exists — see 07c1245). A heartbeat therefore resumes session id_N, advances the conversation into new id_H, and the stored binding stays at id_N. The next user turn resumes the pre-heartbeat session: everything the agent did or learned during heartbeat turns is silently absent from CLI context, and every heartbeat leaves an orphaned forked session on disk.Provenance
model/modelProviderfor heartbeats and kept the binding write.preserveUserFacingRunState(internal handoffs only).preserveSessionModelState, capturing heartbeats andpreserveRuntimeModelruns. Regression.Expected behavior
Heartbeats preserve model-display fields only; the CLI session binding (and binding clears) from the run must still persist.