Repository navigation
Honor machine selection for personal child environments - #5207
Merged
Merged
Conversation
3 tasks done
ymichael
added a commit
that referenced
this pull request
Nov 9, 2026
## Human comments ## What was wrong A Personal thread that moved into an attached folder with `update_environment_directory` could not spawn Personal children: every variant returned `409 Personal project threads must reuse a personal workspace` (#7256). The cause is a reuse rule from c35a710 (May 27) that let Personal threads share only bb-created personal workspaces. It was written before threads could move (79f409a, June 24); moving made "a Personal thread in an attached folder" a normal state, but the rule was never revisited. Forks hit the same 409 and got a fork-only exception in #1212 (`allowUnmanagedPersonalProjectReuseEnvironmentId`); children of moved parents hit it now. The rule's other half, "standard project threads cannot reuse personal workspaces", has been unreachable since #3227: personal workspaces always belong to the Personal project, so the earlier "Environment belongs to a different project" check rejects that case first. ## What changed - Delete the reuse rule (`assertReuseWorkspaceProjectCompatibility`) and the fork-only exception plumbing in `thread-request-eligibility.ts`, `thread-environment-placement.ts` and `thread-create.ts`. - Children of a moved Personal parent now share the parent's folder, the same way forks already did. A parent still in its personal workspace keeps sharing it as before, and `--machine` on another host still gets a fresh workspace (#5207). - Deviation from the issue's proposed fix and this PR's first commit: instead of falling back to a fresh, empty personal workspace when the parent has moved, the child follows the parent. That keeps children and forks consistent and removes an exception rather than adding one. It also makes `--environment <parent env id>` work. The first commit's guard is reverted. - Still blocked: starting a new Personal thread at an arbitrary path (`--environment <path>`, a separate 400 check), and a standard project thread sharing a personal workspace (different-project check, now covered by a test). - No wire, schema, CLI or doc changes. ## How you verified - Tests: - The three `environment-providers.test.ts` cases now expect the child to share the attached parent's environment. They fail on main with the 409. - A new case asserts that a standard project thread reusing a personal workspace still gets 409 "Environment belongs to a different project". - The fork test that asserted the exception's narrowness is removed along with the exception. - `pnpm exec turbo run test --filter=@bb/server -- test/threads test/public`: 117 files, 1275 tests pass. `turbo run typecheck --filter=@bb/server` passes; oxlint and prettier are clean on the changed files. - Live, on a `pnpm start:worktree` server, a claude-code Personal thread moved itself to `/tmp/bb7258-scratch`: | From the moved parent | main | this PR | |---|---|---| | child, no env flag | 409 | shares `/tmp/bb7258-scratch` | | child, `--new-environment personal` | 409 | shares `/tmp/bb7258-scratch` | | child, `--environment-provider personal-workspace` | 409 | shares `/tmp/bb7258-scratch` | | child, `--environment <parent env id>` | 409 | shares `/tmp/bb7258-scratch` | | fork (no flags / `--environment <parent env id>`) | shares | shares `/tmp/bb7258-scratch` | | fork `--new-environment personal` | fresh workspace | fresh workspace | A running child and a running fork each replied `/private/tmp/bb7258-scratch` to `pwd`. Fixes #7256 > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- slopcop:rule=new-issue-autopilot run=run_wgn1lcuqmw71ng1k sha=issue-7256 kind=summary --> --------- Co-authored-by: SawyerHood <[email protected]> Co-authored-by: Michael Yong <[email protected]> Co-authored-by: Claude Opus 5.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.
🚨 SLOP COP 🚨 ·
new-issue-autopilotHuman comments
What was wrong
The Personal-project child policy replaced personal workspace requests with the parent's environment before checking the selected machine. A different existing host or a new-machine selection was silently discarded. The verified reproduction report records failures on trusted main in two clean checkouts.
What changed
How you verified
f135a001e72942cee9118d2693208ec0725e2f18, the test-only regression fails in both clean checkouts: 3 failed, 40 passed, for the two different-host forms and the new-machine form.pnpm exec turbo run test --filter=@bb/server -- test/threads/thread-default-policy.test.ts test/threads/environment-providers.test.ts test/threads/thread-create-seed-without-run.test.ts test/threads/thread-create-shared-workspace-path.test.ts test/public/machine-environment.test.ts.pnpm exec turbo run typecheck --filter=@bb/serverpasses.git diff --checkpass;git diff --numstat origin/mainconfirms the line count and no binary changes.Fixes #5204