Repository navigation
fix(brief): identify firstmate's permanent clone structurally in ship brief isolation check - #9
Merged
Merged
Conversation
The claude harness prints its own "Primary working directory" banner for wherever it starts. A crewmate misread the brief's "primary checkout firstmate operates from" as referring to that banner and refused to branch inside a genuinely isolated worktree. Reword the isolation assertion to a structural test - firstmate's permanent clone lives under a home's projects/ directory on its default branch (attached HEAD), unlike a task worktree's detached HEAD - so it can't be confused with any harness-printed directory label. The refusal path for a genuine mis-launch is unchanged.
…worded brief
fm-tangle-guard.test.sh pinned the old blocked-status line and label
("launched in primary checkout") that bin/fm-brief.sh no longer emits
after the isolation wording was made structural. CI's portable-serial-4
shard caught the mismatch; local no-mistakes test step did not run this
file. Update the pin to the new text.
Owner
Author
|
Follow-up: CI's Behavior portable serial 4 shard caught a cross-file regression the local no-mistakes test step didn't run. |
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
Fix a false-positive isolation refusal in bin/fm-brief.sh's generated ship brief. Its phrase 'the primary checkout firstmate operates from' collided with the claude harness's own 'Primary working directory' session banner, so a careful crewmate refused to branch inside a perfectly good isolated worktree (observed 2026-08-19, cost a dispatch, would recur on every claude ship spawn). Reworded the isolation assertion to a STRUCTURAL test: firstmate's permanent clone lives under a firstmate home's projects/ directory checked out to its attached default branch, whereas a task worktree sits at a detached HEAD in a pool/managed path. The distinguishing wording avoids the bare colliding phrase 'primary working directory' in any casing. Guard safety is unchanged: a worker genuinely launched in the primary checkout still stops and appends the same blocked: status line - the fix removes the false positive without weakening the guard. Scope is wording plus its test only; did not restructure the brief, touch other generated sections, or alter bin/fm-spawn.sh's isolation mechanism. Extended tests/fm-brief.test.sh (existing pattern) with test_ship_isolation_instruction_avoids_harness_banner_collision, which asserts the isolation instruction is present, asserts the new structural distinguishing language (projects/ clone, detached HEAD) is present, and asserts the colliding phrase 'primary working directory' (any casing) is absent from the generated brief. Proved the test red against the old wording via git stash before implementing the fix, then green after. Searched bin/, .agents/skills/, and docs/ for other occurrences of the colliding phrase; found none elsewhere. shellcheck via bin/fm-lint.sh passed on both changed files; actionlint (workflow linting) was unavailable in this local sandbox so that portion of fm-lint.sh's default file-set run only ran in CI, not locally - a known local environment gap, not something newly introduced. Delivery mode: no-mistakes.
What Changed
bin/fm-brief.shto identify firstmate's permanent clone structurally — a default-branch, attached-HEAD checkout either under a firstmate home'sprojects/<repo>or, in a project-less self-repo domain, the home's own checkout — instead of by the phrase "the primary checkout firstmate operates from", which collided with the claude harness's "Primary working directory" session banner. The STOP path and itsblocked: ...status line are unchanged in effect, now worded asblocked: launched in firstmate's permanent clone, not an isolated worktree.test_ship_isolation_instruction_avoids_harness_banner_collisiontotests/fm-brief.test.sh, asserting the generated brief keeps the isolation instruction and blocked-status safety line, carries the new structural cues (projects/<repo>, self-repo domain, attached vs detached HEAD), and contains noprimary working directory/primary checkoutphrasing in any casing.docs/architecture.mdto describe the brief-side check as structural and to note thatbin/fm-brief.showns the exact wording.Risk Assessment
✅ Low: The change is confined to prompt wording in one generated brief section plus its test; the round-1 finding is genuinely addressed (both the projects/ and self-repo checkout shapes are now positive structural stop conditions, and the vacuous assertions were replaced by a negative regex that is truly red against the old wording), with no behavioral or safety regression - the blocked: status path is preserved.
Testing
I ran the targeted fm-brief test suite (all pass, including the new isolation-wording case), proved that case red against the base commit's wording and green against the fix, and then generated a real no-mistakes ship brief and read its rendered Setup section exactly as a crewmate would receive it — the isolation assertion is now structural (projects/<repo> clone or self-repo home checkout, attached HEAD on default branch, contrasted with the task worktree's detached HEAD), the colliding phrase is absent in any casing, and the blocked-status STOP instruction is intact. This is a generated-prompt text change with no rendered UI surface, so the reviewer-visible artifact is the generated brief excerpt rather than a screenshot. One note beyond the change's scope: the phrase "primary checkout" still appears widely in bin/ source comments and docs/ (e.g. docs/architecture.md:171 describing this very instruction), so the intent's "found none elsewhere" holds for agent-delivered brief text but not for the repo at large; none of those are delivered to a crewmate, so nothing here needs changing.Evidence: Generated ship brief — Setup/isolation section (end-user surface)
Source: Generated ship brief — Setup/isolation section (end-user surface)
# Setup You are in a disposable git worktree of some-proj, at a detached HEAD on a clean default branch. Verify isolation before anything else, by structure, not by any directory label a harness banner prints - that label names where the harness started, not which checkout this is. Runpwd -Pandgit rev-parse --show-toplevel; both must resolve to the disposable task worktree you were launched in, such as a treehouse pool path or an Orca-managed worktree, sitting at a detached HEAD. Firstmate's own permanent clone is different in kind: it always sits on its default branch at an attached HEAD, never detached. In the common case it lives under a firstmate home'sprojects/<repo>directory; in a project-less self-repo domain there is no such clone and the firstmate home is itself that checkout, its own repository root on its default branch. The path check is authoritative:git rev-parse --git-dirandgit rev-parse --git-common-dircan help inspect the repo, but they do not prove you are outside firstmate's permanent clone. If the top-level path sits under a firstmate home'sprojects/<repo>clone on its default branch, or is a firstmate home's own checkout on its default branch, or is otherwise not the detached-HEAD worktree you were launched in, STOP - do not branch or commit here - appendblocked: launched in firstmate's permanent clone, not an isolated worktreeto the status file and stop. 1. First action: create your branch:git checkout -b fm/demo-shipEvidence: Collision check on the generated brief
Evidence: Regression red/green proof
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-brief.sh:458- The stop condition was narrowed from "the top-level path is the primary checkout" to "sits under aprojects/clone on its default branch". For a project-less domain, fm-brief.sh:202 states the subject repo is "the firstmate repo this home lives in, so it needs no separate clones underprojects/" — that permanent checkout is NOT under projects/, so the new structural cue does not describe it. Safety is not lost (the residual "or is not the worktree you were launched in" clause still triggers a stop), but the primary distinguishing test the intent relies on is inapplicable to the self-repo case, weakening the signal exactly where a firstmate-repo ship worker runs. Consider adding the home-root firstmate clone alongside the projects/ clone as an attached-HEAD permanent checkout.tests/fm-brief.test.sh:785- The headline assertiongrep -qi "primary working directory"never failed against the old wording — the pre-fix text said "primary checkout", not "primary working directory" — so it is a vacuous guard that cannot regress-detect the reported bug. Likewiseassert_grep "detached HEAD"already matched pre-fix via the Setup line above. Only theprojects/assertion was actually red. The test is still net-useful as a lock against reintroducing the banner phrase, but its red-before/green-after evidence rests on one assertion, not the three claimed.🔧 Fix: cover self-repo shape in ship brief isolation cue
2 infos still open:
tests/fm-brief.test.sh:775- Three of the new assertions match long verbatim sentences from the prompt source ("not by any directory label a harness banner prints", "project-less self-repo domain", "or is a firstmate home's own checkout on its default branch"). The generated brief is a legitimate generated-output contract, so grepping it is allowed, but pinning whole sentences means any behavior-preserving rewording of the instruction breaks the test while the real contract (structural cue present, banner-colliding label absent) is unchanged. The genuinely load-bearing assertions are the negativeprimary (working directory|checkout)regex and the blocked-status line; the structural cues would be better asserted on short invariant tokens (e.g.projects/<repo>,attached HEAD,detached HEAD) as already done in the other two checks.tests/fm-brief.test.sh:793- The regression guard forbidsprimary (working directory|checkout)anywhere in the generated brief, which is broader than the intent's stated forbidden phrase ('primary working directory' in any casing). It is currently green and does capture the old wording (which said "primary checkout"), so this is the right red-before/green-after guard - just noting that it also bans an unrelated future use of "primary checkout" elsewhere in the ship brief.✅ **Test** - passed
✅ No issues found.
bash tests/fm-brief.test.sh— full fm-brief suite, all cases pass including the newtest_ship_isolation_instruction_avoids_harness_banner_collisionRed/green proof: restoredbin/fm-brief.shfrom base commit ecb59e6 and re-ran the suite — new test reportednot ok - brief-isolation-e1: isolation instruction must tell the worker to verify by structure, not by a harness banner's directory label; restored the fix and it passesManual end-user generation:FM_HOME=/tmp/nm-brief-home bin/fm-brief.sh demo-ship some-proj --mode no-mistakesand inspected the rendered# Setupsection of the produced brief.md as a crewmate would receive itgrep -inE "primary (working directory|checkout)" brief.mdon the generated brief → no matches (collision removed at the delivered-prompt level)Verified the blocked-status safety line survives in the generated output:blocked: launched in firstmate's permanent clone, not an isolated worktreegrep -rlnE "primary (checkout|working directory)" tests/to confirm no other brief-text test depends on the old wording✅ **Document** - passed
✅ No issues found.
⏭️ **Lint** - skipped
✅ **Push** - passed
✅ No issues found.