Repository navigation
fix(bin): refresh pooled Treehouse worktrees before launch - #18
Merged
Merged
Conversation
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
Port upstream kunchenguid#2116 into this fork so that before a crewmate launches in a pooled treehouse worktree, the worktree base is refreshed from origin and crews never start on stale code. Fast-forward only when safe: the worktree must be clean and have no unique local commits; never force, stash, or discard work; dirty or non-fast-forwardable pooled bases must be reported and skipped or refused without clobbering them. Preserve the worktree-isolation contract, add the colocated pooled-base regression test and required test-harness helper updates, mirror the docs architecture note, and do not refactor unrelated fm-spawn logic. Keep the existing OMP and Herdr fork changes intact. The feature must pass its regression and existing spawn, tangle, backend, lint, and documentation checks and ship through no-mistakes to a green PR held for captain merge. The known nondeterministic live-Herdr presentation concurrency failure is shared-session environment contention and is out of scope; do not chase it.
What Changed
Risk Assessment
✅ Low: Captain, the change is well-bounded and now satisfies the pooled Treehouse refresh, isolation, clean-worktree, and fast-forward-only invariants without affecting Orca, OMP, or Herdr behavior.
Testing
The targeted pooled-base regression, spawn/isolation paths, preserved OMP behavior, tangle guard, and affected backend coverage all passed; reviewer-visible CLI evidence was captured, and the only discovered test-harness defect was fixed and successfully retested.
Evidence: Pooled-base refresh and refusal transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed (2) ✅
bin/fm-spawn.sh:1737- The required invariant says “the worktree must be clean,” but cleanliness is checked only beforegit merge --ff-only. A fast-forward that changes a submodule gitlink, or apost-mergehook that writes a file, can leave the worktree dirty while HEAD still equalsexpected, allowing the worker to launch. Re-checkstatus --porcelaininside this shared freshening boundary after the merge and refuse launch if it is no longer clean.bin/fm-spawn.sh:2195- The intent scopes refreshing to “a pooled treehouse worktree” and forbids unrelatedfm-spawnchanges, but this condition also refreshes Orca-owned worktrees. A valid Orca spawn for a repository withoutoriginnow creates its worktree/terminal and then fails. Restrict this call to Treehouse-backed backends, or explicitly approve and test the Orca behavior expansion.bin/fm-spawn.sh:116- The edited usage header replaces the existing description of guarded secondmate pre-launch synchronization even though that behavior remains at lines 1498–1517. This makes--helpincomplete and conflicts with CONTRIBUTING.md’s requirement that script usage headers remain accurate. Restore the removed secondmate-sync description alongside the new pooled-worktree contract.🔧 Fix: Enforce safe pooled worktree refresh boundaries
1 warning still open:
docs/architecture.md:152- The intent scopes refresh to “a pooled treehouse worktree,” and line 150 distinguishes Orca-owned worktrees, but this note and the usage header atbin/fm-spawn.sh:118claim base freshening applies to every fresh ship/scout worktree. Sincebin/fm-spawn.sh:2205now correctly excludes Orca, narrow both descriptions to pooled Treehouse-backed worktrees.🔧 Fix: Scope pooled refresh documentation to Treehouse
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
FM_TEST_EVIDENCE=1 bash tests/fm-spawn-pool-base-freshen.test.shbash tests/fm-spawn-worktree-settle.test.shbash tests/fm-spawn-batch.test.shbash tests/fm-spawn-dispatch-profile.test.shbash tests/fm-tangle-guard.test.shbash tests/fm-backend-autodetect-smoke.test.shbash tests/fm-backend-orca.test.shManually verified the evidence transcript records refreshedHEAD == origin/main, preserved advanced content, dirty-worktree preservation, and actionable unreachable/default-branch refusals.Removed transient test directories created under/tmp; retained only the dedicated reviewer evidence.✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.