Repository navigation
Conversation
An isolated fork runs in a new directory, but the Claude bridge asked the Agent SDK to find the source session under that new directory, so every fork into a fresh worktree or personal workspace failed with "Session … not found in project directory for <new cwd>". Reuse forks, which the app uses, were unaffected. Codex was unaffected because its sessions are global. Omit the directory hint: the SDK then searches every project directory for the source session, and the forked session resumes in the new cwd as before. Verified on a dev server: a Claude thread forked isolated into a new personal workspace now answers from the source's context. Co-Authored-By: Claude Fable 5.1 <[email protected]>
ymichael
force-pushed
the
bb/simplify-thread-forking-reuse-or-a-new-environme-thr_2qre9f9jgc
branch
from
September 3, 2026 20:56
07da8b6 to
81680eb
Compare
ymichael
deleted the
bb/simplify-thread-forking-reuse-or-a-new-environme-thr_2qre9f9jgc
branch
September 3, 2026 21:02
ymichael
added a commit
that referenced
this pull request
Sep 3, 2026
## Human comments ## What was wrong [PR #3018](#3018) replaced the fork-specific workspace switch with normal environment selection, but the shared CLI environment builder recognized only `worktree`. The server and SDK still accepted fresh personal workspaces, so personal-project users lost the CLI path that the former isolated fork option provided. ## What changed - Accept `--new-environment personal` through the existing host-placement path, which makes forks use their derived source host. - Advertise and document both supported fresh environment choices in CLI help, the generated guide source, and the bundled bb-cli skill. - Add focused builder, fork-request, source-host, and help coverage while preserving default reuse, worktree/base-branch behavior, and the absence of a cross-host fork selector. - No server/daemon wire contract changed, so `HOST_DAEMON_PROTOCOL_VERSION` is unchanged. ## How you verified - The new focused assertions failed before the implementation and pass afterward: 40/40 tests across `spawn-helpers.test.ts` and `command-output/thread-fork.test.ts`. - `pnpm exec turbo run test --filter=@bb/templates -- --run test/templates.test.ts` — 7/7 passed. - `pnpm exec turbo run build typecheck --filter=@bb/cli --filter=@bb/templates` — 6/6 tasks passed. - `pnpm exec oxfmt --check ...` and `git diff --check` passed. Fixes #3018 > AGENT GENERATED
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
Thread forking exposed a fork-specific
workspacepolicy even though continuing a provider session already requires the child environment to live on the source thread's host. That split environment selection between fork-specific core logic and normal thread placement, allowed invalid cross-host requests to fail late, and caused Claude forks into a new directory to look for the source session under the new working directory.What changed
workspacefield with the create-styleenvironmentargument. Omitting it now reuses the source environment.bb thread forknow supports--environment,--new-environment worktree, and--base-branch;--workspacewas removed.@get-bb/plugin-sdkto0.4.42and refreshed the Plugin Guide API inventory for the changedthreads.forkdeclaration.--hostor--machine, because another host is never valid for a fork.HOST_DAEMON_PROTOCOL_VERSIONis unchanged.The user-visible default changes from creating an isolated environment to reusing the source environment. Explicit new worktrees use normal create placement and the project's default base branch unless
--base-branchis supplied.How you verified
Added regression coverage that failed before the implementation and passes after for default reuse, early cross-host rejection, SDK serialization, CLI environment flags, side-chat requests, and Claude forks across directories.
No linked issue.