fix(migrate): import legacy .jsonl sessions alongside .events.jsonl#4221
Closed
heshuimu wants to merge 2 commits into
Closed
fix(migrate): import legacy .jsonl sessions alongside .events.jsonl#4221heshuimu wants to merge 2 commits into
heshuimu wants to merge 2 commits into
Conversation
The v0.x import only processed *.events.jsonl files, silently skipping .jsonl sessions that the TS version later wrote in native message format (ACP, desktop, subagent, and later-version chat sessions). - Pass 1 (events): prefer .jsonl sidecar when it's newer than the event log - Pass 2 (.jsonl-only): import message-format .jsonl files without events counterpart, with .jsonl.bak recovery. Subagent sessions are skipped. - Pass 3 (subdirectories): recurse into project-scoped subdirs - transformAndCopyJsonl: flatten legacy nested-function tool calls to the flat name/arguments format the Go version expects - Desktop: topic migration now handles both global and project session dirs, assigning correct scope. Runs for all tabs. - CLI: resolveCLISessionDir uses the project session dir when cwd maps to a project, so /resume shows project history. 9 new tests; all 13 original migration tests unchanged.
Owner
|
Thanks for this — the three-pass approach (events / I picked up two follow-ups in #4260 so it lands cleanly and reaches everyone it should:
#4260 builds on your commit with credit and closes this one. Nicely done. |
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.
The v0.x session migration only processed *.events.jsonl files. .jsonl-only sessions (ACP, desktop, subagent — later TS versions wrote directly in message format) were silently skipped.
Changes:
Tests: 9 new migration tests; all 13 original unchanged. Desktop + CLI tests pass.
Testing is also done against my own data from the legacy TypeScript version.
The only unavoidable defect of the current approach is that ACP-related legacy sessions have no workspace specified in its metadata, so they have to be lumped into the global session.
This aims to resolve #4156 which #3944 did not fully address.
This may have overlaps with #4215 as my change also migrates the subagent sessions of legacy version into the designated directory.