Files
Codeman/.changeset/fix-claude-viewer-session-pin.md
T
shenlvkang-collab ab7a703e90 fix(web): keep the viewer's conversation anchor across a Codeman restart
start() reassigns _claudeSessionId to `resumeSessionId || id` on every launch,
including the path that re-attaches to a mux session that outlived the restart.
A pane whose CLI had moved on via /clear therefore came back pointing the
response viewer at its pre-/clear transcript, and because Session.lastSubmitAt
lived only in memory, the history correlation had nothing to correct it with
until the user happened to type again — observed as hours of the eye showing a
conversation the pane had long since left.

Persist lastSubmitAt in SessionState, restore it in restoreMuxSessions(), and
flush it when the viewer adopts (a /clear emits no completion event, which is
the trigger that would otherwise have persisted it). Recovered panes now
re-derive their live conversation on the viewer's first poll.

Restoring a stale anchor is safe: the resolver already refuses a candidate
transcript older than the one the pane is currently on, which is the shape of a
respawn into a fresh conversation.
2026-08-03 21:22:33 +08:00

1.2 KiB

aicodeman
aicodeman
patch

fix(web): stop the Claude response viewer from following another session's conversation

The viewer re-derived a pane's live conversation by taking the newest ~/.claude/history.jsonl entry for the pane's cwd. A cwd is shared with every other Codeman tab on it, with tabs long since closed, and with any plain claude run in the user's own terminal, so the eye followed whichever of those was typed into last — and the adoption was written back to the session, so the mispin persisted. Entries are now credited to a pane only when they land within 10s of that pane's own Enter and no other pane on the cwd submitted closer, the same last-submit correlation the Codex locator already uses.

That correlation also has to survive a restart. start() resets claudeSessionId to the launch id even when re-attaching to a mux session whose CLI has since moved on via /clear, so a recovered pane pointed the viewer at its pre-/clear transcript — and with the anchor itself living only in memory, nothing corrected it until the user happened to type again. lastSubmitAt is now persisted in SessionState and restored on boot recovery, so the viewer re-derives the live conversation on its first poll.