Skip to content

fix(bin): refuse a Treehouse pool slot of another clone and pin Treehouse 3.1.2 - #7092

Open
robkerr1992 wants to merge 1 commit into
kunchenguid:mainfrom
robkerr1992:fm/fm-secondmate-shared-pool
Open

robkerr1992 wants to merge 1 commit into
kunchenguid:mainfrom
robkerr1992:fm/fm-secondmate-shared-pool

Conversation

@robkerr1992

Copy link
Copy Markdown

Intent

fix the pool bug

Context: on 2026-10-11 the main home seeded secondmate homes that clone projects the main home also clones (drew: bodl; fleet: wrinkle, orb, ergo, nandi; montana: montana). When the drew secondmate (home ~/.treehouse/firstmate-39d647/6/firstmate, clone projects/bodl there) ran bin/fm-spawn.sh for a bodl ship, Treehouse handed it slot /.treehouse/bodl-c434c4/1/bodl, which is a linked worktree of the MAIN home's clone (/projects/firstmate/projects/bodl), not of the secondmate's own clone, and the spawn refused at the Claude trust pre-registration. Nothing was changed. The ask is that a secondmate can spawn workers for a project that another home also clones.

upgrade treehouse
(This was the answer, on 2026-10-11, to the choice of fixing it by upgrading Treehouse from 2.1.1 to 3.1.2, whose pool reuses a slot only for the clone that owns it, with Firstmate refusing a slot of another clone with a message naming the Treehouse requirement, a regression test, and the CI Treehouse pin moved to 3.1.2.)

What Changed

  • bin/fm-spawn.sh now checks the slot that treehouse get hands out. If the slot sits in a managed Treehouse pool but belongs to a different clone of the same origin (for example, the root home's clone when a secondmate home is spawning), the spawn stops before it writes any trust or task state. The error names both git common dirs and the installed Treehouse version, and says to upgrade to Treehouse 3.0.0 or later. The check uses a new fm_treehouse_pool_layout helper in bin/fm-wake-lib.sh, split out from fm_treehouse_pool_slot.
  • bin/fm-install-treehouse.sh now pins Treehouse v3.1.2 instead of v2.0.1, with updated SHA256 checksums for each platform. From 3.0.0 on, Treehouse's pool reuses a slot only for the clone that owns it. docs/configuration.md notes that two homes cloning the same origin need Treehouse 3.0.0 or later.
  • tests/fm-spawn-worktree-settle.test.sh adds a setup with two clones that share one pool, and three tests:
    • a slot belonging to the other clone is refused;
    • the spawning clone's own slot is accepted;
    • the real treehouse binary gives the spawning clone its own slot.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change matches the intent. It pins Treehouse 3.1.2 in the CI installer and adds a refusal that names the Treehouse requirement. The refusal runs only for a slot that sits in a Treehouse pool but whose git common dir differs from the spawning clone's, before any claim, trust or metadata is written. Extracting fm_treehouse_pool_layout keeps fm_treehouse_pool_slot's behaviour for its existing teardown and spawn callers.

Testing

I ran the targeted spawn test file; all its cases passed, including the one that uses the real Treehouse 3.1.2. In a throwaway HOME I installed the pinned 3.1.2 (checksum verified) and the old 2.0.1. With two clones of one origin and real treehouse get, 2.0.1 gave the second clone the first clone's slot, which is the incident. 3.1.2 gave the second clone its own slot. I then ran fm-spawn on each slot real Treehouse handed out, with a fake tmux backend and agent CLI. On the 2.0.1 slot it refused with a message naming Treehouse 3.0.0 and wrote no meta, slot claim or Claude trust entry. On the 3.1.2 slot it launched, recorded and claimed the slot, for both claude and codex. The new regression test fails on the pre-fix code; there the codex spawn actually launched in the other clone's slot. Not covered live: a full lab primary on a real tmux socket driving a real agent. Spawn ran with a fake backend, but the Treehouse slot handout was real. There is no UI surface. I removed all temp dirs and the worktree is clean.

  • Live validation: ✅ go - 4 of 5 scenarios driven live against the product
Scenario Result Live Evidence
With Treehouse 3.1.2, a second home cloning the same origin gets a slot of its own clone after the first clone returned a slot ✅ pass live real-treehouse-v3-two-clones.log: mate-home get -> pool slot 2, whose git common dir is the mate clone
Secondmate spawns a ship worker for a project the main home also clones (Treehouse 3.1.2 slot, claude and codex harnesses) and it launches in its own clone's slot ✅ pass live fm-spawn-on-real-treehouse-slots.log v3 sections: exit 0, meta worktree= own slot, .fm-slot-owner claimed by mate home, Claude trust registered
Adversarial: under the old Treehouse 2.0.1, a spawn given another clone's pool slot is refused with a message naming the Treehouse 3.0.0 requirement and writes no state ✅ pass live fm-spawn-on-real-treehouse-slots.log v2 sections: 'belongs to another clone ... upgrade Treehouse to 3.0.0 or later (installed: v2.0.1)', exit 1, no meta, no slot claim, no trust store
Pinned installer fetches Treehouse 3.1.2, verifies its checksum and reports v3.1.2 ✅ pass live install-treehouse-3.1.2.log
The regression test fails on the pre-fix code and passes on the fix ⏸️ untested no The previous payload ran this only as an automated test with a fixture backend (regression-test-against-base-code.log, settle-test.log), not against the live product, so it did not establish a live re…
Evidence: Real Treehouse v2.0.1 hands the second clone another clone's slot (incident repro)

Source: Real Treehouse v2.0.1 hands the second clone another clone's slot (incident repro)

treehouse v2.0.1
main-home get -> $W/case2/home/.treehouse/bodl-4700af/1/bodl (common /private$W/case2/main-home/projects/bodl/.git)
main-home returned $W/case2/home/.treehouse/bodl-4700af/1/bodl
mate-home get -> $W/case2/home/.treehouse/bodl-4700af/1/bodl (common /private$W/case2/main-home/projects/bodl/.git)
mate clone common: /private$W/case2/mate-home/projects/bodl/.git
RESULT: mate got ANOTHER clone's slot (bug)
Evidence: Real Treehouse v3.1.2 hands the second clone its own slot

Source: Real Treehouse v3.1.2 hands the second clone its own slot

treehouse v3.1.2
main-home get -> $W/case3/home/.treehouse/bodl-3e2f5d/1/bodl (common /private$W/case3/main-home/projects/bodl/.git)
main-home returned $W/case3/home/.treehouse/bodl-3e2f5d/1/bodl
mate-home get -> $W/case3/home/.treehouse/bodl-3e2f5d/2/bodl (common /private$W/case3/mate-home/projects/bodl/.git)
mate clone common: /private$W/case3/mate-home/projects/bodl/.git
RESULT: mate got its OWN clone's slot
Evidence: fm-spawn refuses the v2.0.1 other-clone slot and launches in the v3.1.2 own-clone slot (claude and codex)

Source: fm-spawn refuses the v2.0.1 other-clone slot and launches in the v3.1.2 own-clone slot (claude and codex)

=== treehouse v2, harness claude
spawning clone: $W/case2/mate-home/projects/bodl; slot handed out by real treehouse v2.0.1: $W/case2/home/.treehouse/bodl-4700af/1/bodl
warning: $W/case2/mate-home/data/bodl-ship-claude-case2/launch-brief.md records no ship branch; defaulting to legacy branch fm/bodl-ship-claude-case2
warning: $W/case2/mate-home/data/bodl-ship-claude-case2/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
error: treehouse get handed out pool slot '$W/case2/home/.treehouse/bodl-4700af/1/bodl', which belongs to another clone (git common dir '/private$W/case2/main-home/projects/bodl/.git'), not the spawning clone '$W/case2/mate-home/projects/bodl' (git common dir '/private$W/case2/mate-home/projects/bodl/.git'); Treehouse before 3.0.0 shares one pool among clones of the same origin and reuses any free slot, so upgrade Treehouse to 3.0.0 or later (installed: v2.0.1); refusing to launch. Inspect target firstmate:fm-bodl-ship-claude-case2
fm-spawn exit=1
meta: none (no task state written)
slot owner file: 
claude trust store: not written
=== treehouse v2, harness codex
spawning clone: $W/case2/mate-home/projects/bodl; slot handed out by real treehouse v2.0.1: $W/case2/home/.treehouse/bodl-4700af/1/bodl
warning: $W/case2/mate-home/data/bodl-ship-codex-case2/launch-brief.md records no ship branch; defaulting to legacy branch fm/bodl-ship-codex-case2
warning: $W/case2/mate-home/data/bodl-ship-codex-case2/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
error: treehouse get handed out pool slot '$W/case2/home/.treehouse/bodl-4700af/1/bodl', which belongs to another clone (git common dir '/private$W/case2/main-home/projects/bodl/.git'), not the spawning clone '$W/case2/mate-home/projects/bodl' (git common dir '/private$W/case2/mate-home/projects/bodl/.git'); Treehouse before 3.0.0 shares one pool among clones of the same origin and reuses any free slot, so upgrade Treehouse to 3.0.0 or later (installed: v2.0.1); refusing to launch. Inspect target firstmate:fm-bodl-ship-codex-case2
fm-spawn exit=1
meta: none (no task state written)
slot owner file: 
claude trust store: not written
=== treehouse v3, harness claude
spawning clone: $W/case3/mate-home/projects/bodl; slot handed out by real treehouse v3.1.2: $W/case3/home/.treehouse/bodl-3e2f5d/2/bodl
warning: $W/case3/mate-home/data/bodl-ship-claude-case3/launch-brief.md records no ship branch; defaulting to legacy branch fm/bodl-ship-claude-case3
warning: $W/case3/mate-home/data/bodl-ship-claude-case3/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
spawned bodl-ship-claude-case3 harness=claude kind=ship mode=no-mistakes yolo=off window=firstmate:fm-bodl-ship-claude-case3 worktree=$W/case3/home/.treehouse/bodl-3e2f5d/2/bodl
fm-spawn exit=0
meta: worktree=$W/case3/home/.treehouse/bodl-3e2f5d/2/bodl project=$W/case3/mate-home/projects/bodl 
slot owner file: task=bodl-ship-claude-case3 home=$W/case3/mate-home 
claude trust store written: 1 entries for slot
=== treehouse v3, harness codex
spawning clone: $W/case3/mate-home/projects/bodl; slot handed out by real treehouse v3.1.2: $W/case3/home/.treehouse/bodl-3e2f5d/2/bodl
warning: $W/case3/mate-home/data/bodl-ship-codex-case3/launch-brief.md records no ship branch; defaulting to legacy branch fm/bodl-ship-codex-case3
warning: $W/case3/mate-home/data/bodl-ship-codex-case3/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
spawned bodl-ship-codex-case3 harness=codex kind=ship mode=no-mistakes yolo=off window=firstmate:fm-bodl-ship-codex-case3 worktree=$W/case3/home/.treehouse/bodl-3e2f5d/2/bodl
fm-spawn exit=0
meta: worktree=$W/case3/home/.treehouse/bodl-3e2f5d/2/bodl project=$W/case3/mate-home/projects/bodl 
slot owner file: task=bodl-ship-codex-case3 home=$W/case3/mate-home 
claude trust store written: 1 entries for slot
Evidence: Pinned installer fetches and verifies Treehouse 3.1.2

Source: Pinned installer fetches and verifies Treehouse 3.1.2

fm-install-treehouse.sh: downloading treehouse-v3.1.2-darwin-arm64.tar.gz from https://github.com/kunchenguid/treehouse/releases/download/v3.1.2/treehouse-v3.1.2-darwin-arm64.tar.gz
fm-install-treehouse.sh: installed treehouse v3.1.2 to /tmp/fm-th.UsWTxo/th3/treehouse
v3.1.2
v3.1.2
Evidence: New regression test fails against the pre-fix code

Source: New regression test fails against the pre-fix code

ok - a single transient stale pane_current_path read is not accepted as the worktree
ok - an already-settled pane confirms on the next read, not a whole extra cycle
not ok - spawn launched in a pool slot of another clone
Evidence: Targeted spawn test file output on the change

Source: Targeted spawn test file output on the change

ok - a single transient stale pane_current_path read is not accepted as the worktree
ok - an already-settled pane confirms on the next read, not a whole extra cycle
ok - a pool slot of another clone of the same origin is refused with its cause
ok - a pool slot of the spawning clone is recorded and claimed
ok - real treehouse v3.1.2 gives the second clone its own slot, and the spawn launches there
ok - a transient primary-checkout pane read is not accepted as the worktree
ok - a pane stuck on the primary checkout fails loudly at the deadline
# all fm-spawn-worktree-settle tests passed

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 5 scenarios driven live against the product
Scenario Result Live Evidence
With Treehouse 3.1.2, a second home cloning the same origin gets a slot of its own clone after the first clone returned a slot ✅ pass live real-treehouse-v3-two-clones.log: mate-home get -> pool slot 2, whose git common dir is the mate clone
Secondmate spawns a ship worker for a project the main home also clones (Treehouse 3.1.2 slot, claude and codex harnesses) and it launches in its own clone's slot ✅ pass live fm-spawn-on-real-treehouse-slots.log v3 sections: exit 0, meta worktree= own slot, .fm-slot-owner claimed by mate home, Claude trust registered
Adversarial: under the old Treehouse 2.0.1, a spawn given another clone's pool slot is refused with a message naming the Treehouse 3.0.0 requirement and writes no state ✅ pass live fm-spawn-on-real-treehouse-slots.log v2 sections: 'belongs to another clone ... upgrade Treehouse to 3.0.0 or later (installed: v2.0.1)', exit 1, no meta, no slot claim, no trust store
Pinned installer fetches Treehouse 3.1.2, verifies its checksum and reports v3.1.2 ✅ pass live install-treehouse-3.1.2.log
The regression test fails on the pre-fix code and passes on the fix ⏸️ untested no The previous payload ran this only as an automated test with a fixture backend (regression-test-against-base-code.log, settle-test.log), not against the live product, so it did not establish a live re…
  • bash tests/fm-spawn-worktree-settle.test.sh (new other-clone refusal, own-clone accept, and real-Treehouse v3.1.2 cases)
  • bin/fm-install-treehouse.sh <tmp>/th3: the pinned v3.1.2 darwin-arm64 checksum verified and the binary installed
  • fm-install-treehouse.sh from the base commit, run to install the old v2.0.1 into a temp dir for comparison
  • Real treehouse get --lease / return --force / get --lease across two clones of one origin with a throwaway HOME, under v2.0.1 and under v3.1.2
  • bin/fm-spawn.sh (fixture backend: fake tmux and agent CLI, throwaway FM_HOME/HOME) given each slot real Treehouse handed out, with the claude and codex harnesses
  • The new regression test file run against the pre-fix base-commit code from git archive e0d95ac7
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 1)
✅ **Push** - passed

✅ No issues found.

…ouse 3.1.2

Treehouse names a pool by repository name and origin, so a root home and a secondmate home that each clone one origin share a pool, and Treehouse before 3.0.0 hands out any free slot of it. A secondmate spawn for bodl was handed a linked worktree of the root home's clone and stopped at the trust pre-registration with no hint of the cause.

Treehouse 3.0.0 reuses a slot only for the clone that owns it. The spawn now refuses a pool slot whose git common dir is not the spawning clone's and names the Treehouse requirement, CI pins Treehouse 3.1.2, and the regression covers both the refusal and a real Treehouse 3 handing the second clone its own slot.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @robkerr1992 — nice diagnosis of the shared-pool slot.

My read (own verdict):

  • Contract-class: restore. A spawn is already specified to run in an isolated copy of the spawning home's project; Treehouse < 3.0.0 could hand it a slot of another home's clone, which then either refused later with an unrelated message or (codex) launched in the wrong repo. The new refusal fires only for a pool-layout slot whose git common dir differs, before any trust/claim/meta is written; fm_treehouse_pool_slot keeps its behavior for existing callers. The Treehouse pin bump is CI-only (bin/fm-install-treehouse.sh is used only by ci.yml).
  • VISION: strengthens a refusal path and keeps work in isolated copies (authority/delegation align); interface (refusal names the cause), mechanics (exact git-common-dir check), restart, vendor (session managers untouched), scope all align.
  • Security: I checked all four pinned SHA256s against the official kunchenguid/treehouse v3.1.2 checksums.txt — they match. No workflow, secret, or exfil surface. I approved the first-time fork CI runs (Require no-mistakes 38183630468, CI 38183630495).
  • Live validation: go (4/5; the untested row is the fixture regression test itself). Attestation matches head 5ed903a.

Status: waiting on CI only. If CI (including the Herdr lane on Treehouse 3.1.2) and no-mistakes come back green and it stays mergeable, I'll squash-merge on the next pass.

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.

2 participants