Skip to content

fix(bin): keep refused Treehouse pool copies leased until explicit release - #7716

Open
jjames27th-eng wants to merge 13 commits into
kunchenguid:mainfrom
jjames27th-eng:fm/fm-spawn-dirty-pool-reset
Open

jjames27th-eng wants to merge 13 commits into
kunchenguid:mainfrom
jjames27th-eng:fm/fm-spawn-dirty-pool-reset

Conversation

@jjames27th-eng

@jjames27th-eng jjames27th-eng commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Protect a pooled Treehouse worktree after bin/fm-spawn.sh refuses it as not clean.
Keep its durable lease after refusal and interactive shell exit so an empty response to Treehouse's normal-return prompt cannot discard the refused edit, and a retry uses a different copy.
Only a person's explicit release may make the refused copy reusable.
Require the treehouse lease capability (Treehouse v3.0.0 or newer) in bootstrap and spawn, raise the installer/CI pin from v2.0.1 to v3.1.5, and add a real-Treehouse lease regression.
Keep protecting every locally recorded pool copy under the project lock before either acquisition path runs, as the maintainer asked on 3 Nov: 'a paused task whose recorded copy is still clean at origin/main has no unlanded work, so treehouse get can hand that copy to a new spawn'; add a regression for a clean, unleased copy recorded by a paused task in another home.
Rebase the existing fix onto current main and validate with unmodified Treehouse v3.1.8 through the product on scratch infrastructure.
Show both unpatched and patched refusal, normal shell exit plus one empty Enter, and retry, recording HEAD, status and edit content before and after.
Publish the evidence and explain the scope in the existing #7716 through no-mistakes.

What Changed

  • bin/fm-spawn.sh now durably leases each pane-driven pool copy with treehouse lease before base refresh (T3 and Herdr already hold a lease from get --lease). A refusal or abort leaves the lease and edits in place, so a retry gets a different copy, and the refusal prints the explicit treehouse return --force release command. Polytoken abort cleanup and endpoint messages no longer promise that closing an endpoint returns the slot.
  • Under the project lock and before either acquisition path, spawn leases every unleased pool copy recorded by any local Firstmate home, including copies reached through a symlinked pool root. A task record it cannot read, match to treehouse status, or lease refuses the spawn, naming that record and copy.
  • bin/fm-bootstrap.sh reports OUTDATED and spawn refuses when treehouse lease is unavailable, and the installer/CI pin moves from v2.0.1 to v3.1.5. New tests/fm-treehouse-lease-e2e.test.sh exercises the real Treehouse executable; tests/fm-spawn-pool-base-freshen.test.sh adds dirty-retry and paused-copy-in-another-home regressions; fixtures, adjacent tests, and docs are updated to match.

🤖 Generated with Claude Code

Risk Assessment

⚠️ Medium: No defect survived the review and the protections fail closed, but the change alters every fresh Treehouse spawn, and any record that can't be protected now blocks spawns for that project until an operator acts.

Testing

I drove the real bin/fm-spawn.sh with real Git and unmodified Treehouse v3.1.8 and pinned v3.1.5, in disposable lab homes on a private tmux socket and in an isolated Herdr lab session. The paired runs show the unpatched base losing the edit and reusing the copy, while the patched code keeps the edit and lease and retries in another copy until an explicit release. Recorded-copy protection, the moved-root refusal, the old-Treehouse refusals, the v3.1.5 installer and all six changed test suites passed; two suites first failed for environment reasons and passed once those were corrected. Live T3 spawning could not be driven and is marked untested, and this is a CLI change with no visual surface, so the evidence is sanitized transcripts rather than screenshots.

  • Live validation: ✅ go - 11 of 12 scenarios driven live against the product
Scenario Result Live Evidence
Unpatched baseline: spawn refuses a copy edited by an outside writer, shell exit plus one empty Enter discards the edit, and the retry reuses that copy ✅ pass live paired-unpatched-318.txt, paired-unpatched-315.txt
Patched: the same refusal keeps the durable lease, shell exit plus one empty Enter leaves HEAD and the edit intact, and the retry uses a different copy ✅ pass live paired-patched-318.txt, paired-patched-315.txt
Adversarial: prune, plain return with stdin at EOF, and another task's spawn cannot reclaim the refused copy, while an explicit return --force makes it reusable ✅ pass live paired-patched-318.txt, paired-patched-315.txt
Interactive tmux path: a clean, unleased copy at origin/main recorded by a paused task in another registered home is leased to that task and not handed to a new spawn ✅ pass live rec-patched-default-tip.txt, rec-patched-default-tip-315.txt, rec-unpatched-default-tip.txt
Interactive tmux path: recorded copies with an unlanded commit or an existing lease stay untouched and keep the right holder ✅ pass live rec-patched-unlanded.txt, rec-patched-leased.txt, rec-unpatched-unlanded.txt, rec-unpatched-leased.txt
Herdr get --lease path: a recorded clean copy is protected before acquisition, a fresh spawn launches without a double-lease abort, and the slot-owner claim is written ✅ pass live herdr-patched.txt, herdr-unpatched.txt
Herdr dirty refusal keeps the lease and edit, names the explicit release, and the retry uses another copy ✅ pass live herdr-patched.txt
Adversarial: when protection cannot be confirmed after a Treehouse root move, spawn refuses, names the blocking record and copy, and acquires nothing ✅ pass live rootchange.txt
Spawn on real Treehouse v2.0.1 refuses before acquisition, and bootstrap reports it OUTDATED while v3.1.5 and v3.1.8 pass ✅ pass live old-th.txt, bootstrap.txt
The installer pin installs real Treehouse v3.1.5 with its checksum verified and lease support present ✅ pass live Installed v3.1.5 was then used for paired-patched-315.txt, rec-patched-default-tip-315.txt and lease-e2e-v3.1.5.txt
The real-Treehouse lease regression passes, including a symlinked pool root with a recorded copy ✅ pass live lease-e2e-v3.1.8.txt, lease-e2e-v3.1.5.txt
T3 acquisition path: a fresh T3 spawn protects a recorded copy, keeps its single lease and claims its slot on a real T3 server ⏸️ untested no I ran a disposable loopback T3 server with a scratch base dir and a scratch credential. Stable 0.1.6 and nightly 0.1.7-nightly.20261103.4106 failed Firstmate's capability gate because they lack t3_thr…
Evidence: Evidence index

Source: Evidence index

# Pooled-copy refusal and recorded-copy protection: live evidence

Target commit 5bcf2dc5; unpatched source is the base commit f641b44b, extracted with git archive.
All runs used real bin/fm-spawn.sh, real Git, unmodified Treehouse v3.1.8 and pinned v3.1.5, a private tmux socket or a fm-lab-* Herdr session, and disposable project, pool, home and HOME directories.
Paths are replaced with $LAB; HEAD, status and edit content are recorded before and after each step.

| Scenario | Files |
| --- | --- |
| Unpatched refusal, exit, empty Enter, retry | paired-unpatched-318.txt, paired-unpatched-315.txt |
| Patched refusal, exit, empty Enter, retry, prune, plain return, other task, explicit release | paired-patched-318.txt, paired-patched-315.txt |
| Paused task's recorded copy in another home, on the interactive get path | rec-{patched,unpatched}-{default-tip,unlanded,leased}.txt, rec-patched-default-tip-315.txt |
| Herdr get --lease path: recorded copy, no double lease, dirty refusal, retry | herdr-patched.txt, herdr-unpatched.txt |
| Protection failure names the record and copy, and nothing is acquired | rootchange.txt |
| Treehouse v2.0.1 refused by spawn and bootstrap | old-th.txt, bootstrap.txt |
| Real-Treehouse lease regression, including a symlinked pool root | lease-e2e-v3.1.8.txt, lease-e2e-v3.1.5.txt |
| Live T3 attempts, which were blocked | t3-live-attempts.txt |

The tmux proofs use a bounded outside writer that watches the real pane enter the copy, then edits from outside the pane.
The Herdr dirty proof uses a PATH shim that runs the real Treehouse, then edits immediately after get --lease returns, because no polling writer won that gap in six tries.
Scripts are in driver/.
Evidence: Unpatched paired proof, Treehouse v3.1.8

Source: Unpatched paired proof, Treehouse v3.1.8

=== unpatched source=f641b44b
treehouse v3.1.8
tmux socket under private lab dir; project/pool/home all under $LAB; HOME=$LAB/userhome
$ bin/fm-spawn.sh proof-unpatched $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
error: pooled worktree '$LAB/pool/.treehouse/project-ab52ba/1/project' is not clean; refusing to discard uncommitted work while refreshing its base
spawn_exit=1
path=$LAB/pool/.treehouse/project-ab52ba/1/project
head=9149bd37ce8a5d6b0bc6f46dda872e11af6d9395
status= M README.md
CHECK PASS: spawn refused the dirty copy with exit 1
CHECK PASS: refusal says the copy is not clean
CHECK PASS: refusal published no task record
--- BEFORE shell exit
HEAD=9149bd37ce8a5d6b0bc6f46dda872e11af6d9395
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-unpatched
treehouse status:
{"name":"1","status":"in-use","lease_holder":"","head_path":"1/project"}
--- pane after typing exit:
treehouse get
lab$ treehouse get
🌳 Setting up worktree...
🌳 Entered worktree at $LAB/pool/.treehouse/project-ab52ba/1/project. Type 'exit' to return.
lab$ exit
logout
🌳 Worktree has uncommitted changes.
Clean worktree and return to pool? [Y/n] 
--- pane after one empty Enter:
treehouse get
lab$ treehouse get
🌳 Setting up worktree...
🌳 Entered worktree at $LAB/pool/.treehouse/project-ab52ba/1/project. Type 'exit' to return.
lab$ exit
logout
🌳 Worktree has uncommitted changes.
Clean worktree and return to pool? [Y/n] 
🌳 Worktree returned to pool.
lab$ 
--- AFTER shell exit plus empty Enter
HEAD=9149bd37ce8a5d6b0bc6f46dda872e11af6d9395
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
CHECK PASS: bug reproduced: empty Enter discarded the edit
window: 0: bash* (1 panes) [120x40] [layout aafd,120x40,0,0,0] @0 (active)
$ RETRY bin/fm-spawn.sh proof-unpatched $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
spawned proof-unpatched harness=codex kind=scout window=firstmate:fm-proof-unpatched worktree=$LAB/pool/.treehouse/project-ab52ba/1/project
retry_exit=0
retry worktree=$LAB/pool/.treehouse/project-ab52ba/1/project
CHECK PASS: retry launched
--- REFUSED COPY after retry
HEAD=9149bd37ce8a5d6b0bc6f46dda872e11af6d9395
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"in-use","lease_holder":"","head_path":"1/project"}
CHECK PASS: bug reproduced: retry reuses the refused copy
RESULT unpatched fails=0
Evidence: Patched paired proof, Treehouse v3.1.8

Source: Patched paired proof, Treehouse v3.1.8

=== patched source=5bcf2dc5
treehouse v3.1.8
tmux socket under private lab dir; project/pool/home all under $LAB; HOME=$LAB/userhome
$ bin/fm-spawn.sh proof-patched $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
🌳 Leased worktree 1 at $LAB/pool/.treehouse/project-9df83f/1/project. Run 'treehouse return $LAB/pool/.treehouse/project-9df83f/1/project' to release it.
error: pooled worktree '$LAB/pool/.treehouse/project-9df83f/1/project' is not clean; refusing to discard uncommitted work while refreshing its base
warning: Treehouse lease for task proof-patched on $LAB/pool/.treehouse/project-9df83f/1/project was left in place; a refusal never releases or resets its copy.
After inspecting and deciding to discard that copy, release it explicitly: (cd '$LAB/project' && treehouse return --force '$LAB/pool/.treehouse/project-9df83f/1/project')
spawn_exit=1
path=$LAB/pool/.treehouse/project-9df83f/1/project
head=3841e4a1b68b5d8f75ccb3a238a67c3279539029
status= M README.md
CHECK PASS: spawn refused the dirty copy with exit 1
CHECK PASS: refusal says the copy is not clean
CHECK PASS: refusal published no task record
--- BEFORE shell exit
HEAD=3841e4a1b68b5d8f75ccb3a238a67c3279539029
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-patched
treehouse status:
{"name":"1","status":"leased","lease_holder":"proof-patched","head_path":"1/project"}
--- pane after typing exit:
treehouse get
lab$ treehouse get
🌳 Setting up worktree...
🌳 Entered worktree at $LAB/pool/.treehouse/project-9df83f/1/project. Type 'exit' to return.
lab$ exit
logout
🌳 Not returning $LAB/pool/.treehouse/project-9df83f/1/project to the pool: owner precondition failed: it is now durably leased (holder: "proof-patched"); leaving it exactly as it is.
lab$ 
--- pane after one empty Enter:
treehouse get
lab$ treehouse get
🌳 Setting up worktree...
🌳 Entered worktree at $LAB/pool/.treehouse/project-9df83f/1/project. Type 'exit' to return.
lab$ exit
logout
🌳 Not returning $LAB/pool/.treehouse/project-9df83f/1/project to the pool: owner precondition failed: it is now durably leased (holder: "proof-patched"); leaving it exactly as it is.
lab$ 
lab$ 
--- AFTER shell exit plus empty Enter
HEAD=3841e4a1b68b5d8f75ccb3a238a67c3279539029
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-patched
treehouse status:
{"name":"1","status":"leased","lease_holder":"proof-patched","head_path":"1/project"}
CHECK PASS: edit survives shell exit plus empty Enter
CHECK PASS: HEAD unchanged after exit plus Enter
CHECK PASS: durable lease retained after exit
window: 0: bash* (1 panes) [120x40] [layout aafd,120x40,0,0,0] @0 (active)
$ RETRY bin/fm-spawn.sh proof-patched $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
🌳 Leased worktree 2 at $LAB/pool/.treehouse/project-9df83f/2/project. Run 'treehouse return $LAB/pool/.treehouse/project-9df83f/2/project' to release it.
spawned proof-patched harness=codex kind=scout window=firstmate:fm-proof-patched worktree=$LAB/pool/.treehouse/project-9df83f/2/project
retry_exit=0
retry worktree=$LAB/pool/.treehouse/project-9df83f/2/project
CHECK PASS: retry launched
--- REFUSED COPY after retry
HEAD=3841e4a1b68b5d8f75ccb3a238a67c3279539029
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-patched
treehouse status:
{"name":"1","status":"leased","lease_holder":"proof-patched","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"proof-patched","head_path":"2/project"}
CHECK PASS: retry uses a different copy
CHECK PASS: edit survives the retry
$ treehouse prune
🌳 No stale worktrees to prune.
$ treehouse return <copy> (no --force, no holder)
Worktree has uncommitted changes. Clean and return? [Y/n] 🌳 worktree not returned: it has uncommitted changes and the confirmation could not be answered (stdin reached EOF); prune will not reclaim this slot. Use treehouse return --force '$LAB/pool/.treehouse/project-9df83f/1/project' to clean and return it
return_exit=3
CHECK PASS: edit survives prune and plain return
--- REFUSED COPY after prune and plain return
HEAD=3841e4a1b68b5d8f75ccb3a238a67c3279539029
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-patched
treehouse status:
{"name":"1","status":"leased","lease_holder":"proof-patched","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"proof-patched","head_path":"2/project"}
$ another task bin/fm-spawn.sh proof-other
exit=0
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
🌳 Leased worktree 3 at $LAB/pool/.treehouse/project-9df83f/3/project. Run 'treehouse return $LAB/pool/.treehouse/project-9df83f/3/project' to release it.
spawned proof-other harness=codex kind=scout window=firstmate:fm-proof-other worktree=$LAB/pool/.treehouse/project-9df83f/3/project
worktree=$LAB/pool/.treehouse/project-9df83f/3/project
CHECK PASS: another task also avoids the refused copy
$ (cd $LAB/project && treehouse return --force <copy>)
🌳 Worktree returned to pool.
release_exit=0
--- REFUSED COPY after explicit release
HEAD=3841e4a1b68b5d8f75ccb3a238a67c3279539029
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"proof-patched","head_path":"2/project"}
{"name":"3","status":"leased","lease_holder":"proof-other","head_path":"3/project"}
CHECK PASS: explicit release discards the edit
$ next task bin/fm-spawn.sh proof-after-release
exit=0
worktree=$LAB/pool/.treehouse/project-9df83f/1/project
CHECK PASS: released copy is reusable by the next spawn
RESULT patched fails=0
Evidence: Unpatched paired proof, pinned v3.1.5

Source: Unpatched paired proof, pinned v3.1.5

=== unpatched source=f641b44b
treehouse v3.1.5
tmux socket under private lab dir; project/pool/home all under $LAB; HOME=$LAB/userhome
$ bin/fm-spawn.sh proof-unpatched $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
error: pooled worktree '$LAB/pool/.treehouse/project-a8b44a/1/project' is not clean; refusing to discard uncommitted work while refreshing its base
spawn_exit=1
path=$LAB/pool/.treehouse/project-a8b44a/1/project
head=dcecf3ef6a8420656baac3482cf84234cb45ba0b
status= M README.md
CHECK PASS: spawn refused the dirty copy with exit 1
CHECK PASS: refusal says the copy is not clean
CHECK PASS: refusal published no task record
--- BEFORE shell exit
HEAD=dcecf3ef6a8420656baac3482cf84234cb45ba0b
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-unpatched
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"in-use","lease_holder":"","head_path":"1/project"}
--- pane after typing exit:
treehouse get
lab$ treehouse get
🌳 Setting up worktree...
🌳 Entered worktree at $LAB/pool/.treehouse/project-a8b44a/1/project. Type 'exit' to return.
lab$ exit
logout
🌳 Worktree has uncommitted changes.
Clean worktree and return to pool? [Y/n] 
--- pane after one empty Enter:
treehouse get
lab$ treehouse get
🌳 Setting up worktree...
🌳 Entered worktree at $LAB/pool/.treehouse/project-a8b44a/1/project. Type 'exit' to return.
lab$ exit
logout
🌳 Worktree has uncommitted changes.
Clean worktree and return to pool? [Y/n] 
🌳 Worktree returned to pool.
lab$ 
--- AFTER shell exit plus empty Enter
HEAD=dcecf3ef6a8420656baac3482cf84234cb45ba0b
git status --short:
README.md content:
base
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
CHECK PASS: bug reproduced: empty Enter discarded the edit
window: 0: bash* (1 panes) [120x40] [layout aafd,120x40,0,0,0] @0 (active)
$ RETRY bin/fm-spawn.sh proof-unpatched $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
spawned proof-unpatched harness=codex kind=scout window=firstmate:fm-proof-unpatched worktree=$LAB/pool/.treehouse/project-a8b44a/1/project
retry_exit=0
retry worktree=$LAB/pool/.treehouse/project-a8b44a/1/project
CHECK PASS: retry launched
--- REFUSED COPY after retry
HEAD=dcecf3ef6a8420656baac3482cf84234cb45ba0b
git status --short:
README.md content:
base
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"in-use","lease_holder":"","head_path":"1/project"}
CHECK PASS: bug reproduced: retry reuses the refused copy
RESULT unpatched fails=0
Evidence: Patched paired proof, pinned v3.1.5

Source: Patched paired proof, pinned v3.1.5

=== patched source=5bcf2dc5
treehouse v3.1.5
tmux socket under private lab dir; project/pool/home all under $LAB; HOME=$LAB/userhome
$ bin/fm-spawn.sh proof-patched $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

🌳 Leased worktree 1 at $LAB/pool/.treehouse/project-60095f/1/project. Run 'treehouse return $LAB/pool/.treehouse/project-60095f/1/project' to release it.
error: pooled worktree '$LAB/pool/.treehouse/project-60095f/1/project' is not clean; refusing to discard uncommitted work while refreshing its base
warning: Treehouse lease for task proof-patched on $LAB/pool/.treehouse/project-60095f/1/project was left in place; a refusal never releases or resets its copy.
After inspecting and deciding to discard that copy, release it explicitly: (cd '$LAB/project' && treehouse return --force '$LAB/pool/.treehouse/project-60095f/1/project')
spawn_exit=1
path=$LAB/pool/.treehouse/project-60095f/1/project
head=74bc63b3a12674c66861f9dcf5e9d778d0a2fc04
status= M README.md
CHECK PASS: spawn refused the dirty copy with exit 1
CHECK PASS: refusal says the copy is not clean
CHECK PASS: refusal published no task record
--- BEFORE shell exit
HEAD=74bc63b3a12674c66861f9dcf5e9d778d0a2fc04
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-patched
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"leased","lease_holder":"proof-patched","head_path":"1/project"}
--- pane after typing exit:
treehouse get
lab$ treehouse get
🌳 Setting up worktree...
🌳 Entered worktree at $LAB/pool/.treehouse/project-60095f/1/project. Type 'exit' to return.
lab$ exit
logout
🌳 Not returning $LAB/pool/.treehouse/project-60095f/1/project to the pool: owner precondition failed: it is now durably leased (holder: "proof-patched"); leaving it exactly as it is.
lab$ 
--- pane after one empty Enter:
treehouse get
lab$ treehouse get
🌳 Setting up worktree...
🌳 Entered worktree at $LAB/pool/.treehouse/project-60095f/1/project. Type 'exit' to return.
lab$ exit
logout
🌳 Not returning $LAB/pool/.treehouse/project-60095f/1/project to the pool: owner precondition failed: it is now durably leased (holder: "proof-patched"); leaving it exactly as it is.
lab$ 
lab$ 
--- AFTER shell exit plus empty Enter
HEAD=74bc63b3a12674c66861f9dcf5e9d778d0a2fc04
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-patched
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"leased","lease_holder":"proof-patched","head_path":"1/project"}
CHECK PASS: edit survives shell exit plus empty Enter
CHECK PASS: HEAD unchanged after exit plus Enter
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

CHECK PASS: durable lease retained after exit
window: 0: bash* (1 panes) [120x40] [layout aafd,120x40,0,0,0] @0 (active)
$ RETRY bin/fm-spawn.sh proof-patched $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

🌳 Leased worktree 2 at $LAB/pool/.treehouse/project-60095f/2/project. Run 'treehouse return $LAB/pool/.treehouse/project-60095f/2/project' to release it.
spawned proof-patched harness=codex kind=scout window=firstmate:fm-proof-patched worktree=$LAB/pool/.treehouse/project-60095f/2/project
retry_exit=0
retry worktree=$LAB/pool/.treehouse/project-60095f/2/project
CHECK PASS: retry launched
--- REFUSED COPY after retry
HEAD=74bc63b3a12674c66861f9dcf5e9d778d0a2fc04
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-patched
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"leased","lease_holder":"proof-patched","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"proof-patched","head_path":"2/project"}
CHECK PASS: retry uses a different copy
CHECK PASS: edit survives the retry
$ treehouse prune
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

🌳 No stale worktrees to prune.
$ treehouse return <copy> (no --force, no holder)
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

Worktree has uncommitted changes. Clean and return? [Y/n] 🌳 worktree not returned: it has uncommitted changes and the confirmation could not be answered (stdin reached EOF); prune will not reclaim this slot. Use treehouse return --force '$LAB/pool/.treehouse/project-60095f/1/project' to clean and return it
return_exit=3
CHECK PASS: edit survives prune and plain return
--- REFUSED COPY after prune and plain return
HEAD=74bc63b3a12674c66861f9dcf5e9d778d0a2fc04
git status --short:
 M README.md
README.md content:
base
outside writer edit for proof-patched
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"leased","lease_holder":"proof-patched","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"proof-patched","head_path":"2/project"}
$ another task bin/fm-spawn.sh proof-other
exit=0
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

🌳 Leased worktree 3 at $LAB/pool/.treehouse/project-60095f/3/project. Run 'treehouse return $LAB/pool/.treehouse/project-60095f/3/project' to release it.
spawned proof-other harness=codex kind=scout window=firstmate:fm-proof-other worktree=$LAB/pool/.treehouse/project-60095f/3/project
worktree=$LAB/pool/.treehouse/project-60095f/3/project
CHECK PASS: another task also avoids the refused copy
$ (cd $LAB/project && treehouse return --force <copy>)
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

🌳 Worktree returned to pool.
release_exit=0
--- REFUSED COPY after explicit release
HEAD=74bc63b3a12674c66861f9dcf5e9d778d0a2fc04
git status --short:
README.md content:
base
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"proof-patched","head_path":"2/project"}
{"name":"3","status":"leased","lease_holder":"proof-other","head_path":"3/project"}
CHECK PASS: explicit release discards the edit
$ next task bin/fm-spawn.sh proof-after-release
exit=0
worktree=$LAB/pool/.treehouse/project-60095f/1/project
CHECK PASS: released copy is reusable by the next spawn
RESULT patched fails=0
Evidence: Recorded copy at origin/main, patched

Source: Recorded copy at origin/main, patched

=== patched mode=default-tip treehouse=v3.1.8
🌳 Worktree returned to pool.
paused record (in another home): kind=scout worktree=$LAB/pool/.treehouse/project-c874fb/1/project
origin/main=eda95a948f0b9487aaaf07786148a703fe0958ad copyHEAD=eda95a948f0b9487aaaf07786148a703fe0958ad
--- BEFORE spawn
HEAD=eda95a948f0b9487aaaf07786148a703fe0958ad
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
$ bin/fm-spawn.sh rec-patched-default-tip $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
🌳 Leased worktree 1 at $LAB/pool/.treehouse/project-c874fb/1/project. Run 'treehouse return $LAB/pool/.treehouse/project-c874fb/1/project' to release it.
🌳 Leased worktree 2 at $LAB/pool/.treehouse/project-c874fb/2/project. Run 'treehouse return $LAB/pool/.treehouse/project-c874fb/2/project' to release it.
spawned rec-patched-default-tip harness=codex kind=scout window=firstmate:fm-rec-patched-default-tip worktree=$LAB/pool/.treehouse/project-c874fb/2/project
exit=0
new task worktree=$LAB/pool/.treehouse/project-c874fb/2/project
--- AFTER spawn
HEAD=eda95a948f0b9487aaaf07786148a703fe0958ad
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"leased","lease_holder":"paused-scout","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"rec-patched-default-tip","head_path":"2/project"}
CHECK PASS: spawn launched
CHECK PASS: new task did not take the recorded copy
CHECK PASS: recorded copy HEAD unchanged
CHECK PASS: recorded copy lease holder is paused-scout
$ next spawn exit=0 worktree=$LAB/pool/.treehouse/project-c874fb/3/project
CHECK PASS: next spawn also avoids it
CHECK PASS: recorded copy HEAD still unchanged
RESULT patched/default-tip fails=0
Evidence: Recorded copy at origin/main, patched, pinned v3.1.5

Source: Recorded copy at origin/main, patched, pinned v3.1.5

=== patched mode=default-tip treehouse=v3.1.5
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

🌳 Worktree returned to pool.
paused record (in another home): kind=scout worktree=$LAB/pool/.treehouse/project-560d99/1/project
origin/main=80ed1187b4c523fbd9bfd853cb036e3b60acc2d2 copyHEAD=80ed1187b4c523fbd9bfd853cb036e3b60acc2d2
--- BEFORE spawn
HEAD=80ed1187b4c523fbd9bfd853cb036e3b60acc2d2
git status --short:
README.md content:
base
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
$ bin/fm-spawn.sh rec-patched-default-tip $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

🌳 Leased worktree 1 at $LAB/pool/.treehouse/project-560d99/1/project. Run 'treehouse return $LAB/pool/.treehouse/project-560d99/1/project' to release it.
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

🌳 Leased worktree 2 at $LAB/pool/.treehouse/project-560d99/2/project. Run 'treehouse return $LAB/pool/.treehouse/project-560d99/2/project' to release it.
spawned rec-patched-default-tip harness=codex kind=scout window=firstmate:fm-rec-patched-default-tip worktree=$LAB/pool/.treehouse/project-560d99/2/project
exit=0
new task worktree=$LAB/pool/.treehouse/project-560d99/2/project
--- AFTER spawn
HEAD=80ed1187b4c523fbd9bfd853cb036e3b60acc2d2
git status --short:
README.md content:
base
treehouse status:
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

{"name":"1","status":"leased","lease_holder":"paused-scout","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"rec-patched-default-tip","head_path":"2/project"}
CHECK PASS: spawn launched
CHECK PASS: new task did not take the recorded copy
CHECK PASS: recorded copy HEAD unchanged
A new version of treehouse is available: v3.1.5 → v3.1.8
Run "treehouse update" to update

CHECK PASS: recorded copy lease holder is paused-scout
$ next spawn exit=0 worktree=$LAB/pool/.treehouse/project-560d99/3/project
CHECK PASS: next spawn also avoids it
CHECK PASS: recorded copy HEAD still unchanged
RESULT patched/default-tip fails=0
Evidence: Recorded copy at origin/main, unpatched reuse

Source: Recorded copy at origin/main, unpatched reuse

=== unpatched mode=default-tip treehouse=v3.1.8
🌳 Worktree returned to pool.
paused record (in another home): kind=scout worktree=$LAB/pool/.treehouse/project-071f75/1/project
origin/main=e8b39073a7fafd64f45e32508b40cb4a2fee4df1 copyHEAD=e8b39073a7fafd64f45e32508b40cb4a2fee4df1
--- BEFORE spawn
HEAD=e8b39073a7fafd64f45e32508b40cb4a2fee4df1
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
$ bin/fm-spawn.sh rec-unpatched-default-tip $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
spawned rec-unpatched-default-tip harness=codex kind=scout window=firstmate:fm-rec-unpatched-default-tip worktree=$LAB/pool/.treehouse/project-071f75/1/project
exit=0
new task worktree=$LAB/pool/.treehouse/project-071f75/1/project
--- AFTER spawn
HEAD=e8b39073a7fafd64f45e32508b40cb4a2fee4df1
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"in-use","lease_holder":"","head_path":"1/project"}
observed: new task copy REUSED recorded copy
RESULT unpatched/default-tip fails=0
Evidence: Recorded copy with unlanded commit, patched

Source: Recorded copy with unlanded commit, patched

=== patched mode=unlanded treehouse=v3.1.8
🌳 Worktree returned to pool.
paused record (in another home): kind=scout worktree=$LAB/pool/.treehouse/project-db4db0/1/project
origin/main=e1fca56a4ba7c6b64ce4cae73ae093174afef9a5 copyHEAD=7ba9c52854900d250b27211e3a6f458d0d054a6a
--- BEFORE spawn
HEAD=7ba9c52854900d250b27211e3a6f458d0d054a6a
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
$ bin/fm-spawn.sh rec-patched-unlanded $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
🌳 Leased worktree 1 at $LAB/pool/.treehouse/project-db4db0/1/project. Run 'treehouse return $LAB/pool/.treehouse/project-db4db0/1/project' to release it.
🌳 Leased worktree 2 at $LAB/pool/.treehouse/project-db4db0/2/project. Run 'treehouse return $LAB/pool/.treehouse/project-db4db0/2/project' to release it.
spawned rec-patched-unlanded harness=codex kind=scout window=firstmate:fm-rec-patched-unlanded worktree=$LAB/pool/.treehouse/project-db4db0/2/project
exit=0
new task worktree=$LAB/pool/.treehouse/project-db4db0/2/project
--- AFTER spawn
HEAD=7ba9c52854900d250b27211e3a6f458d0d054a6a
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"leased","lease_holder":"paused-scout","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"rec-patched-unlanded","head_path":"2/project"}
CHECK PASS: spawn launched
CHECK PASS: new task did not take the recorded copy
CHECK PASS: recorded copy HEAD unchanged
CHECK PASS: recorded copy lease holder is paused-scout
$ next spawn exit=0 worktree=$LAB/pool/.treehouse/project-db4db0/3/project
CHECK PASS: next spawn also avoids it
CHECK PASS: recorded copy HEAD still unchanged
RESULT patched/unlanded fails=0
Evidence: Recorded copy with unlanded commit, unpatched

Source: Recorded copy with unlanded commit, unpatched

=== unpatched mode=unlanded treehouse=v3.1.8
🌳 Worktree returned to pool.
paused record (in another home): kind=scout worktree=$LAB/pool/.treehouse/project-b57bfb/1/project
origin/main=d05efc3abe584335f18dc8c407d8092ff83ff317 copyHEAD=8bf2fa4c84a2b52ee53fe4d69154161d52efb612
--- BEFORE spawn
HEAD=8bf2fa4c84a2b52ee53fe4d69154161d52efb612
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
$ bin/fm-spawn.sh rec-unpatched-unlanded $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
spawned rec-unpatched-unlanded harness=codex kind=scout window=firstmate:fm-rec-unpatched-unlanded worktree=$LAB/pool/.treehouse/project-b57bfb/2/project
exit=0
new task worktree=$LAB/pool/.treehouse/project-b57bfb/2/project
--- AFTER spawn
HEAD=8bf2fa4c84a2b52ee53fe4d69154161d52efb612
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"available","lease_holder":"","head_path":"1/project"}
{"name":"2","status":"in-use","lease_holder":"","head_path":"2/project"}
observed: new task copy avoided recorded copy
RESULT unpatched/unlanded fails=0
Evidence: Recorded copy already leased, patched

Source: Recorded copy already leased, patched

=== patched mode=leased treehouse=v3.1.8
🌳 Worktree returned to pool.
paused record (in another home): kind=scout worktree=$LAB/pool/.treehouse/project-800570/1/project
origin/main=aa3983ac6c4834e68bcb4dd01c7dda53c37c9508 copyHEAD=aa3983ac6c4834e68bcb4dd01c7dda53c37c9508
--- BEFORE spawn
HEAD=aa3983ac6c4834e68bcb4dd01c7dda53c37c9508
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"leased","lease_holder":"original-holder","head_path":"1/project"}
$ bin/fm-spawn.sh rec-patched-leased $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
🌳 Leased worktree 2 at $LAB/pool/.treehouse/project-800570/2/project. Run 'treehouse return $LAB/pool/.treehouse/project-800570/2/project' to release it.
spawned rec-patched-leased harness=codex kind=scout window=firstmate:fm-rec-patched-leased worktree=$LAB/pool/.treehouse/project-800570/2/project
exit=0
new task worktree=$LAB/pool/.treehouse/project-800570/2/project
--- AFTER spawn
HEAD=aa3983ac6c4834e68bcb4dd01c7dda53c37c9508
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"leased","lease_holder":"original-holder","head_path":"1/project"}
{"name":"2","status":"leased","lease_holder":"rec-patched-leased","head_path":"2/project"}
CHECK PASS: spawn launched
CHECK PASS: new task did not take the recorded copy
CHECK PASS: recorded copy HEAD unchanged
CHECK PASS: recorded copy lease holder is original-holder
$ next spawn exit=0 worktree=$LAB/pool/.treehouse/project-800570/3/project
CHECK PASS: next spawn also avoids it
CHECK PASS: recorded copy HEAD still unchanged
RESULT patched/leased fails=0
Evidence: Recorded copy already leased, unpatched

Source: Recorded copy already leased, unpatched

=== unpatched mode=leased treehouse=v3.1.8
🌳 Worktree returned to pool.
paused record (in another home): kind=scout worktree=$LAB/pool/.treehouse/project-23a71f/1/project
origin/main=d0b54eabc563ef2aa6def263a0ca0151cbd46f45 copyHEAD=d0b54eabc563ef2aa6def263a0ca0151cbd46f45
--- BEFORE spawn
HEAD=d0b54eabc563ef2aa6def263a0ca0151cbd46f45
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"leased","lease_holder":"original-holder","head_path":"1/project"}
$ bin/fm-spawn.sh rec-unpatched-leased $LAB/project --scout
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
spawned rec-unpatched-leased harness=codex kind=scout window=firstmate:fm-rec-unpatched-leased worktree=$LAB/pool/.treehouse/project-23a71f/2/project
exit=0
new task worktree=$LAB/pool/.treehouse/project-23a71f/2/project
--- AFTER spawn
HEAD=d0b54eabc563ef2aa6def263a0ca0151cbd46f45
git status --short:
README.md content:
base
treehouse status:
{"name":"1","status":"leased","lease_holder":"original-holder","head_path":"1/project"}
{"name":"2","status":"in-use","lease_holder":"","head_path":"2/project"}
observed: new task copy avoided recorded copy
RESULT unpatched/leased fails=0
Evidence: Herdr acquisition path, unpatched reuse

Source: Herdr acquisition path, unpatched reuse

=== herdr unpatched treehouse=v3.1.8 herdr=herdr 0.9.5 session=fm-lab-*
🌳 Worktree returned to pool.
recorded copy=$LAB/pool/.treehouse/project-eaf1fc/1/project HEAD=f6fac84a63c90effe144141576065d5a2d3622c8 origin/main=f6fac84a63c90effe144141576065d5a2d3622c8
{"name":"1","status":"available","lease_holder":""}
$ fm-spawn hrec1 --backend herdr
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB/home
warning: $LAB/home/data/hrec1/launch-brief.md records no ship branch; defaulting to legacy branch fm/hrec1
warning: $LAB/home/data/hrec1/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
🌳 Setting up worktree...
🌳 Leased worktree at $LAB/pool/.treehouse/project-eaf1fc/1/project. Run 'treehouse return $LAB/pool/.treehouse/project-eaf1fc/1/project' to release it.
spawned hrec1 harness=sh kind=ship mode=no-mistakes yolo=off window=fm-lab-rec-unpatched-96752-7694:w1:p2 worktree=$LAB/pool/.treehouse/project-eaf1fc/1/project
exit=0
worktree=$LAB/pool/.treehouse/project-eaf1fc/1/project
window=fm-lab-rec-unpatched-96752-7694:w1:p2
backend=herdr
{"name":"1","status":"leased","lease_holder":"hrec1"}
observed: herdr task copy REUSED recorded copy

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

🔧 **Rebase** - 2 issues found → auto-fixed ✅
  • ⚠️ bin/fm-spawn.sh - merge conflict rebasing onto origin/main
  • ⚠️ bin/fm-wake-lib.sh - merge conflict rebasing onto origin/main

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Review** - 1 info
  • 🚨 bin/fm-spawn.sh:4785 - The recorded-copy scan compares a fully resolved path with Treehouse's unresolved status path. recorded=$(real_path_or_raw &#34;$recorded&#34;) runs pwd -P, then jq requires .path == $path against treehouse status --json, and zero matches raises 'recorded copy missing from pool status', so the scan returns 1. I ran real Treehouse v3.1.8 in scratch with a symlinked HOME and default root, and separately with a symlinked root = value. In both, status reported .../linkhome/.treehouse/&lt;pool&gt;/1/project while pwd -P gave .../realhome/.treehouse/&lt;pool&gt;/1/project. On any home whose pool path crosses a symlink (for example a symlinked /home or a symlinked ~/.treehouse), once one task record names a copy in this project's pool, every later fresh spawn for that project fails with 'could not protect locally recorded Treehouse copies'. That includes records whose copy is already leased, because the lookup runs before the leased check. This is a new regression, because fm_treehouse_pool_slot and the post-acquisition lease check at bin/fm-spawn.sh:6017 both tolerate symlinks. The same exit also fires when a record points at a managed pool that the project's current Treehouse root no longer lists, such as after a root change. The stand-in tests/fixtures.sh:406-417 emits the same path form the test records, so it cannot catch this. Fix: find the row by slot name, basename(dirname(recorded)), and compare real_path_or_raw of that row's .path with the recorded path. Add a regression using a symlinked pool root.
  • ⚠️ tests/fm-treehouse-lease-e2e.test.sh:5 - Simplification: the FM_TREEHOUSE_TEST_LEASE=0 mode (lines 5, 26, 33, 74) runs the regression without leasing to reproduce old behavior on Treehouse v2. No intent requirement needs it, because the intent requires lease support (v3.0.0 or newer) and asks for a real-Treehouse lease regression. No caller or CI lane in the change sets it, and on v3 the unlanded-copy skip means it no longer shows the lease protecting anything. Recommend removing the mode and always leasing.

🔧 Fix applied.
3 issues (1 error, 2 infos) still open:

  • 🚨 bin/fm-spawn.sh:4785 - The recorded-copy scan compares a fully resolved path with Treehouse's unresolved status path. recorded=$(real_path_or_raw &#34;$recorded&#34;) runs pwd -P, then jq requires .path == $path against treehouse status --json, and zero matches raises 'recorded copy missing from pool status', so the scan returns 1. I ran real Treehouse v3.1.8 in scratch with a symlinked HOME and default root, and separately with a symlinked root = value. In both, status reported .../linkhome/.treehouse/&lt;pool&gt;/1/project while pwd -P gave .../realhome/.treehouse/&lt;pool&gt;/1/project. On any home whose pool path crosses a symlink (for example a symlinked /home or a symlinked ~/.treehouse), once one task record names a copy in this project's pool, every later fresh spawn for that project fails with 'could not protect locally recorded Treehouse copies'. That includes records whose copy is already leased, because the lookup runs before the leased check. This is a new regression, because fm_treehouse_pool_slot and the post-acquisition lease check at bin/fm-spawn.sh:6017 both tolerate symlinks. The same exit also fires when a record points at a managed pool that the project's current Treehouse root no longer lists, such as after a root change. The stand-in tests/fixtures.sh:406-417 emits the same path form the test records, so it cannot catch this. Fix: find the row by slot name, basename(dirname(recorded)), and compare real_path_or_raw of that row's .path with the recorded path. Add a regression using a symlinked pool root.
  • ℹ️ bin/fm-spawn.sh:4802 - The recorded-copy refusal does not name the record or copy that blocked it. This path was changed by this run's round 1 fix. Sequence: a paused task's record names <old-root>/<pool>/1/<repo>, and the project's Treehouse root later changes. fm_treehouse_pool_slot still passes because the old pool state and Git common dir still match. Status lists slot 1 at a different path, so bin/fm-spawn.sh:4792 returns 1 silently. If no slot 1 exists, the only extra text is jq's 'recorded copy missing from pool status'. Every later spawn for that project then fails with only 'could not protect locally recorded Treehouse copies', and the operator must search every local home's records for the culprit. The refusal itself is correct and should stay. Fix: print the meta path and recorded copy on each failing return in spawn_protect_recorded_pool_copies, at bin/fm-spawn.sh:4775-4795.
  • ℹ️ bin/fm-home-seed.sh:396 - A third acquisition path has no recorded-copy protection. acquire_treehouse_home runs treehouse get --lease without the project lock or the scan. A pre-upgrade paused task on the firstmate repo with a clean, unleased copy at origin/main can be handed to a newly seeded secondmate home if seeding happens before any crewmate spawn for that project runs the scan. This is noted only: the intent limits the requirement to 'either acquisition path' in spawn, and the exposure ends once a scan has leased those records. This file is not part of the change, so it does not block merge.

🔧 Fix applied.
4 issues (1 error, 3 infos) still open:

  • 🚨 bin/fm-spawn.sh:4785 - The recorded-copy scan compares a fully resolved path with Treehouse's unresolved status path. recorded=$(real_path_or_raw &#34;$recorded&#34;) runs pwd -P, then jq requires .path == $path against treehouse status --json, and zero matches raises 'recorded copy missing from pool status', so the scan returns 1. I ran real Treehouse v3.1.8 in scratch with a symlinked HOME and default root, and separately with a symlinked root = value. In both, status reported .../linkhome/.treehouse/&lt;pool&gt;/1/project while pwd -P gave .../realhome/.treehouse/&lt;pool&gt;/1/project. On any home whose pool path crosses a symlink (for example a symlinked /home or a symlinked ~/.treehouse), once one task record names a copy in this project's pool, every later fresh spawn for that project fails with 'could not protect locally recorded Treehouse copies'. That includes records whose copy is already leased, because the lookup runs before the leased check. This is a new regression, because fm_treehouse_pool_slot and the post-acquisition lease check at bin/fm-spawn.sh:6017 both tolerate symlinks. The same exit also fires when a record points at a managed pool that the project's current Treehouse root no longer lists, such as after a root change. The stand-in tests/fixtures.sh:406-417 emits the same path form the test records, so it cannot catch this. Fix: find the row by slot name, basename(dirname(recorded)), and compare real_path_or_raw of that row's .path with the recorded path. Add a regression using a symlinked pool root.
  • ℹ️ bin/fm-spawn.sh:4802 - The recorded-copy refusal does not name the record or copy that blocked it. This path was changed by this run's round 1 fix. Sequence: a paused task's record names <old-root>/<pool>/1/<repo>, and the project's Treehouse root later changes. fm_treehouse_pool_slot still passes because the old pool state and Git common dir still match. Status lists slot 1 at a different path, so bin/fm-spawn.sh:4792 returns 1 silently. If no slot 1 exists, the only extra text is jq's 'recorded copy missing from pool status'. Every later spawn for that project then fails with only 'could not protect locally recorded Treehouse copies', and the operator must search every local home's records for the culprit. The refusal itself is correct and should stay. Fix: print the meta path and recorded copy on each failing return in spawn_protect_recorded_pool_copies, at bin/fm-spawn.sh:4775-4795.
  • ℹ️ bin/fm-home-seed.sh:396 - A third acquisition path has no recorded-copy protection. acquire_treehouse_home runs treehouse get --lease without the project lock or the scan. A pre-upgrade paused task on the firstmate repo with a clean, unleased copy at origin/main can be handed to a newly seeded secondmate home if seeding happens before any crewmate spawn for that project runs the scan. This is noted only: the intent limits the requirement to 'either acquisition path' in spawn, and the exposure ends once a scan has leased those records. This file is not part of the change, so it does not block merge.
  • ℹ️ bin/fm-spawn.sh:4479 - Operator text still says closing an endpoint returns the slot, which is false once the copy holds a durable lease. spawn_endpoint_hint prints 'window X is closed on exit, returning any pool slot it held'. Sequence: a fresh polytoken spawn on tmux confirms its lease at bin/fm-spawn.sh:6030-6035, then fm_treehouse_slot_owner_claim fails at bin/fm-spawn.sh:6044 because the slot directory is not writable. The refusal says the slot is being returned, and the abort footer at bin/fm-spawn.sh:1719 then says the lease 'was left in place; a refusal never releases'. An operator gets two opposite statements about whether the copy is reusable. Other sites with the same wording: bin/fm-spawn.sh:6031 (lease failure, followed by the 'unconfirmed' warning, where nothing proves a return) and bin/fm-spawn.sh:1892 ('close it by hand so its slot returns to the pool', also false after a confirmed lease). Fix: reword these messages to say the window closes and the slot returns only if it holds no durable lease, and otherwise needs the printed explicit release. No behavior change.

🔧 Fix applied.
1 info still open:

  • ℹ️ bin/fm-home-seed.sh:396 - A third acquisition path has no recorded-copy protection. acquire_treehouse_home runs treehouse get --lease without the project lock or the scan. A pre-upgrade paused task on the firstmate repo with a clean, unleased copy at origin/main can be handed to a newly seeded secondmate home if seeding happens before any crewmate spawn for that project runs the scan. This is noted only: the intent limits the requirement to 'either acquisition path' in spawn, and the exposure ends once a scan has leased those records. This file is not part of the change, so it does not block merge.
⚠️ **Test** - 3 infos
  • ℹ️ The verification plan's TMPDIR inside the run worktree makes tests/fm-secondmate-harness.test.sh fail with 'secondmate home cannot be inside the firstmate repo' (reported as 'split: no meta written'). This comes from the setup, not the product: the suite passes with TMPDIR outside the repository, so the plan's blanket TMPDIR rule should exclude this suite.
  • ℹ️ This machine has tasks-axi 0.2.3, below the 0.2.6 floor, which makes tests/fm-backend-t3code.test.sh fail at its teardown step with 'compatible tasks-axi is required'. The suite passes with a scratch tasks-axi 0.2.6 on PATH; the machine's install was not changed.
  • ℹ️ Current T3 builds fail Firstmate's capability gate: stable 0.1.6 and nightly 0.1.7-nightly.20261103.4106 both lack t3_thread_configuration and the t3_pending_request_* tools. This is separate from this change, but it blocks any live T3 backend use on those builds, and the documented 0.0.46-nightly.20261010.2935 build's sign-in also failed to return within 6 minutes.
  • Live validation: ✅ go - 11 of 12 scenarios driven live against the product
Scenario Result Live Evidence
Unpatched baseline: spawn refuses a copy edited by an outside writer, shell exit plus one empty Enter discards the edit, and the retry reuses that copy ✅ pass live paired-unpatched-318.txt, paired-unpatched-315.txt
Patched: the same refusal keeps the durable lease, shell exit plus one empty Enter leaves HEAD and the edit intact, and the retry uses a different copy ✅ pass live paired-patched-318.txt, paired-patched-315.txt
Adversarial: prune, plain return with stdin at EOF, and another task's spawn cannot reclaim the refused copy, while an explicit return --force makes it reusable ✅ pass live paired-patched-318.txt, paired-patched-315.txt
Interactive tmux path: a clean, unleased copy at origin/main recorded by a paused task in another registered home is leased to that task and not handed to a new spawn ✅ pass live rec-patched-default-tip.txt, rec-patched-default-tip-315.txt, rec-unpatched-default-tip.txt
Interactive tmux path: recorded copies with an unlanded commit or an existing lease stay untouched and keep the right holder ✅ pass live rec-patched-unlanded.txt, rec-patched-leased.txt, rec-unpatched-unlanded.txt, rec-unpatched-leased.txt
Herdr get --lease path: a recorded clean copy is protected before acquisition, a fresh spawn launches without a double-lease abort, and the slot-owner claim is written ✅ pass live herdr-patched.txt, herdr-unpatched.txt
Herdr dirty refusal keeps the lease and edit, names the explicit release, and the retry uses another copy ✅ pass live herdr-patched.txt
Adversarial: when protection cannot be confirmed after a Treehouse root move, spawn refuses, names the blocking record and copy, and acquires nothing ✅ pass live rootchange.txt
Spawn on real Treehouse v2.0.1 refuses before acquisition, and bootstrap reports it OUTDATED while v3.1.5 and v3.1.8 pass ✅ pass live old-th.txt, bootstrap.txt
The installer pin installs real Treehouse v3.1.5 with its checksum verified and lease support present ✅ pass live Installed v3.1.5 was then used for paired-patched-315.txt, rec-patched-default-tip-315.txt and lease-e2e-v3.1.5.txt
The real-Treehouse lease regression passes, including a symlinked pool root with a recorded copy ✅ pass live lease-e2e-v3.1.8.txt, lease-e2e-v3.1.5.txt
T3 acquisition path: a fresh T3 spawn protects a recorded copy, keeps its single lease and claims its slot on a real T3 server ⏸️ untested no I ran a disposable loopback T3 server with a scratch base dir and a scratch credential. Stable 0.1.6 and nightly 0.1.7-nightly.20261103.4106 failed Firstmate's capability gate because they lack t3_thr…
  • driver/paired.sh unpatched (f641b44b) and patched (5bcf2dc5) on unmodified Treehouse v3.1.8 and pinned v3.1.5: real bin/fm-spawn.sh, private tmux socket, marked lab home, bounded outside writer, exit plus one empty Enter, retry
  • Adversarial steps in the patched paired run: treehouse prune, plain treehouse return with stdin at EOF, a second task spawn, then treehouse return --force and a next spawn that reuses the released copy
  • driver/recorded.sh for default-tip, unlanded and leased modes, unpatched and patched, on v3.1.8, plus patched default-tip on v3.1.5
  • driver/herdr.sh through bin/fm-herdr-lab.sh in a throwaway fm-lab-* session on Herdr 0.9.5: recorded copy (patched and unpatched), no double lease, slot-owner claim, dirty refusal, retry
  • driver/rootchange.sh: a moved Treehouse root makes protection fail, and the refusal names the record and copy
  • driver/old-th.sh: spawn on real Treehouse v2.0.1 refuses before acquiring anything
  • driver/bootstrap.sh: FM_BOOTSTRAP_DETECT_ONLY=1 FM_BOOTSTRAP_NETWORK=skip bin/fm-bootstrap.sh from extracted copies of the target and base commits, against v2.0.1, v3.1.5 and v3.1.8
  • bin/fm-install-treehouse.sh installing v3.1.5 from the official release with checksum verification, and the base commit's installer fetching v2.0.1 as the old fixture
  • tests/fm-treehouse-lease-e2e.test.sh on real Treehouse v3.1.8 and v3.1.5
  • tests/fm-spawn-pool-base-freshen.test.sh, tests/fm-bootstrap.test.sh, tests/fm-polytoken-harness.test.sh
  • tests/fm-secondmate-harness.test.sh with TMPDIR outside the repository, and tests/fm-backend-t3code.test.sh with Python 3.13 and a scratch tasks-axi 0.2.6
  • driver/t3.sh live attempts against a disposable loopback T3 server: stable 0.1.6, nightly 0.1.7-nightly.20261103.4106, and documented 0.0.46-nightly.20261010.2935
  • Public evidence search for /Users, /private/var, +07:00 and default interactive shell: zero matches for all four
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@jjames27th-eng

Copy link
Copy Markdown
Contributor Author

CI: 18 of 20 checks pass. The two red jobs are not caused by this change.

I cannot re-run jobs on this repository. Re-running the failed jobs of https://github.com/kunchenguid/firstmate/actions/runs/40094081430 should clear serial 4; serial 1 may stay red until #7706 lands.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @jjames27th-eng for this, and for the clear write-up of the two red jobs. Losing a refused copy's uncommitted work on the very next retry is a real hole, and the real-machine cases in the body make that concrete.

What I checked on head 867ffe22 against main 3004ccb1:

  • fm-spawn.sh now requires treehouse lease support before any pooled acquisition. Under the project lock, it scans task records across the locally registered homes and durably leases any recorded copy that isn't leased yet. It leases each new slot to its task before the base refresh, and on a refusal it keeps the lease and prints a treehouse return --force recovery command. Teardown's slot-owner claim stays as the identity proof.
  • fm-install-treehouse.sh moves to v3.1.5. I checked all four pinned SHA256 values against the official kunchenguid/treehouse v3.1.5 release assets, and they match. Nothing touches .github/workflows, credentials or network paths, so I have no security concern.
  • CI (run 40094081430): you're right about both red jobs. Serial 4 is the known fm-watcher-lock "recovery drain after forced arm interruption" flake, and serial 1 is the 30-minute cap that fix(test): split fm-supervision-host so serial shards fit the job cap #7706 addresses.

Two things block it right now, and both are waiting on you:

  1. Merge conflicts. Since this run, main has moved (feat(bin): add an explicit-only T3 Code runtime backend #7518 landed), and GitHub now reports the PR as conflicting. Please rebase onto current main.
  2. Live validation. The no-mistakes attestation binds this head, but it carries no live-validation verdict, and the body doesn't either. The evidence is test-double and real-Treehouse CLI transcripts. When you re-raise, could you include a live run that shows a dirty-copy refusal followed by a retry landing in a different copy with the edits intact? A spawn through the product on a real pool would do. Please post the evidence or re-raise via git push no-mistakes so the attestation records it.

Heads-up on the decision path: I'd classify this as contract-class: new-default, not a restore. The refusal itself was already promised. But the fix changes every unconfigured pooled spawn: it adds a hard Treehouse floor (refuse without treehouse lease), a cross-home record scan that leases copies, and a lease that stays after a refusal until someone releases it by hand. So once it's rebased, green and live-validated, it goes to Kun for the merge decision rather than auto-merging. That's no reflection on the quality of the work. VISION.md: one captain: aligns (no new captain-facing noise; refusal text names the recovery) · authority: aligns (never discards without an explicit decision) · scripts: aligns (deterministic locking and leasing) · restart: aligns (durable lease survives restart, which is the point) · delegation: aligns ("unlanded work is never torn down") · vendor: cannot fully tell. It deepens the coupling to a newer Treehouse floor, which is Kun's call · scope: aligns.

@jjames27th-eng
jjames27th-eng force-pushed the fm/fm-spawn-dirty-pool-reset branch from 867ffe2 to c168eb9 Compare November 3, 2026 01:20
@jjames27th-eng jjames27th-eng changed the title fix(bin): protect pooled worktrees from reuse after spawn refusals fix(bin): retain Treehouse leases after refused spawns Nov 3, 2026
@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect Treehouse-backed spawn and pool reuse across local Firstmate homes.

Fix the custom-layout lease bypass before merging; refused edits can still be discarded in that configuration.

Reviews (2) · Last reviewed commit: "no-mistakes(document): Document recorded..." · Reviewed by Greptile

Comment thread bin/fm-spawn.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @jjames27th-eng for coming back to this with a full re-raise and real paired live runs. The unpatched/patched transcripts (shell exit plus one empty Enter, then a retry landing in copy 2 with copy 1's edit intact) are exactly the evidence I hoped for. I read head c168eb98 against main 78c69df2. The attestation binds this head with no skipped steps, live is go 7/8 with the T3 row honestly marked as untested for lack of a credential, quick checks pass, and the branch now merges cleanly. The installer pins are the same four v3.1.5 SHA256 values I checked against the official release last time; only a comment changed.

Waiting on you for one thing: the open Greptile P1 on bin/fm-spawn.sh ("Paused tasks share a copy"). I agree with it. This round drops the cross-home task-record scan on the grounds that Treehouse v2.3+ skips copies with unlanded work. But a paused task whose recorded copy is still clean at origin/main has no unlanded work, so treehouse get can hand that copy to a new spawn, and the new lease and .fm-slot-owner claim then take it over. That's a narrower version of the very loss this PR is fixing. My call, on the reviewer's recommendation: keep protecting every locally recorded copy under the project lock before either acquisition path runs (the scan from your earlier head did this), add a regression for a clean, unleased copy recorded by a paused task in another home, then reply on the thread and resolve it. A fresh git push no-mistakes with every step run will refresh the attestation and evidence for the new head.

The Full suite only runs once we add our label, so its red mark doesn't count against you. Please ignore the rebase request in my October note. Conflicts are ours to fix now, and there are none anyway. Contract-class stays new-default (a hard Treehouse v3 floor and leases that outlive a refusal on every pooled spawn), and the VISION read is unchanged. Because this changes the installer's pinned checksums, Kun will make the merge decision himself once your side is done.

Keep refused copies reserved until explicit return, require in-place Treehouse lease support, and pin CI to v3.1.5.

Reproduce detached-commit loss with real Treehouse and cover retained refusals and migrated secondmate leases.
…ixtures, missing CI Git identity, and the flaky remote launch deadline. All nine targeted suites and fast lint passed. Full lint analysis was stopped after stalling. Temporary files removed; five changed files remain for the outer executor
@jjames27th-eng
jjames27th-eng force-pushed the fm/fm-spawn-dirty-pool-reset branch from c168eb9 to 038bfe1 Compare November 3, 2026 06:54
@jjames27th-eng jjames27th-eng changed the title fix(bin): retain Treehouse leases after refused spawns fix(bin): keep refused Treehouse pool copies leased until explicit release Nov 3, 2026
Comment thread bin/fm-spawn.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @jjames27th-eng, this round does exactly what I asked. I read head 038bfe1e against main f641b44b. Under the project lock and before either acquisition path, spawn_protect_recorded_pool_copies now leases every unleased pool copy recorded by any local home, and it refuses with the record and copy named when it can't confirm that. test_recorded_secondmate_slot_is_never_reused covers the clean default-tip case along with the unleased and leased cases. The "Paused tasks share a copy" thread is resolved. The attestation binds this head with no skipped steps, live is go 11/12 (T3 honestly untested), quick checks pass, and it merges cleanly. I checked the four v3.1.5 installer SHA256 values again against the official kunchenguid/treehouse v3.1.5 release assets, and they all match.

On Greptile's new "Custom layouts skip lease protection" note, I agree with your reply, and so does Greptile, which withdrew it as out of scope. A templated worktree_path behaves exactly as it does on main, and supporting it belongs in a separate change to the shared pool-recognition path.

Waiting on you for one small thing: please mark that withdrawn "Custom layouts skip lease protection" thread as resolved, since it's the only open thread left. No code change or re-run is needed. The Full suite only runs once we add our label, so its red mark doesn't count against you. Contract-class stays new-default, and the VISION read is unchanged. This PR changes the installer's pinned checksums, so once that thread is resolved it goes to Kun, and he'll make the merge decision himself. That step will be waiting on Kun, not on you.

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