Conversation
…e id Session identity hashes the file path together with the header id, so a copy of a session .jsonl under the scan root (a backup, a manual copy) appeared as a second list entry for the same conversation (vastsa#1359). list() now dedupes by native header id and keeps the newest write, dropping stale duplicates from the records map so lookups cannot route to a dead copy. Stable ids are unchanged, so existing persisted references stay valid. Validated: native-pi-session tests 36/37; the single failure ("never deletes a foreign publication") reproduces on pristine main and is unrelated baseline noise. agent-runtime tsc clean apart from the same baseline.
yexisu
force-pushed
the
fix/dedupe-native-sessions
branch
from
October 4, 2026 03:16
c59d60c to
2b98434
Compare
Contributor
Author
Owner
|
Thanks for the native-session deduplication fix. The duplicate-file issue is real, and the implementation preserves path-derived ids while selecting the newest transcript without mutating files. The storage and E2E contracts were added in #1374, which has merged; closing the original as superseded. |
This branch was previously 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
Session identity is
stableId(path, header.id)— the file path participates in the hash.walkJsonl()collects every*.jsonlunder the scan root recursively, so a copy of a session file (a backup, a manual copy) under any subdirectory became a second list entry for the same conversation (#1359). The scan only excludes symlinks, not content copies.Fix
list()dedupes by the native header id after scanning: the newest write per native id wins, and stale duplicates are dropped from therecordsmap sodetail/search/prompt lookups cannot route to a dead copy.Stable ids are intentionally unchanged (path still participates in the hash), so every persisted reference to an existing session id stays valid — only the duplicate listing is removed. The dedupe is bounded to the scan result, adds no I/O, and keeps the newest copy's data (it wins by
updatedAt, which tracks the last entry timestamp).Validation
native-pi-session.test.ts36/37 (new regression: a backup copy under a subdirectory collapses onto the original's id; the one failure, "never deletes a foreign publication", reproduces on pristine main and is unrelated baseline noise)agent-runtimetsc --noEmitclean apart from the same pre-existing baseline (modelSystemtest fixtures)Fixes #1359