fix(session): keep a session connected when a reload leaves out a noted file - #1131
Open
andrewloux wants to merge 1 commit into
Open
andrewloux wants to merge 1 commit into
andrewloux wants to merge 1 commit into
Conversation
|
@andrewloux is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
PR author is not in the allowed authors list. |
andrewloux
force-pushed
the
fix/reload-keeps-session
branch
2 times, most recently
from
October 1, 2026 15:40
6fc59cd to
844e1b1
Compare
andrewloux
force-pushed
the
fix/reload-keeps-session
branch
from
October 3, 2026 15:37
844e1b1 to
1e18b04
Compare
…ed file A `hunk session reload` whose new diff leaves out a file that holds a live note disconnected the session. The window's next snapshot carried `liveCommentCount: 1` beside an empty `liveComments` list: the count came from every live note in the review store, and the list came from the files in the current diff. The daemon's snapshot parser requires the two to match, so it rejected the snapshot and dropped the session. The TUI kept running, and no `hunk session` command could reach it. The count now comes from the published summaries, as `reviewNoteCount` already does. The note stays in the store and returns to both when a later reload brings its file back.
andrewloux
force-pushed
the
fix/reload-keeps-session
branch
from
October 5, 2026 15:36
1e18b04 to
34c220d
Compare
This branch has not been deployed
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.
Problem
reloading onto a diff that leaves out a file with a live note drops the session. with
hunk show HEADopen on a commit that changeslab.goandnotes.txt:the TUI keeps running, but no
hunk sessioncommand reaches it again. agents reload after each commit, so a commit that reverts a noted file cuts the agent off from a window that still looks alive. reproduces on 0.22.0 from Homebrew and onmain, and #1138 hits it through--watchandrtoo.Cause
after that reload the window sends
liveCommentCount: 1with an emptyliveComments:notes.txtnote, which the store keeps so it can come back with its file (feat(review): browser-review rebuild Phase 0 guardrails + review store (Phase 1 PR 1) #723)HUNK_DEBUG=1it logsrejected snapshot from session <id>: parseHunkSessionState returned null at stateApproach
liveCommentCountnow counts the published list, the wayreviewNoteCountcountsreviewNoteSummaries. the note stays in the store, so reloading back toshow HEADlists it onnotes.txt:2again.the counts
hunk sessionprints stay the same, because the daemon's parser already rejects any count that differs from the list and storesliveComments.length. this does undo #723's comment on that line ("notes on a file a reload retired still count as tracked"), since the published count now follows the published list.hunkCountandreviewNoteCountare built from the same source as their lists, soliveCommentCountwas the only count that could drift.non-goals: listing notes on retired files in
comment list, and recovering a window after the daemon rejects a snapshot.Why core
the terminal review hook builds the session snapshot, and every reload goes through it. the snapshot keeps its shape and only sends counts the v16 daemon already accepts, so
HUNK_SESSION_DAEMON_VERSIONstays at 16 andwire.snapshot.test.tspasses as is. the TUI renders the same diff before and after.Tests
useTerminalReview.test.tsx: a note onbeta.ts, a reload toalpha.tsalone, then a reload back to both. the count matches the summaries after each step, and the note returnstest/session/cli.test.ts: the same flow through the daemon. the reload away exits 0, the session stays listed, and the reload back lists the noteboth fail on
mainat0a67560cwithout the fix: the hook test gets count1beside an empty list, and the session test getshunk: The targeted session disconnected.test/sessionskips on macOS because BSDscripthas no-f, so i ran it in a Linux container.mainat0a67560cgives 4554 pass, 52 skip, 1 fail, and the one failure is the same jj test on both (#1146 fixes it). i didn't runtest:integrationortest:tty-smoke, since this touches no rendering, layout or PTY behavior.tested on macOS 26 arm64, plus Linux arm64 in Docker for
test/session. not run on Windows.Limitations
comment listleaves out its note, and a reply to it exits 1 withReview note <id> is no longer available as a reply parent.rejected registration from session <id>: the payload parses; the broker refused it for another reason. that recovery is follow-up workFixes #1138