Repository navigation
fix(pi): preserve conversations when switching directories - #4346
Merged
ymichael merged 1 commit intoSep 25, 2026
Merged
Conversation
ymichael
deleted the
bb/investigate-and-fix-reported-github-issue-thr_y6cdgfzh4y
branch
September 25, 2026 16:39
2 tasks 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.
Human comments
What was wrong
After
update_environment_directorymoved a thread from A to B, Pi RPC resumed the saved session with A's directory. Commands continued in A while it existed; after deletion, Pi refused to start. Updating BB's environment alone did not update Pi's saved session location. The original pending-tool defect in #3187 was fixed separately; this closes the remaining durable-directory failure.What changed
On a directory mismatch, use the existing Pi RPC fork helper, which calls Pi's supported
SessionManager.forkFrom()SDK API. Resume the resulting session in B and publish its new provider identity for the same BB thread. The source session is retained, conversation entries are copied by Pi, equivalent paths do not fork, and failed construction removes the unsuccessful destination. There is no hand-written JSONL mutation. The SDK cwd override is not exposed by Pi's RPC/startup interface, so this uses the SDK operation already supported by our RPC extension.No public Plugin API, CLI, or server/daemon wire changes. No protocol bump. Underlying Pi session identity changes once per directory relocation; subsequent resumes retain it.
How you verified
fda15b5f293ec3488e1c926f34f3871c4cb0f03e, launched withpnpm start:worktree; real installed Pi 0.87.1 in RPC mode withopenai-codex/gpt-6-sol. Started in A, executedpwd, remembered a conversation-only phrase, invoked the realupdate_environment_directorytool, then continued through the UI in the same BB thread. The tool returned in 41 ms, next-turnpwdwas B, and the phrase was recalled. Released the runtime, removed A, and resumed:pwdremained B and continuity was preserved. The provider ID changed on relocation and stayed stable afterward.pnpm exec turbo run test typecheck lint --filter=bb-plugin-provider-pi: 173 tests in 28 files passed; typecheck and lint passed.pwdand missing-directory startup failure. Browser screenshot, transcript, event timings, and build provenance are retained in the originating BB thread storage, not committed.Fixes #3187