Skip to content

fix(bin): reject foreign clone-family worker allocations - #2

Open
Charliekirk-creator wants to merge 8 commits into
mainfrom
fm/firstmate-allocation-guard-owned-fork-republication
Open

Charliekirk-creator wants to merge 8 commits into
mainfrom
fm/firstmate-allocation-guard-owned-fork-republication

Conversation

@Charliekirk-creator

Copy link
Copy Markdown
Owner

Intent

Republish the exact reviewed clone-family allocation guard from upstream PR kunchenguid#3377 through the captain-owned fork https://github.com/Charliekirk-creator/firstmate, with guarded publication explicitly approved but no merge authority. Start the republication from the verified current captain-fork main, carry only the two reviewed commits (9888484 and c2e3ee8) or their exact patch relative to the verified source merge base 0866a77, and permit only conflict adaptations genuinely required by the older captain base, with every adaptation recorded and fully validated. The intended change is limited to the shared post-allocation Git common-directory guard, Treehouse and terminal-less Orca preservation behavior, relevant test-run ownership, architecture documentation, and the eight reviewed paths. Preserve the reviewed guarantees: reject a foreign Git common directory before worker launch; preserve every branch, HEAD, index, tracked, untracked, ignored, stash, tag, custom ref, allocation, worktree registration, and any existing endpoint; never clean, reset, delete, prune, force-return, or invent an unsafe quarantine; and keep the terminal-less Orca message truthful. Prove the final branch contains no unrelated upstream commits, files, or changes. Run the focused source-PR tests plus the complete applicable Firstmate lint and documentation checks, then review the complete diff against captain-fork main and stop if unrelated changes remain. Publish and open a PR only against Charliekirk-creator/firstmate:main, using the captain-owned fork as the actual push and PR target, and rerun CI on the rebased head. Do not publish another PR to kunchenguid/firstmate, merge anything, update either default branch, force-push an existing preserved branch, close or modify upstream PR 3377, delete any branch, or alter the original task copy.

What Changed

  • Validate Treehouse- and Orca-allocated worktrees against the requested project's absolute Git common directory before launching a worker.
  • Preserve mismatched allocations and existing endpoints in place, including terminal-less Orca worktrees, while reporting identifiers for guarded reconciliation.
  • Document the allocation boundary and add mixed-clone preservation coverage, test-family ownership, isolated batch configuration, and bounded timing adjustments.

Risk Assessment

✅ Low: The change is narrowly scoped, preserves the required allocation invariants, and exactly republishes the two reviewed patches with no source-verifiable defects found.

Testing

No baseline test command was supplied; targeted Treehouse, Orca, relaunch, batch, settling, base-freshness, and test-runner ownership checks succeeded, while manual CLI evidence demonstrated pre-launch refusal with complete preservation and truthful terminal-less Orca behavior. Provenance checks confirmed exact equivalence to the reviewed two-commit source range and only the eight approved paths; lint and documentation validation remain outside this assigned test phase.

Evidence: Treehouse mixed-clone refusal and complete preservation transcript

Source: Treehouse mixed-clone refusal and complete preservation transcript

=== End-user spawn request with a foreign Treehouse allocation ===
Requested Git common directory: /private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-common-dir.PTVtKi/requested-project/.git
Allocated Git common directory: /private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-common-dir.PTVtKi/foreign-clone/.git
Preserved precondition (branch/status/refs):
M  tracked-staged.txt
 M tracked-unstaged.txt
?? untracked-preserve.txt
!! ignored-preserve.txt
--- refs that must survive ---
refs/firstmate/preserved-custom
refs/stash
refs/tags/preserved-tag
--- fm-spawn output ---
error: Git common-directory mismatch after treehouse get: requested project '/private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-common-dir.PTVtKi/requested-project' uses '/private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-common-dir.PTVtKi/requested-project/.git', but allocated worktree '/private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-common-dir.PTVtKi/mixed-slot' uses '/private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-common-dir.PTVtKi/foreign-clone/.git'. Refusing before worker launch. No supported non-cleaning allocation return or quarantine operation is available, so the allocated local copy and any existing endpoint are preserved in place. Inspect firstmate:fm-mixed-common-dir-evidence and reconcile the mixed clone-family pool or provider through its guarded ownership path before retrying; do not force-return, clean, reset, or remove this allocation
Exit status: 1
--- provider/endpoint operations ---
tmux�send-keys�-t�@mixed�treehouse get�Enter
--- preservation verification ---
Before snapshot SHA-256: f888001d0fa48586b4516d8302c080a004b6936e550c9147540704bbf01c1388
After snapshot SHA-256:  f888001d0fa48586b4516d8302c080a004b6936e550c9147540704bbf01c1388
RESULT: REFUSED BEFORE WORKER LAUNCH; GIT STATE, ALLOCATION, AND ENDPOINT PRESERVED.
Evidence: Terminal-less Orca truthful refusal transcript

Source: Terminal-less Orca truthful refusal transcript

=== End-user Orca spawn receives a foreign worktree with no terminal ===
Task: fm-orca-terminal-less-evidence
Orca worktree id: wt-terminal-less
Terminal: <not allocated>
--- fm-spawn output ---
warning: /var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T//fm-evidence-orca-terminal-less.IfYlER/data/orca-terminal-less-evidence/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: Git common-directory mismatch after orca worktree create: requested project '/private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-orca-terminal-less.IfYlER/requested-project' uses '/private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-orca-terminal-less.IfYlER/requested-project/.git', but allocated worktree '/private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-orca-terminal-less.IfYlER/foreign-worktree' uses '/private/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-orca-terminal-less.IfYlER/foreign/.git'. Refusing before worker launch. No supported non-cleaning allocation return or quarantine operation is available, so the allocated local copy and any existing endpoint are preserved in place. Inspect task 'fm-orca-terminal-less-evidence', Orca worktree id 'wt-terminal-less' and reconcile the mixed clone-family pool or provider through its guarded ownership path before retrying; do not force-return, clean, reset, or remove this allocation
Exit status: 1
--- Orca operations ---
orca status --json
orca repo show --repo path:/var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-orca-terminal-less.IfYlER/requested-project --json
orca repo add --path /var/folders/l9/13blqg851n3bj8p1b_3lxxk00000gn/T/fm-evidence-orca-terminal-less.IfYlER/requested-project --json
orca worktree create --repo id:repo-foreign-family --name fm-orca-terminal-less-evidence --no-parent --setup skip --json
--- verification ---
HEAD before: 7862f8289db436a69a6d9dd686c8bc8eccab2fd4
HEAD after:  7862f8289db436a69a6d9dd686c8bc8eccab2fd4
RESULT: TRUTHFUL TERMINAL-LESS REFUSAL; NO TERMINAL CREATED, NO WORKTREE REMOVED, NO WORKER LAUNCHED.
Evidence: Reviewed-patch republication provenance

Source: Reviewed-patch republication provenance

=== Reviewed-patch republication provenance ===
Configured origin: https://github.com/Charliekirk-creator/firstmate.git
Captain base: a56a78ac431833381a265d28cbc9c5ab6094117d fix(bin): absorb turn-end wakes during bounded pane churn (#2877)
Target head: 2b365b82659d1522d8dd53f9f6af190169c657e3 no-mistakes(review): Expand ref preservation and terminal-less Orca coverage
Target commits after captain base: 2
--- source-to-target range equivalence ---
1:  9888484 = 1:  d291643 fix: reject foreign clone-family allocations
2:  c2e3ee8 = 2:  2b365b8 no-mistakes(review): Expand ref preservation and terminal-less Orca coverage
--- stable patch IDs (source then target for each reviewed commit) ---
9888484b0e7d15342bdb36b086fc81b2b87574ba e2c5bc05f1901847e0731066294419025c1b809e
d291643fec69b5b9556a474e81d37e4a18318268 e2c5bc05f1901847e0731066294419025c1b809e
c2e3ee8aa6da613e9865c5e70746c93f78928568 1a45b7f1f0214269c4798915b1f6f76bc16fbb10
2b365b82659d1522d8dd53f9f6af190169c657e3 1a45b7f1f0214269c4798915b1f6f76bc16fbb10
--- complete changed-path set against captain base ---
bin/fm-spawn.sh
bin/fm-test-run.sh
docs/architecture.md
tests/fm-backend-orca.test.sh
tests/fm-control-relaunch.test.sh
tests/fm-spawn-batch.test.sh
tests/fm-spawn-common-dir.test.sh
tests/fm-spawn-worktree-settle.test.sh

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.

  • bin/fm-test-run.sh tests/fm-spawn-common-dir.test.sh tests/fm-backend-orca.test.sh tests/fm-control-relaunch.test.sh tests/fm-spawn-batch.test.sh tests/fm-spawn-worktree-settle.test.sh
  • bin/fm-test-run.sh tests/fm-spawn-pool-base-freshen.test.sh
  • bin/fm-test-run.sh --check-coverage
  • bin/fm-test-run.sh --list --family backend-dispatch | grep -E 'fm-spawn-(common-dir|pool-base-freshen)\.test\.sh'
  • Manual fm-spawn.sh Treehouse mixed-clone allocation: captured the refusal, provider operations, and identical before/after Git-state snapshots.
  • Manual fm-spawn.sh --backend orca terminal-less mixed-clone allocation: captured truthful refusal output and verified no terminal, removal, launch, metadata publication, or HEAD change.
  • git range-diff 0866a770234502364c268a768cb7c66cc321c629..c2e3ee8aa6da613e9865c5e70746c93f78928568 a56a78ac431833381a265d28cbc9c5ab6094117d..HEAD plus stable patch IDs and changed-path inspection.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

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.

1 participant