fix(bin): isolate treehouse worktree pools per firstmate home - #19
Closed
mehulbhagwani wants to merge 9 commits into
Closed
mehulbhagwani wants to merge 9 commits into
mehulbhagwani wants to merge 9 commits into
Conversation
Treehouse keys a worktree pool by the repository's resolved origin rather than by the clone, so every home holding its own clone of one repository allocated from a single shared pool. Homes competed for the same numbered slots, and a returned slot read free while its checkout was still a linked worktree of another home's clone; fm-spawn.sh's isolation assertion then refused it and the task stopped until a human released the slot from the home that owned it. Derive a per-home worktree root from the home's own resolved path and pass it to both acquisition sites, so two homes never see each other's slots. Returns stay flagless on purpose: treehouse resolves a return's pool from the worktree path it is handed, so every worktree already leased under the previously shared root stays returnable and nothing is migrated. Bootstrap now probes the global --root flag alongside the durable lease, and the CI treehouse pin moves to v2.3.0 because v2.0.1 has no such flag.
… treehouse Adding the global --root flag and the second capability probe changed two things the suites pin: the acquire command sent to a worker's shell, and what a fake treehouse must advertise to be accepted. Match the acquire around its root rather than pinning the bare command, so the assertions stay meaningful instead of passing because the old spelling disappeared, and teach the stubs that --root precedes the subcommand. The bootstrap suite gains the has-the-lease-but-no-root case beside its existing lease case, and a both-present case so neither probe can pass for the other's reason.
Treehouse keys a worktree pool by the repository's resolved origin rather than by the clone, so every home holding its own clone of one repository allocated from a single shared pool. Homes competed for the same numbered slots, and a returned slot read free while its checkout was still a linked worktree of another home's clone; fm-spawn.sh's isolation assertion then refused it and the task stopped until a human released the slot from the home that owned it. Derive a per-home worktree root from the home's own resolved path and pass it to both acquisition sites, so two homes never see each other's slots. Returns stay flagless on purpose: treehouse resolves a return's pool from the worktree path it is handed, so every worktree already leased under the previously shared root stays returnable and nothing is migrated. Bootstrap now probes the global --root flag alongside the durable lease, and the CI treehouse pin moves to v2.3.0 because v2.0.1 has no such flag.
…ends.md after dedup
…ide firstmate homes
…ocs already accurate
Owner
Author
|
Closing this fork-side PR; the validated change belongs on kunchenguid#4932. |
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
Upstream PR kunchenguid#4932 (fix: isolate treehouse pools per home, so each firstmate home gets its own Treehouse worktree pool root and roots inside a firstmate home are rejected) is focused on that fix and mergeable, but it is 7 commits behind Kun's main, and Kun's reviewer needs a clean current tip with a matching no-mistakes validation record before approving workflows and considering a merge.
Lift the build phase for this (bring the upstream Firstmate PRs up to Kun's bar so they can merge).
What Changed
tests/fm-treehouse-home-root.test.shandtests/fm-treehouse-pool-isolation-live-e2e.test.sh.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The PR's actual scope (fm_treehouse_home_root derivation, its two call sites in fm-home-seed.sh and fm-spawn.sh, the bootstrap capability probe, and the treehouse CI pin bump) is well-bounded, matches the stated intent exactly, is guarded against nested-home path collisions, and is backed by tests that exercise real commands/derivations rather than source-text matching; the remaining bulk of the diff (fm-path-lib.sh, recovery-marker rework, claude --add-dir grant, etc.) is pre-existing work pulled in by rebasing onto Kun's main, not new work introduced by this change.
Testing
Ran the targeted live/unit tests that exercise this branch's actual behavior changes (per-home Treehouse pool root derivation, concurrent acquisition, interactive acquire, legacy-root return compatibility, and the fork-free path/epoch/stat helpers) directly against the real treehouse v3.1.0 binary and real git; every fix-specific assertion passed. The one failure encountered is a vendor-baseline sanity check in fm-treehouse-pool-isolation-live-e2e.test.sh whose own comments anticipate exactly this ("re-derive this guard against the new behavior") — it is asserting that the installed treehouse still exhibits the pre-fix collision bug, which it no longer does on this machine's v3.1.0. This is the same untested/declined vendor-baseline item recorded from the prior test round, not a new regression. Did not run the full bootstrap/spawn/secondmate/watch regression suites (broad, long-running, previously flagged as out of scope for targeted validation and at risk of the same budget timeout already declined in round 1).
treehouse getenters a worktree under the home's own derived rootPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
treehouse getenters a worktree under the home's own derived rootbash tests/fm-treehouse-home-root.test.shbash tests/fm-treehouse-pool-isolation-live-e2e.test.sh (partial run, see scenario notes)bash tests/fm-fork-free-helpers.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.