fix(migrate): reach .jsonl-only pass for already-routed upgraders#4260
Merged
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.
The early return bailed on the routed marker before the v3-jsonl pass marker was ever checked, so users whose events pass already completed never imported their .jsonl-only (ACP/desktop) sessions. Gate the return on both markers; Pass 1 stays idempotent via its dest checks. Also drop the unused copyFile that golangci-lint's unused linter would reject.
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.
Builds on @heshuimu's #4221, which imports legacy
.jsonl-only sessions (ACP / desktop / subagent — written directly in message format) alongside the.events.jsonlevent logs, flattens legacy nested-function tool calls, and recurses project subdirectories. Two follow-up fixes so it lands cleanly and actually reaches the affected users:migrateLegacySessionsreturned early on the routed marker before the newv3-jsonlmarker was ever checked. Users whose events pass had already completed in a prior version (the routed marker is already stamped) therefore never ran the.jsonl-only or subdirectory passes — exactly the population that reports missing history. The early return now requires both markers; Pass 1 stays idempotent via its per-session destination checks, so re-running it for already-imported sessions is a no-op. Added a regression test covering the existing-upgrader path.copyFile; golangci-lint'sunusedlinter (enabled in.golangci.yml) would have failed CI on it. All copy paths already go throughtransformAndCopyJsonl.All original #4221 tests plus the new ones pass; root and desktop modules build and vet clean.
Closes #4221