Repository navigation
feat(bin): give each home its own treehouse worktree pool - #63
Merged
Merged
Conversation
Treehouse names a pool after the origin URL of the project. Homes that each hold their own clone of one project used one shared pool. Treehouse v2.3.0 gives an idle slot to any clone that asks, so a worker in one home could get a worktree of the clone of another home. Cleanup then refused the slot, or returned a slot that was not its own. fm-spawn.sh now runs `treehouse get` with TREEHOUSE_ROOT set to a root that is private to the home. fm_treehouse_home_root in fm-wake-lib.sh makes this root from the physical path of the home. The root is under ~/.treehouse/firstmate-homes/, not inside the home, so harnesses do not read the supervisor AGENTS.md of the home from a parent directory. No slot moves. A slot taken before this change keeps its recorded path. `treehouse return <path>` finds the pool of a slot from that path, so cleanup returns old and new slots. The cross-home project lock stays shared because old slots stay in the shared pool. Treehouse reads TREEHOUSE_ROOT from v2.2.0. Bootstrap now reports an older treehouse as MISSING, and the CI pin moves from v2.0.1 to v2.3.0. The new fm-treehouse.sh runs treehouse against the pool of the home, for example `fm-treehouse.sh <project-dir> status`.
fm_control_harness_supported returned from its loop at the first match. The printf that fed the loop could then write to a closed pipe. When SIGPIPE is ignored, as on CI runners, bash printed "printf: write error: Broken pipe" to stderr. tests/fm-quota-choose.test.sh captures stderr, so the stray line failed its error comparisons. The loop now reads the full list before it returns. This is the same fix as upstream Firstmate 5df1294 (kunchenguid#5389). tests/fm-extension-binding.test.sh gave crash recovery after a killed result.silent host only 400 polls of 10 ms. On a loaded CI shard the recovery took longer, and the test reported a wedged runner. The wait now uses a 20-second wall-clock deadline. This is below the 34-second budget of the section coordinator, so a real wedge still fails here.
BenWilcox8
force-pushed
the
fm/treehouse-pool-per-clone-p1
branch
from
November 11, 2026 03:14
aeef0ef to
6833d4b
Compare
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.
Intent
Later accepted firstmate requirement (2026-11-10, after GitHub Actions was re-enabled): checks ran on the PR and "Behavior portable serial 5" failed with
not ok - unmapped omp prefix returned: error: omp quota mapping covers only the openai-codex and claude-bridge prefixes: ollama/qwen3:8b. Instruction: read the failed job log, reproduce, find the real cause, decide whether it is caused by this change, an old test this change must update, or an unrelated flake (prove a flake with a re-run of the failed job); if a fix is necessary, make it on this branch and take it through no-mistakes again; do not rebase onto anything other than origin/main; report done when every GitHub check is green, or blocked with evidence. Findings: the captured error carried a second stderr line,bin/fm-control-lib.sh: line 68: printf: write error: Broken pipe. fm_control_harness_supported returned at the first match while its process-substitution feeder was still printing; with SIGPIPE ignored (as on CI runners) bash prints that diagnostic, and fm-quota-choose.test.sh compares captured stderr exactly. Reproduced locally only under concurrent load with SIGPIPE ignored (7 hits in 3,600 calls; 0 in 5,400 after the fix). The re-run of the failed job failed again (same test, and also fm-extension-binding.test.sh "inner host crash during result.silent wedged its runner before result.terminal"). Adding this PR's new test file shifted the CI shard partition so both timing-sensitive tests now run in shard 5, where every test from fm-extension-binding onward runs about 3x slower than the same tests on other PRs; that slowdown is not caused by this PR's code and its source is not identified here. Accepted fixes, both minimal and outside the treehouse feature: (1) port upstream Firstmate commit 5df1294 (kunchenguid#5389) exactly - fm_control_harness_supported reads the full harness list into a found flag before returning; behavior unchanged; (2) in tests/fm-extension-binding.test.sh, the crash-silent recovery wait changes from 400 polls of 10 ms to a 20-second wall-clock deadline (still polling every 10 ms and breaking as soon as the start process exits), chosen to stay below the section coordinator's 34-second budget so a genuinely wedged runner still fails with the specific message. The other fixed-iteration waits in that file are intentionally unchanged because they have not been seen failing.What Changed
fm-spawn.shnow runstreehouse getwithTREEHOUSE_ROOTset to a private root for each home. The newfm_treehouse_home_rootinfm-wake-lib.shmakes this root under~/.treehouse/firstmate-homes/<hash of home path>. This means two homes that each have their own clone of a project no longer share pool slots. The newbin/fm-treehouse.shruns treehouse commands (status,prune, ...) against that pool, and--print-rootprints the root. Slots from the old shared pool still return throughtreehouse return <path>.fm-bootstrap.shnow reportsMISSING: treehouseas an upgrade whentreehouse get --helpdoes not mentionTREEHOUSE_ROOT(before v2.2.0). The CI installer now pins Treehouse v2.3.0 with new checksums. The docs and the bootstrap-diagnostics and stuck-crewmate-recovery skills now describe per-home pools.fm_control_harness_supportednow reads the full harness list before it returns, so its feeder cannot print aBroken pipeerror when SIGPIPE is ignored. Infm-extension-binding.test.sh, the crash-silent recovery wait changes from 400 polls of 10 ms to a 20-second wall-clock deadline. Newtests/fm-treehouse.test.shcovers the per-home root and wrapper, and the existing tests now expect theTREEHOUSE_ROOTprefix and help text.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change matches the intent. The two CI flake fixes are present and minimal. The control-lib loop now reads all of its input before it returns, and its return value does not change. The crash-silent wait is now a 20s wall-clock deadline, which is below the 34s coordinator budget. In the per-home pool path, the root is resolved and passed with correct quoting under the same conditions that use it. Slot checks in spawn and teardown find the pool from the slot path, so they work for per-home slots and old shared-pool slots. No new defect was found.
Testing
I drove both flake fixes directly. I used temp copies of the base tree (692aa7b) and the fixed tree, with SIGPIPE ignored as on CI runners. Broken-pipe fix: - The direct CLI repro on base gave 306 bad stderr captures in 4,800 calls. Each bad capture had the CI linebin/fm-control-lib.sh: line 68: printf: write error: Broken pipe. - The full quota test file failed 32 of 72 runs on base, including the exact CI assertion. - The fixed tree gave 0 failures in 14,400 calls and 0 in 72 runs. - Harness accept/refuse results are identical on both trees. Extension-binding deadline: - The lifecycle-flow segment passes normally. - I slowed each node launch by 2-3 s while bash polling stayed at normal speed. This matches the CI pattern. Base then fails with the exact message "wedged its runner before result.terminal", and the fix passes (recovery took 9-11 s). - A simulated never-exiting runner still fails with that specific message after 20 s. The whole segment takes 24.6 s, under the 34 s coordinator budget. - Plain CPU oversubscription slows the old poll loop as much as the recovery, so base never failed that way. At 72 busy processes, recovery took 23-25 s: the 20 s deadline failed where base passed. That segment ran 60-80 s, far over the 34 s coordinator budget, so the aggregate test fails in that case either way. This is noted only, not a finding. Environment limits on this NixOS host: - python3 is not on the system paths, so I put it beside a temp copy of node. - The full aggregate extension-binding run still fails in its remote-activation lane. Remote jobs use a fixed child PATH without python3. The base tree fails identically, so the change does not cause it. Because of that, I could not drive the wedge through the coordinator path; I drove it at segment level. Regression: the branch's treehouse and pool-freshen tests pass. No UI surface is involved. Evidence is in CLI transcripts in the evidence dir, and all temp trees and processes were removed.bash tests/fm-treehouse.test.shwith real treehouse v2.3.0 andbash tests/fm-spawn-pool-base-freshen.test.sh: both passEvidence: Broken-pipe repro on base tree (CI error reproduced)
Source: Broken-pipe repro on base tree (CI error reproduced)
root=/tmp/fmbase calls=4800 mismatched_stderr=306 306 /tmp/fmbase/bin/fm-control-lib.sh: line 68: printf: write error: Broken pipeEvidence: Broken-pipe repro on fixed tree
Source: Broken-pipe repro on fixed tree
root=/tmp/fmfix calls=14400 mismatched_stderr=0Evidence: Repro harness script
Source: Repro harness script
Evidence: fm-quota-choose.test.sh with SIGPIPE ignored, base vs fixed
Source: fm-quota-choose.test.sh with SIGPIPE ignored, base vs fixed
fmbase: failed runs 32 / 72 (incl. 5x 'not ok - unmapped omp prefix returned: ...') fmfix: failed runs 0 / 72Evidence: Harness accept/refuse results unchanged
Source: Harness accept/refuse results unchanged
Evidence: Crash-silent recovery with slow node launches (CI pattern), base vs fixed
Source: Crash-silent recovery with slow node launches (CI pattern), base vs fixed
delay 2s: base elapsed 7s not ok - ...wedged its runner before result.terminal | fix elapsed 9s exit=0 delay 3s: base elapsed 6s not ok - ...wedged... | fix elapsed 11s exit=0Evidence: Simulated wedged runner still fails with specific message within budget
Source: Simulated wedged runner still fails with specific message within budget
crash-silent wait elapsed: 20s not ok - inner host crash during result.silent wedged its runner before result.terminal real 0m24.635sEvidence: Aggregate wedge run blocked by host-only remote lane failure
Source: Aggregate wedge run blocked by host-only remote lane failure
Evidence: CPU-load sweep (24/36 busy processes), base vs fixed
Source: CPU-load sweep (24/36 busy processes), base vs fixed
Evidence: Heavy CPU load (72 busy processes): segment exceeds coordinator budget
Source: Heavy CPU load (72 busy processes): segment exceeds coordinator budget
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.
bash tests/fm-treehouse.test.shwith real treehouse v2.3.0 andbash tests/fm-spawn-pool-base-freshen.test.sh: both passtrap '' PIPE; sigpipe-repro.sh <root> 48 100|300: the exact 'unmapped omp prefix'bin/fm-quota-choose.shcommand, 48 concurrent workers, base tree vs fixed treetrap '' PIPE; bash tests/fm-quota-choose.test.shx72 per tree (24 concurrent copies x3 rounds plus 24 busy CPU processes), base vs fixedbin/fm-quota-choose.sh --candidate <claude|agy|omp:ollama/qwen3:8b|bogus|:x|claude-extra|cla>plus directfm_control_harness_supportedcalls for all 13 harnesses and non-members, base vs fixedFM_EXTENSION_BINDING_SEGMENT=lifecycle-flow bash tests/fm-extension-binding.test.shon the fixed tree (python3 beside node in a temp tool dir)lifecycle-flow segment, base vs fixed, with each PATH-resolved node launch delayed 0.5/1/2/3 s (models CI: slow process start, fast bash polling)lifecycle-flow segment with a never-exiting start process (simulated wedge), standalone and through the aggregatebash tests/fm-extension-binding.test.shlifecycle-flow segment, base vs fixed, under CPU oversubscription of 24, 36 and 72 busy processes on 24 cores, with recovery-time instrumentationbash tests/fm-treehouse.test.sh(real treehouse v2.3.0, TREEHOUSE_ROOT unset) andbash tests/fm-spawn-pool-base-freshen.test.shas a branch regression check✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.