feat(watch): let a session's status survive the daemon that ran it - #39
Merged
Merged
Conversation
A fresh daemon starts with an empty session list and flushes it a second later, so sessions.json loses every row the previous one recorded. The dashboard then joins the worktrees against a registry holding only the session just started, and every other row reads `no session`. Eight sessions became one live row and seven blanks, with nothing left to say which had been mid-turn and which had finished. The sessions themselves cannot come back — the ptys are revoked with the daemon. The status can. Every hook already receives the worktree, the Claude Code session id and the permission mode, and already drops all of it when the socket is not there; it now writes that report to a small file of its own first, which the dashboard reads for any worktree with no live session. Reading Claude Code's transcripts would have covered more, including sessions that died before this shipped, at the cost of the dependency on its internals that the hooks exist to avoid. A recovered row carries no session id, so enter starts the work again with --resume instead of asking for a pty nothing holds. An interrupted turn reads waiting rather than active: it has no process left, and a turn in flight is a claim only a running one can make.
The sanity check CLAUDE.md prescribes is that the pass count moved when a source file is added; it is worth less when the number to compare against is two hundred tests stale.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
no session— eight sessions became one live row and seven blanks. Hooks now persist what they report to a per-session file, and the dashboard reads it for any worktree with no live session.Row.attachablefalse so enter restarts the work with--resumeinstead of asking for a pty nothing holds. An interrupted turn readswaiting, notactive..jsonlshape, which is what the hook-based statuses exist to avoid. Nothing here is retroactive.Verified with 289 unit tests (up from 269), a
ReleaseFastbuild, and an end-to-end hook run against an isolatedLCC_WATCH_DIRcovering the write, the plan-mode carry-forward across an event that reports no mode, and theSessionEndcleanup.