Repository navigation
fix(provider-pi): start a fresh session when clearing context - #3677
Merged
SawyerHood merged 1 commit intoSep 15, 2026
Merged
Conversation
SawyerHood
force-pushed
the
fix/plugin-launch-context-remediation
branch
from
September 15, 2026 00:02
fb2019c to
848d9b0
Compare
samantha-clanker Bot
pushed a commit
to samanthar0se/bb
that referenced
this pull request
Sep 19, 2026
Where upstream solved the same problem, take its version: - thread plugin metadata base (get-bb#3555) - provider-pi fresh session on thread start (get-bb#3677); take upstream's provider-pi files wholesale - keep upstream's optional-field allowlist groups; fold experimental_pluginMetadataByPlugin into the plugin metadata group Keep local composer APIs that upstream does not provide (experimental_selectedProviderId, draft plugin metadata, provider-owned metadata), alongside upstream's pluginSubmission, lifecycleOwnerThreadId, setSelection, removeMention and onSubmitted. Update test fixtures for upstream's triggers and mentionMenuPlacement props. Co-Authored-By: Claude Opus 5 <[email protected]>
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
Provider-pi used the BB thread ID as the durable Pi session handle on every
thread/start. After releasing a session to clear context, starting the same BB thread selected its previous session file instead of an empty context. The BB routing ID and the provider session handle serve different purposes. See #3673 for the reproduction and investigation.What changed
thread/startnow allocates a freshpi_<UUID>handle with Node'srandomUUID(). The BB thread ID stays unchanged. Production changes are limited to the import and the provider-handle argument passed to session construction.Resume still opens the supplied handle, including older BB-ID-shaped handles. Rebuild, fork, and discard behavior remain unchanged. No wire fields changed, so no
HOST_DAEMON_PROTOCOL_VERSIONbump is needed. There are no core, SDK, database, CLI, or documentation changes.The tests cover same-thread release/start with a fresh empty session, release/resume with persisted context and replacement configuration, and legacy-handle resume. Existing Pi tests now use returned provider handles instead of assuming they equal BB thread IDs.
How you verified
start_after_release_selects_fresh_pi_sessionfails with the old allocation because both starts returnthr_lc_start_fresh. With the fix, it verifies distinct safe handles, matching identity announcements on the same BB thread, an empty new context, and unchanged old session bytes.release_resume_preserves_pi_session_and_replaces_configurationverifies the supplied handle, session header, and persisted sentinel survive release/resume, while instructions and tools change and a subsequent fake-child turn succeeds.resume_legacy_pi_sessionverifies an old BB-ID-shaped handle remains resumable without file migration.SessionManager. Each seeded file is independently reopened to confirm the sentinel persisted.Ran the provider package checks through Turbo, with prerequisite tasks and cache bypass:
Typecheck passed. Tests passed across 26 files: 157 passed, 1 skipped.
git diff --checkpassed. The subsequent squash preserved the exact file tree. Scope review confirmed the final diff contains only eight provider-pi files, and the human Plannotator review requested no changes.These checks use the production bridge with a fake Pi RPC child and real persisted-context reads. A live test against the exact fork commit also passed: on one BB thread using
openai-codex/gpt-5.6-luna, clearing context replaced the old Pi session identity with a new one. The new session's first user message did not contain the prior magic-number message, while the agent could still retrieve2534through preserved BB history withbb thread searchand answer correctly. This confirms context replacement while preserving durable BB history and tool retrieval. The full facets workflow was not tested. No paid inference was used.Fixes #3673