Repository navigation
fix(session): find Pi sessions through workspace symlinks - #1798
Conversation
|
No findings in the scoped PR diff. The description satisfies the testing requirement: it records build, lint, typecheck, regression tests, and real-CLI migration verification for both Pi and OMP in both junction/path directions, including reuse and transcript checks. Review was read-only; I did not run, build, or install PR code. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Approving at 99fb277.
I reproduced the bug on main (a03ca33) with a built CLI. With the workspace reached through a symbolic link, from either side (the path in the session header or the one passed in), every Pi and Oh My Pi lookup returned not_found. At this head all six combinations succeed, and a second run reports reused: true. The controls behave the same on both builds, and a different workspace is still excluded (exit 1). I also ran it with TMPDIR set to a symlinked directory. resolveRealCwd is the helper the other adapters already use, so Pi now compares paths the same way they do.
Hidden scope: none. Any pair of paths that matched before still matches. The guide sentence on both pages describes the fix.
[P3 nit] agent-session-list.test.ts is not in src/__tests__/helpers/windows-tests.ts, so the Windows CI job does not run the new junction case. Adding it there would let CI back the Windows claim, which today rests on your own run.
The CI review found nothing, and I agree.
Summary
Pi and Oh My Pi session lookup compares
path.resolve()results for the requested workspace and the JSONL header'scwd. A symbolic link or Windows directory junction gives the same workspace two absolute spellings, sosession migrate <id> -s pi -t claude-code --cwd <link> --jsonfails withnot_foundeven though the session exists. The reverse direction fails too, when the header records the link and the command uses the real path.resolveRealCwdhelper for both sides of the Pi-family workspace comparison.AgentSession.listand id-basedAgentSession.find, for both platforms and both path directions, including a different workspace that must stay excluded.Type of Change
Test Plan
Windows, Node.js 24.19.0, upstream baseline
a03ca33d8a02304cc22be8425cc1854d4686716c.npm run typecheckpassed.npm run lintpassed, including documentation checks.npm run buildpassed.npx vitest run src/__tests__/agent-session-list.test.ts src/__tests__/pi-session-adapter.test.ts --maxWorkers=2passed with 34 tests passed and 1 platform skip. Before the runtime fix, the two new Pi/OMP cases both failed because listing returned[].git diff --checkpassed.Real CLI verification
Built both the clean upstream baseline and this branch. An external fixture script created an isolated temporary home, a real workspace, a Windows junction to that workspace, and synthetic native v3 JSONL logs containing a user message, a tool call and its result. The target Claude Code store was also isolated in that temporary home.
For each of
piandomp, the script ran the following real command once with a real-path header and a junction--cwd, then with a junction header and a real-path--cwd.All four combinations on the clean baseline exited 1 with
error.code = not_found. All four on this branch exited 0 and migrated the session. A second invocation of each returnedreused = truewith the same target session id. The written Claude Code transcript contained the source user message, tool call id and tool result.Expanded regression check
npx vitest run src/__tests__/agent-session-copy.test.ts src/__tests__/agent-session-find.test.ts --maxWorkers=2 --reporter=jsongave 124 passed, 20 failed and 3 skipped on both this branch and a separate clean baseline worktree. The failed test-name sets were identical. All 20 failures concern Cursor/WorkBuddy copy expectations on Windows, where the existing platform gate returnsno_adapter. The find suite passed. The full suite is left to CI as CONTRIBUTING requests for this scope of change.Related Issues
Found during source inspection. Searches across open and merged PRs and issues for Pi workspace, cwd, symlink and realpath fixes found no matching fix. The current open tool-package and connected-driver PRs do not modify these files.
Notes for Reviewers
The existing helper retains its fallback to an absolute path when a directory no longer exists. Verification used synthetic Pi-family logs and the built TeamAI CLI. Native Pi/OMP client verification is pending.
Codex assisted issue discovery, implementation, validation and this PR description.