Skip to content

Honor machine selection for personal child environments - #5207

Merged
SawyerHood merged 1 commit into
mainfrom
slopcop/issue-5204
Oct 9, 2026
Merged

SawyerHood merged 1 commit into
mainfrom
slopcop/issue-5204

Conversation

@bb-slop-cop

@bb-slop-cop bb-slop-cop Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · new-issue-autopilot

Human 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

  • Reuse the parent's personal environment only when machine selection is omitted or selects the parent's existing host.
  • Preserve different-host and new-machine requests for the existing environment placement implementation.
  • Extend the existing policy test table with a real stored parent environment and matching-host, different-host, omitted-machine, and new-machine cases.
  • Two files in the existing server thread-policy subsystem; 95 changed text lines (87 additions, 8 deletions). No dependencies, generated files, data changes, public contracts, wire fields, or CLI flags change.

How you verified

  • On unchanged production code at 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.
  • After the fix: 137 tests pass across five relevant suites with 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/server passes.
  • The configured formatter check and git diff --check pass; git diff --numstat origin/main confirms the line count and no binary changes.

Fixes #5204

AGENT GENERATED

@SawyerHood
SawyerHood merged commit 5fa79cd into main Oct 9, 2026
28 checks passed
@SawyerHood
SawyerHood deleted the slopcop/issue-5204 branch October 9, 2026 16:15
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

thread spawn --parent-self ignores --machine for Personal-project children and reuses the parent's environment

1 participant