Skip to content

fix(migrate): reach .jsonl-only pass for already-routed upgraders#4260

Merged
esengine merged 2 commits into
main-v2from
fix/4221-jsonl-existing-upgraders
Jun 13, 2026
Merged

fix(migrate): reach .jsonl-only pass for already-routed upgraders#4260
esengine merged 2 commits into
main-v2from
fix/4221-jsonl-existing-upgraders

Conversation

@esengine

Copy link
Copy Markdown
Owner

Builds on @heshuimu's #4221, which imports legacy .jsonl-only sessions (ACP / desktop / subagent — written directly in message format) alongside the .events.jsonl event 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:

  • Gating. migrateLegacySessions returned early on the routed marker before the new v3-jsonl marker 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.
  • Dead code. Removed the unused copyFile; golangci-lint's unused linter (enabled in .golangci.yml) would have failed CI on it. All copy paths already go through transformAndCopyJsonl.

All original #4221 tests plus the new ones pass; root and desktop modules build and vet clean.

Closes #4221

heshuimu and others added 2 commits June 12, 2026 15:47
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.
@esengine esengine requested a review from SivanCola as a code owner June 13, 2026 05:55
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) agent Core agent loop (internal/agent, internal/control) labels Jun 13, 2026
@esengine esengine merged commit 6e5afa5 into main-v2 Jun 13, 2026
14 checks passed
@esengine esengine deleted the fix/4221-jsonl-existing-upgraders branch June 13, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants