Repository navigation
fix(sessions): respect project cwd in readiness checks - #1652
Conversation
|
No findings in the specified diff.
Review was read-only; no PR code was run, built, or installed. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Approving at d7df97c4. listPlatform now passes the requested cwd to isReady, so a Pi project whose .pi/settings.json sets sessionDir is listed when the global Pi store is missing and the project is not the current directory, instead of failing with tool_unavailable. The other isReady() calls without a cwd (copy in agent-session.ts, the archive restore in archive.ts) are write paths, and Pi refuses writes, so they do not hit this case. The new AgentSession.list test fails without the change, and the description carries a built-CLI session push --cwd <project> run that archives the session.
Session listing passes the requested project `cwd` to the adapter's readiness check, so a Pi project whose `.pi/settings.json` sets `sessionDir` is listed when the global Pi store is missing and the project is not the current directory, instead of failing with `tool_unavailable`. Related to Tencent#1418
Summary
cwdinto adapter readiness checks during session listing.pi/settings.jsonsessionDireven when the global store is absent and the requested project is notprocess.cwd()tool_unavailablefailureThis is the focused follow-up noted on #1418 after #1586. It does not change the remaining adapter scope of that issue.
Why
listInstalledPlatforms(toolRoots, cwd)already checked readiness against the requested project, butlistPlatformperformed a second readiness check without thatcwd.PiAdapter.isReady()then fell back toprocess.cwd(), so an explicitly requested project-only Pi store could be rejected beforelistConversations(cwd)ran.Testing
Regression proof before the fix:
After the fix:
npx vitest run src/__tests__/agent-session-list.test.ts --maxWorkers=1— 19 passed, 1 skippednpm run typecheck— passednpm run build— passedgit diff --check— passedReal CLI verification with a missing global Pi store, a project outside the CLI cwd, project-level
sessionDir, a local archive repo, and a local bare remote:The repository-wide
npm run lintcompleted oxlint but the documentation phase reports generated/default-workflow documentation already stale on the base revision; this PR does not change commands, descriptors, workflows, or docs.