Repository navigation
Conversation
Harness-Claim: true Agent: switchboard-dev Host: ANCHOR Base-Ref: origin/main Base-SHA: abd011b Claimed-At: 2026-11-03T13:34:15.3826181Z Nonce: 7195b284bae36377
) An incremental refresh merged the cached row and kept its old messageCount, so a growing conversation showed the same count forever, even after a reload. Persist a small count index per transcript and count only the appended lines on an incremental refresh, falling back to a full read when the file was rewritten or the index does not match.
Remote mirrors grow by copy, append and rename, so a new inode made every fetch recount the whole transcript on the main thread. For remote folders, reuse the count cursor when the head and tail witnesses still match. Treat bridge rows as filtered, fall back to the header path when a full read fails, and share one stat in readSessionFile.
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.
Closes #1017.
During the v0.0.103 live retest, a session that grew kept showing its first message count ("2 msgs"), even after a full reload. An incremental refresh merged the cached row and never recounted.
How the fix works:
src/main/session-index/message-count.jskeeps a small per-transcript count index (bytes covered, count, file stamp). It is persisted in a newsession_cache.messageCountIndexcolumn.isCountedMessagerule as a full read.Tests:
test/session-cache-message-count-1017.test.jscovers parent and subagent transcripts, a large file, a partial tail, a rewrite, and the migration. It was red before the fix: expected 4, got 2.node:sqlitestore fixture, like the other store tests.Note: #865 also adds columns in
session-index-store.js. Whichever PR lands second will need a trivial merge there.