Repository navigation
fix(bin): launch crewmates under their harness's own approval and sandbox controls - #3384
npayette84 wants to merge 21 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (5): Last reviewed commit: "no-mistakes: apply CI fixes" | Re-trigger Greptile |
| @@ -500,7 +500,7 @@ test_cursor_threads_model_workspace_and_omits_effort_axis() { | |||
| expect_code 0 "$status" "cursor spawn with a model-qualified reasoning class should succeed" | |||
| assert_meta_profile "$HOME_DIR/state/$id.meta" cursor cursor-grok-4.5-high high | |||
| launch=$(cat "$LAUNCH_LOG") | |||
| assert_contains "$launch" "--trust --yolo --model 'cursor-grok-4.5-high' --workspace '$WT_DIR'" \ | |||
| assert_contains "$launch" "--trust --auto-review --sandbox enabled --model 'cursor-grok-4.5-high' --workspace '$WT_DIR'" \ | |||
There was a problem hiding this comment.
Harness flags lack runtime coverage
These updated tests only inspect command text, while their test doubles accept arbitrary arguments. If a supported Claude or Cursor installation rejects or handles the new controls interactively, the suites still pass while real crewmates fail to start or stall.
Knowledge Base Used: Restore direct agent launch templates
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07f9846966
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| else | ||
| printf '%s' 'codex __MODELFLAG____EFFORTFLAG__--dangerously-bypass-approvals-and-sandbox -c "notify=[\"bash\",\"-c\",\"touch __TURNEND__\"]" "$(__OPINPUT__ encode launch-brief < __BRIEF__)"' | ||
| printf '%s' 'codex __MODELFLAG____EFFORTFLAG__-s workspace-write -a never -c "notify=[\"bash\",\"-c\",\"touch __TURNEND__\"]" "$(__OPINPUT__ encode launch-brief < __BRIEF__)"' |
There was a problem hiding this comment.
Grant Codex the required external writable roots
Captain, when an ordinary ship or scout uses Codex, workspace-write limits writes to the task worktree and temporary directories, but the generated brief requires status writes under $FM_HOME/state/, scout reports under $FM_HOME/data/, and ship operations such as git add must update the linked worktree's common Git directory outside the worktree. Because -a never prevents approval or escalation, these workers cannot report completion, and ship workers cannot stage or commit, so Codex tasks wedge; grant the narrow supervision and Git roots before enabling this sandbox.
AGENTS.md reference: AGENTS.md:L285-L286
Useful? React with 👍 / 👎.
|
Speaking as Kun's firstmate: triage on HEAD Contract-class: new-default. Unconfigured spawn on main today launches Claude with Attestation: MISSING (no bound no-mistakes raise / Pipeline section on this HEAD). VISION (short): aligns with Authority (stops assuming full bypass consent) and fleet-outlives-vendor (uses each harness's own controls); Scope/Delegation stay scripts-owned launch composition. Resist-angle: new-default autonomy flip needs an explicit captain decision once otherwise ready — do not infer consent from "safer". Action for author: please re-raise this HEAD through Waiting on: author (attestation) + CI. No Firstmate flag yet — new-default only escalates when green CI, safe review, and attestation MATCH leave only the captain decision. No merge. |
07f9846 to
5f4af7d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f4af7d9d6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if fm_control_harness_family "$harness" >/dev/null 2>&1 && | ||
| ! fm_control_harness_supports_kind "$harness" "$kind" "$grant"; then |
There was a problem hiding this comment.
Detect Cursor behind env wrappers
Captain, when a raw launch command starts with env, such as env FOO=1 cursor-agent ..., fm-spawn.sh derives the harness as env; this family check then skips the new unattended-Cursor refusal and launches without any --cursor-exemption. Normalize common command wrappers before applying this gate, or refuse wrapped Cursor commands, so the documented Cursor bar cannot be bypassed.
AGENTS.md reference: AGENTS.md:L198-L201
Useful? React with 👍 / 👎.
| @@ -1268,7 +1402,7 @@ launch_template() { | |||
| # inherited CLAUDECODE cannot outrank cursor's own marker in a process that | |||
| # only reads the environment. Cursor exposes no effort flag, so the shared | |||
| # effort axis is deliberately omitted and stays in task metadata only. | |||
| cursor) printf '%s' 'env -u CLAUDECODE -u PI_CODING_AGENT -u GROK_AGENT -u FM_PI_HARNESS -u CURSOR_INVOKED_AS __CURSORBIN__ --trust --yolo __MODELFLAG__--workspace __WORKTREE__ "$(__OPINPUT__ encode launch-brief < __BRIEF__)"' ;; | |||
| cursor) printf '%s' 'env -u CLAUDECODE -u PI_CODING_AGENT -u GROK_AGENT -u FM_PI_HARNESS -u CURSOR_INVOKED_AS __CURSORBIN__ --trust --auto-review --sandbox enabled __MODELFLAG__--workspace __WORKTREE__ "$(__OPINPUT__ encode launch-brief < __BRIEF__)"' ;; | |||
There was a problem hiding this comment.
Grant Cursor access to required lifecycle paths
Captain, every exempted Cursor ship or scout still launches with --sandbox enabled, while this change's own verification notes that writes outside --workspace are denied. The generated brief requires status appends under $FM_HOME/state/, scout reports under $FM_HOME/data/, and a ship's linked-worktree Git operations update the common Git directory outside the task worktree, so these otherwise-supported Cursor tasks cannot report completion and ships cannot commit; grant those narrow roots or stop advertising exempted Cursor workers as functional.
AGENTS.md reference: AGENTS.md:L90-L95
Useful? React with 👍 / 👎.
|
Speaking as Kun's firstmate: re-triage on newer activity. HEAD is now Contract-class: new-default. Unconfigured spawn on main Attestation: MATCH — body VISION (short): aligns with Authority (stops assuming full-bypass consent; Cursor exemption is per-invocation, charset-bounded, not env-inherited; Waiting on: CI on this HEAD. No merge. No Firstmate flag yet — new-default only escalates when green CI, green no-mistakes, MATCH attestation, and safe review leave only the captain decision. After CI is green this remains a captain-decision hold, not an auto-merge. Keep #3385 stacked; landing this alone puts Codex crewmates in the denied-roots state that #3385 restores. |
995a555 to
ef908e3
Compare
Launch Claude with --permission-mode auto, Codex with -s workspace-write -a never, and Cursor with --auto-review --sandbox enabled, instead of the three full-bypass flags (--dangerously-skip-permissions, --dangerously-bypass-approvals-and-sandbox, --yolo). A crewmate now runs under its harness's own approval, review, and sandbox controls rather than with them switched off. Codex's workspace-write confines writes to the task worktree plus /tmp and $TMPDIR. That is the intended blast radius, but it also denies the supervision paths a crewmate's contract needs outside its worktree. Granting those back narrowly is a separate, independently reviewable change and is deliberately not bundled here. Refreshes the launch expectations in the three suites that assert the composed command, and the Cursor adapter reference rows. Other tracked uses of the bypass flags are one-off CLI invocations in guard docs and live probes, not spawn output, and are left untouched.
…mpting launch, pin claude auto mode
Supersedes an aborted fix round that would have made an auto-detected cursor silently fall back to another adapter. Silently substituting a different tool changes which adapter runs the captain's work without saying so, which is harder to notice than a refusal. The bar now holds however cursor was selected, explicit or inherited, and the refusal names the exact remedy: set config/crew-harness to a verified adapter, or add an eligible crew-dispatch profile. Firstmate does not pick one on the captain's behalf. The two exemption grants are no longer interchangeable across relaunch. envelope:<name> describes a mechanically proven outer isolation envelope that still governs the replacement agent, so it is inherited and automatic recovery keeps working. `attended` asserts a person is in the pane right now; the captain who attested may have left long before stuck-worker recovery relaunches, so inheriting it would let one attestation authorize unlimited unattended launches. It is never inherited. A cursor exemption is refused outright on a non-cursor harness rather than recorded, so no stale grant can sit in a task's metadata waiting to authorize a later relaunch onto cursor. Remote secondmate launches forward only an envelope grant, through self-describing arguments whose compatibility degradation is stated in the code: an older host misbinds the token and fails validation there, and a cursor secondmate reaching fm-spawn without a grant is refused by the bar. Both paths fail closed. An attended grant cannot describe a worker on another host and is refused for a remote launch. Bootstrap now diagnoses a cursor crew-dispatch rule instead of validating clean and failing later at spawn, since those rules resolve the harness for crewmate and scout spawns and both are barred. Also adds a contains mode to the bootstrap row runner with a guard that fails on an unknown mode; the previous case statement let an unrecognized mode pass vacuously.
…lign guards and docs
…cept legacy carrier
…and recovery docs
…, validate wire grant
… share grant owner
ef908e3 to
09211bc
Compare
|
Superseded: these docs are moving onto the LVX-4883 working branch instead of shipping separately. |
|
Superseded - these documentation changes are moving onto the LVX-4883 working branch instead of shipping separately. Please close. |
Intent
Harden Firstmate's crewmate launch defaults so a spawned worker runs under its harness's own approval, review, and sandbox controls instead of with them switched off, and solve unattended network, write, and prompt behavior for Codex, Cursor, and Claude in this one reviewed change. This is the first of two deliberately split PRs; the narrow Codex writable-roots grant is a separate stacked PR and must NOT be pulled forward into this one.
Launch posture: Claude uses --permission-mode auto with CLAUDE_CODE_DISABLE_FAST_MODE=1; Codex uses '-s workspace-write -a never' plus an explicit sandbox_workspace_write.network_access grant; Cursor uses '--trust --auto-review --sandbox enabled'.
Captain rulings, all explicit and all in scope - do not flag them as undeclared scope and do not revert them:
Codex network. workspace-write defaults network_access to false and Firstmate never set it, so on a default machine a codex worker could not push, use gh, or install dependencies. The grant is now explicit. Write confinement stays intact; the full-bypass flag was NOT restored.
Cursor. --auto-review enforces the sandbox but prompts, and --force never prompts but was MEASURED to defeat --sandbox enabled while being a documented alias of the --yolo it replaced. Shipping --force was refused as false hardening. Cursor therefore keeps real filesystem confinement and is BARRED from every ordinary unattended worker kind: ship, scout, and secondmate. The bar holds however cursor was selected, EXPLICIT OR INHERITED from runtime auto-detection. An unconfigured cursor-hosted home is stopped with an exact instruction to set config/crew-harness or add an eligible crew-dispatch profile; Firstmate never silently substitutes another tool. This is a deliberate refusal, not a regression.
Cursor exemptions. The only opt-in is a per-invocation --cursor-exemption naming 'attended' (a person is in the pane) or 'envelope:' (a named, mechanically proven outer isolation envelope such as the approved routing benchmark). It is never ambient and never inherited from the environment. Across relaunch, an envelope grant IS inherited because it describes a durable property that still governs the replacement agent, while an attended grant is NEVER inherited because the person who attested may be gone and firstmate's own stuck-worker recovery relaunches unattended. A cursor exemption is refused on a non-cursor harness rather than recorded, so no stale grant can later authorize a relaunch onto cursor. Remote secondmate launches forward only an envelope grant, through self-describing arguments whose compatibility degradation is stated in code and fails closed in both directions; attended is refused for a remote launch because it cannot describe a worker on another host.
Claude. Only CLAUDE_CODE_DISABLE_FAST_MODE=1 was verifiable, and unverified levers were deliberately rejected rather than cargo-culted. The captain KNOWINGLY ACCEPTS the residual risk that server-controlled triggers (plan, model, settings, classifier transcript) can still degrade auto mode and strand an unattended worker; that residual risk is documented in operator guidance rather than coded away. Documented residual risk is the accepted outcome, not a defect.
Operator guidance was refreshed across the adapter references, AGENTS.md, docs/configuration.md, and docs/agent-control.md, and bootstrap now diagnoses an ineligible cursor crew-dispatch rule instead of validating clean and failing at spawn.
An earlier fix round that would have made auto-detected cursor silently fall back to another adapter was explicitly invalidated by the captain, aborted through the supported abort command, custody recovered through the structured next action, and never committed. Do not reintroduce any silent-fallback or adapter-substitution behavior.
Repo conventions: one full sentence per line in tracked Markdown, plain dashes not em dashes, shellcheck-clean bin scripts, no agent co-author, and tests must exercise behavior through executable interfaces rather than asserting implementation source bytes.
What Changed
claudelaunches with--permission-mode autoplusCLAUDE_CODE_DISABLE_FAST_MODE=1(replacing--dangerously-skip-permissions),codexwith-s workspace-write -a neverand an explicit-c sandbox_workspace_write.network_access=truegrant (replacing--dangerously-bypass-approvals-and-sandbox, since workspace-write also confines egress and would otherwise breakgit push,gh, and dependency installs), andcursorwith--trust --auto-review --sandbox enabled(replacing--yolo).grokis deliberately untouched.bin/fm-control-lib.shgains a shared admissibility layer (fm_control_launch_refusalcomposed fromfm_control_harness_supports_kind,fm_control_cursor_exemption_valid,fm_control_cursor_exemption_inherited, and friends) that now owns the former muse-secondmate refusal and bars cursor from ship, scout, and secondmate spawns however cursor was selected. The only way past it is a per-invocation--cursor-exemption attended|envelope:<name>, recorded instate/<id>.metaand echoed on the success line.bin/fm-spawn.sh,bin/fm-control.shrelaunch (asked before the old agent is stopped, so a refusal cannot strand a task), and the remote secondmate path all ask that one function. An envelope grant is inherited across relaunch and secondmate liveness recovery;attendednever is, and a grant on a non-cursor harness is refused rather than recorded.traceparent:/exemption:trailing arguments that fail closed on both sides of a version skew;bin/fm-bootstrap.shnow reports aCREW_DISPATCHadvisory when a crew-dispatch rule names cursor, instead of validating clean and failing later at spawn. Operator guidance was refreshed across the harness adapter references,AGENTS.md,docs/configuration.md, anddocs/agent-control.md, including the accepted residual risk that server-side triggers can still drop claude's auto mode back to prompting. Tests cover the launch flags, the exemption grammar, inheritance and non-inheritance, the wire contract, and the bootstrap advisory; a pre-existing bash 3.2 empty-array crash in the remote home seed is fixed along the way.Risk Assessment
Testing
I reproduced the round-1 defect exactly as reported against the pre-fix file and confirmed the fixed file gets past it: before, a --no-projects seed died at the empty-array expansion and exited 0 because bash 3.2's EXIT trap status masks the failure, so it looked like a silent success that provisioned nothing; after, the loop is skipped and the seed reaches the first real remote step and fails honestly with exit 1. Because the fix is in an otherwise untouched production script, I checked it is not just satisfying the new test - the pre-existing tests/fm-remote-secondmate-lifecycle-e2e.test.sh, which died at the same call, now runs green, and the branch's new tests/fm-remote-secondmate-trace-context.test.sh executes on stock macOS bash for the first time, so the remote cursor wire boundary that round 1 could only verify by hand is now machine-verified in both compatibility directions. I then re-ran the six suites covering the intent itself (launch posture for claude/codex/cursor, the cursor unattended bar across ship/scout/secondmate, exemption grant validity and relaunch inheritance, bootstrap's ineligible-cursor-rule diagnosis) and all passed with no gate skips. Evidence is a before/after CLI transcript plus the named wire assertions the fix unblocked; the end-to-end launch transcript and vendor flag corroboration captured last round at 8e6b1f9 remain accurate, since the only commit since touches the seed script and no launch path. No UI surface is involved in this change, so no visual artifact applies.
Evidence: bash 3.2 remote seed crash: before/after CLI transcript, plus the remote wire coverage the fix unblocked
Source: bash 3.2 remote seed crash: before/after CLI transcript, plus the remote wire coverage the fix unblocked
Evidence: Hardened crewmate launch defaults: end-to-end CLI transcript (captured at 8e6b1f9; launch paths unchanged since)
Source: Hardened crewmate launch defaults: end-to-end CLI transcript (captured at 8e6b1f9; launch paths unchanged since)
Evidence: Vendor CLI flag corroboration for the codex/cursor/claude launch flags
Source: Vendor CLI flag corroboration for the codex/cursor/claude launch flags
Evidence: Targeted suite summaries
Pipeline
Updates from git push no-mistakes
... (8 earlier update rounds omitted to keep the PR body within GitHub's 65536-char limit; full history is in the run log.)
🔧 Fix: unify pre-stop and launch refusal behind one predicate
3 issues (1 warning, 2 infos) still open:
bin/fm-control-lib.sh:261- The new composite predicate's contract is stated as absolute - "Composing every launch-admissibility rule here means a rule added for the launch path is automatically enforced pre-stop and the two cannot drift" (bin/fm-control-lib.sh:250-252), echoed at bin/fm-control.sh:684-687 ("fm_control_launch_refusal composes EVERY launch-admissibility rule, so this cannot ask a narrower question than the launch will") and at bin/fm-spawn.sh:1504-1509. It does not compose every launch-admissibility rule. The launch owner still refuses AFTER the pre-stop point, at bin/fm-spawn.sh:1517 (resolve_pi_executable-> "pi executable not found on PATH"), bin/fm-spawn.sh:1533 (fm_cursor_resolve_binary-> exit 1), and bin/fm-spawn.sh:1537 ("Cursor model '<m>' is not available from '--list-models'"). All three sit below thefm_control_launch_refusalcall at :1510, andresolve_relaunch_profileresolves TARGET_MODEL (bin/fm-control.sh:700-710) without consulting any of them. Concrete failing sequence, verified by reading the flow:bin/fm-control.sh t1 relaunch --harness pi --note non a live task on a host with nopion PATH ->fm_control_harness_supported pipasses (:664),fm_control_launch_refusal pi ship ''returns 0,do_exitstops the agent (:869),fm-spawn.sh --relaunchexits 1 at :1517,do_relaunchdies with "the replacement agent for t1 could not be launched on pi" and the task is left with no agent. The same shape is now reachable on cursor too, because the relaunch verb accepts the grant:relaunch --harness cursor --cursor-exemption attended --model <id-not-in-catalog> --note nstrands the task at :1537. These three refusals predate this branch, so this is not a regression in behavior - it is the newly added claim that is wrong, and that claim is exactly what would stop the next reader from looking. Minimum honest fix: narrow the statement at all three sites to say it composes every HARNESS/KIND/GRANT admissibility rule and name the executable-resolution and model-catalog refusals as still living past the pre-stop boundary. Closing it for real is cheap too, sincefm_cursor_resolve_binary,resolve_pi_executable, and the catalog probe are all side-effect-free pre-checks that could be asked from the same shared question.bin/fm-spawn.sh:542-spawn_remote_secondmatestill asks the two constituent predicates in sequence -fm_control_cursor_exemption_appliesat bin/fm-spawn.sh:542 andfm_control_harness_supports_kindat :548 - rather than thefm_control_launch_refusalcomposite the same commit (af57eb8) introduced and declared the single owner of "would a launch with this profile be refused". The rules and their order are identical today, so there is no live hole; the point is that the composite was added precisely so a route cannot ask a narrower question, and this route is already outside it. A third rule added tofm_control_launch_refusalwould be enforced on the local spawn and on the pre-stop relaunch check and silently skipped on the remote route - the same class of miss that produced the round-1 remote bypass and the round-3 flag-keyed guard. The refactor is mechanical: capture the message withif ! remote_refusal=$(fm_control_launch_refusal "$harness" secondmate "$CURSOR_EXEMPTION"), release the two locks, printerror: $remote_refusal, return 1, and keep the remote-onlyattendedrefusal at :557 after it (ordering is unchanged, since the composite reports grant-then-kind exactly as these two do).tests/fm-control-relaunch.test.sh:888- The round-6 and af57eb8 insertions left three unrelated rationale blocks concatenated with no separation immediately aboveassert_relaunch_refused_without_stopping(tests/fm-control-relaunch.test.sh:888-905), while the two tests those blocks actually describe now sit further down with no rationale: the "An envelope grant is inherited across relaunch, but it exempts a worker from CURSOR's unattended bar..." block belongs totest_relaunch_onto_another_harness_drops_the_cursor_grantand the "The refusal an attended cursor task hits names --cursor-exemption as the way forward..." block belongs totest_relaunch_accepts_a_fresh_attended_grant_on_the_verb. Separately, the comment abovetest_control_relaunch_refuses_an_attended_cursor_grant_before_stopping(:848-854) still asserts "relaunchforwards no --cursor-exemption", which stopped being true when the verb gained the flag (bin/fm-control.sh:233 parses it, :870 forwards it). The test body is still correct - it passes no flag - but its stated premise is not, and in a file whose comments are the reviewed record of why each door is closed, a stale premise is the thing a future reader trusts. Move each block back above the test it describes and reword that premise to "this invocation passes no --cursor-exemption, so the launch inherits only what survives an unattended relaunch".🔧 Fix: bound pre-stop invariant claim, route remote through composite
3 issues (1 warning, 2 infos) still open:
bin/fm-control-lib.sh:233- The cursor refusal is parameterized by kind but its remedies are crewmate-only, so for kind=secondmate - the case this change calls the worst one - it names two knobs that cannot fix the refusal. The message says "set config/crew-harness to a verified adapter such as codex or claude, or add a crew-dispatch profile eligible for this kind". For a secondmate, bin/fm-spawn.sh:1441 resolves the harness throughfm-harness.sh secondmate, whose chain is config/secondmate-harness -> config/crew-harness -> own (bin/fm-harness.sh:159-168), so a home holdingconfig/secondmate-harness=cursorkeeps resolving cursor no matter what crew-harness says; and the crew-dispatch backstop at bin/fm-spawn.sh:1447 is on the non-secondmate branch only, so a dispatch profile is never consulted for a secondmate at all. Concrete path:printf 'cursor\n' > config/secondmate-harnessthenbin/fm-spawn.sh sm <home> --secondmate(exactly the fixture in tests/fm-secondmate-harness.test.sh:625 and, for the remote route, tests/fm-remote-secondmate-trace-context.test.sh:315) prints this message; an operator who follows it edits config/crew-harness and gets the identical refusal again. docs/configuration.md:299 already states the rule correctly ("Set config/crew-harness or config/secondmate-harness"), so the code message is narrower than its own guidance. Since the function already takes <kind>, name config/secondmate-harness for the secondmate case and drop the dispatch-profile clause there. Neither of this change's two new secondmate refusal tests asserts the remedy text, so nothing catches it.bin/fm-control-lib.sh:260- The newly written bound on fm_control_launch_refusal is right about the CLASS but its parenthetical reads as an exhaustive list and is not. bin/fm-control-lib.sh:259-261 says bin/fm-spawn.sh "still refuses after this point when the harness executable is absent from PATH (pi, cursor) and when a requested cursor model is missing from the live--list-modelscatalog", and bin/fm-control.sh:691 narrows it further to "a missing pi or cursor executable". Two more environmental refusals live below the composite call at bin/fm-spawn.sh:1512 and can strand a relaunch the same way:resolve_muse_binary(bin/fm-spawn.sh:1716 -> "muse executable not found on PATH") andresolve_kimi_binary(bin/fm-spawn.sh:1736 -> "kimi executable not found"), plusmuse_credential_present(bin/fm-spawn.sh:1720), which refuses a muse launch on a host with no worker-reachable credential. Sobin/fm-control.sh <id> relaunch --harness muse --note non a secondmate-incapable... on a crewmate task on a host without muse installed stops the agent and is then refused, which the stated bound does not cover. docs/agent-control.md:95 got this right by staying generic ("a harness whose executable is missing from this machine"); the two code sites should either match that generality or name muse and kimi too. Flagging because the previous round's whole point was that an inexact statement is what stops the next reader from looking.bin/fm-spawn.sh:544- On the remote secondmate route the shared refusal offers--cursor-exemption attended, which that same route refuses twelve lines later. bin/fm-spawn.sh:544 asks the composite, which for an unexempted cursor secondmate prints the shared text ending "pass it on the invocation itself with --cursor-exemption attended or --cursor-exemption envelope:<name>" (bin/fm-control-lib.sh:233); an operator who takes the first option hits bin/fm-spawn.sh:556, "an 'attended' cursor exemption asserts a person at this pane and cannot authorize a worker on a remote host". The second message is clear and points at the right fix, so this is a two-step rather than a dead end - milder than the round-5 case where the named flag did not exist on the verb at all. Worth noting because the remote route is the only place where half the advertised opt-in is invalid, and the route already knows it is remote before it prints: refusingattendedbefore asking the composite, or having the remote route add one clause naming envelope-only, would keep the first message true where it is read.🔧 Fix: name per-kind cursor remedy, generalize environmental bound
3 issues (2 warnings, 1 info) still open:
bin/fm-spawn.sh:552- The remote-route qualifier added this round is appended to EVERY refusal the composite can return, not only the cursor one it was written for.spawn_remote_secondmateprints"error: $remote_launch_refusal On this REMOTE secondmate route only --cursor-exemption envelope:<name> is accepted, because 'attended' asserts a person at this pane..."unconditionally, butfm_control_launch_refusalreaches that branch for two non-cursor reasons as well, because the route now admits every harnessfm_control_harness_supportedaccepts (bin/fm-spawn.sh:518, widened from the former literal list that excluded muse). Reproduced against the installed lib: (1)config/secondmate-harness=museon a remote secondmate prints "muse is a verified crewmate/scout adapter only and cannot run a secondmate; it has no primary supervision protocol. Select a harness verified for secondmates. On this REMOTE secondmate route only --cursor-exemption envelope:<name> is accepted..." - cursor-grant guidance stapled to a refusal that has nothing to do with cursor; (2) a grant on a non-cursor harness prints "--cursor-exemption applies only to a cursor launch... drop the flag" immediately followed by "only --cursor-exemption envelope:<name> is accepted", which tells the operator to drop the flag and to pass a flag in the same breath. Gate the qualifier on the refusal actually being cursor's (for example append it only whenfm_control_cursor_exemption_applies "$harness"), so the shared text is qualified where the qualification is true and left alone otherwise.bin/fm-control-lib.sh:241- The per-kind secondmate remedy added this round states as an absolute something that is false in exactly the case its own preamble introduces. The message reads "If this home is running inside cursor and resolved it that way, set config/secondmate-harness to a verified adapter such as codex or claude; it resolves ahead of config/crew-harness, so changing crew-harness alone will not clear this". "Resolved it that way" isdetect_own, which is reached only when config/secondmate-harness is absent ordefaultAND config/crew-harness is absent ordefault(bin/fm-harness.sh:158-168). In that state config/crew-harness DOES clear the refusal, because resolve_secondmate defers to resolve_crew. Verified in a scratch home: with secondmate-harness unset and crew-harness=codex,fm-harness.sh secondmateprints codex; only once secondmate-harness itself holds cursor does crew-harness stop mattering. So the operator most likely to read this line - the unconfigured cursor-hosted home - is told the fleet-wide knob is useless when it is the simpler correct fix, and the claim contradicts docs/configuration.md:299 ("Set config/crew-harness or config/secondmate-harness"), AGENTS.md, and the intent's own wording that an unconfigured cursor-hosted home is stopped with an instruction to set config/crew-harness. The new test at tests/fm-secondmate-harness.test.sh:648 cannot catch it because its fixture writes config/secondmate-harness=cursor, the one case where the claim is true. Make the clause conditional: name config/secondmate-harness as the knob that always works, and say crew-harness clears it only while secondmate-harness is unset.bin/fm-remote-secondmate-control.sh:176- The wire receiver forwards whatever grant arrives to the remote host's ownfm-spawn.sh --cursor-exemption, includingattended, which that host will honor as a person-in-the-pane attestation for a worker nobody is watching.cmd_launch's loop accepts anyexemption:<grant>and passes it through at :221; the "only an envelope grant is forwardable" rule is enforced solely on the sending side (bin/fm-spawn.sh:556 and theenvelope:?*case at :674). No shipped caller sendsexemption:attendedtoday - the parent refuses it before composing launch_args - so this is not currently reachable, which is why it is info. It is worth closing anyway for the same reason this branch moved every other guard behind one owner: the intent states "Remote secondmate launches forward only an envelope grant", and the boundary that consumes the grant is the one place that rule is not checked. Onecase "$exemption" in attended) die ...beside the existing prefix parse would make the receiver refuse what the sender already refuses to send.🔧 Fix: condition remote qualifier and secondmate remedy, validate wire grant
3 issues (1 warning, 2 infos) still open:
tests/fm-control-relaunch.test.sh:874- Two new tests require a REAL installed Cursor CLI and go red on any host without one, unlike every sibling suite that exercises a successful cursor launch.test_relaunch_inherits_a_named_isolation_envelope_grant(tests/fm-control-relaunch.test.sh:874) assertsassert_contains "$out" "spawned rl41 harness=cursor", andtest_relaunch_accepts_a_fresh_attended_grant_on_the_verb(:945) assertsexpect_code 0plusrelaunched rl44 harness=cursor. Both drive a realfm-spawn.sh --relaunch --harness cursor, which reachesCURSOR_BIN=$(fm_cursor_resolve_binary) || exit 1at bin/fm-spawn.sh:1533 - an ENVIRONMENTAL check that lives past the composite and is not stubbed here. The suite's only fakebin ismake_tmux_stub(tests/fm-control-relaunch.test.sh:52), which createstmuxandsleepand nocursor-agent, andrun_spawn/run_controlprepend it to the inherited$PATH(:181, :166), so resolution falls through to the developer's own install. Verified directly:env -i HOME=/tmp/nonexistent PATH=/usr/bin:/bin bash -c '. bin/fm-cursor-lib.sh; fm_cursor_resolve_binary'returns non-zero, while on this machine it resolves~/.local/bin/cursor-agent(a real 2026.08.25 install), which is why the pair passes here. The repo already has both fixes for exactly this: tests/fm-spawn-dispatch-profile.test.sh:41-46 writes a fakecursor-agentinto its fakebin (structural resolution accepts it on basename alone), and tests/fm-secondmate-harness.test.sh:606 printsskip: cursor executable not resolvable in this environmentinstead of failing. The other five new cursor relaunch cases are unaffected because they all refuse at the composite (bin/fm-spawn.sh:1526) before binary resolution. Add the samecursor-agentstub to this suite's fakebin so the two positive cases prove the grant path rather than the developer's install.bin/fm-bootstrap.sh:1158- The new crew-dispatch diagnostic states as an absolute something this same change makes false. It reports the whole file asinvalid config/crew-dispatch.jsonwith "A rule naming cursor can never be satisfied, so it would validate clean here and fail at spawn time." A dispatch-resolved cursor rule CAN be satisfied: withconfig/crew-dispatch.jsonpresent, bin/fm-spawn.sh:1025 requires an explicit--harness, and an explicit--harness cursorplus--cursor-exemption attended(orenvelope:<name>) launches cleanly - that is exactly the path tests/fm-spawn-dispatch-profile.test.sh'stest_cursor_exemption_permits_an_attended_or_enveloped_spawnproves, and .agents/skills/harness-adapters/references/harness/cursor.md:70 and AGENTS.md:198-199 both describe cursor as remaining available for precisely those two cases. So a captain who registers a cursor rule for attended or enveloped crewmate work is told at every bootstrap that their configuration is invalid and can never work. The diagnostic itself is authorized by the intent ("bootstrap now diagnoses an ineligible cursor crew-dispatch rule"); only the absolute clause is wrong. This is the same overstated-claim shape the last four rounds have been correcting elsewhere - condition it on the case it is printed for (a rule naming cursor cannot serve an ORDINARY unattended dispatch and is satisfiable only when the spawn also carries --cursor-exemption) rather than asserting a universal the code does not enforce.bin/fm-remote-secondmate-control.sh:197- The receiver's new grant check is a third, looser copy of a rule this branch has otherwise consolidated behind one owner, and its comment claims more than it does. bin/fm-remote-secondmate-control.sh:193-199 matchesenvelope:?*by hand whilefm_control_cursor_exemption_valid(bin/fm-control-lib.sh:148) is declared "the ONE owner of what a cursor exemption grant may say" and additionally bounds the envelope NAME to a locale-pinned[A-Za-z0-9][A-Za-z0-9._-]*. Verified against the installed lib:envelope:bad name,envelope:-x, and a newline-bearingenvelope:x\nyolo=onare all rejected by the owner but accepted byenvelope:?*, so they pass this boundary and are forwarded to the remotefm-spawn.sh --cursor-exemption, which then refuses them. Behavior is fail-closed and no shipped sender can compose those, so this is latent drift rather than a hole - but the comment directly above says this boundary "validates what it accepts rather than trusting the sender", which is only true of the attended/envelope split and not of the charset the owner enforces. bin/fm-control-lib.sh is explicitly a pure sourceable contract with no side effects (its header, lines 15-17), and this script already sources four libs at :45-52, so. "$SCRIPT_DIR/fm-control-lib.sh"and calling the owner would make the receiver's check identical to the rule it names, per the standing preference for one shared check over parallel ones.🔧 Fix: stub cursor binary, condition dispatch advisory, share grant owner
2 infos still open:
bin/fm-bootstrap.sh:1168- The new cursor advisory returns early, so a crew-dispatch config the same change now treats as valid-but-conditional loses the dispatch facts every other valid config emits.crew_dispatch_validateprintsCREW_DISPATCH: config/crew-dispatch.json - <advisory>and thenreturn 0(bin/fm-bootstrap.sh:1166-1170), which sits above theFM_BOOTSTRAP_VERBOSE_FACTSblock at :1176-1194 - the only producer ofBOOTSTRAP_INFO: crew dispatch active,... crew dispatch rule: ..., and... crew dispatch default: .... Concrete path: a home withFM_BOOTSTRAP_VERBOSE_FACTS=1and{"rules":[{"when":"attended cursor work","use":{"harness":"cursor"}}]}used to get its rule inventory printed (before this branch a cursor rule validated clean and fell through); it now gets the advisory and nothing else, even though the advisory's own text says the rule is satisfiable with a grant. The schema-failure branch below it returns early for the right reason - that file cannot work at all - but this one is precisely the case the round-10 change split out as usable. Print the advisory and fall through to the facts block rather than returning. Separately, the file's own output contract at bin/fm-bootstrap.sh:12 still lists only"CREW_DISPATCH: invalid config/crew-dispatch.json - <reason>", so the non-invalid shape this change emits is undocumented in the header that enumerates every line bootstrap can print.bin/fm-control-lib.sh:244- The cursor refusal's remedy is gated behind an antecedent that is false in the reachable case the repo's own tests use. The message reads "... The bar applies however cursor was selected, INCLUDING when firstmate inherited it by detecting its own runtime ... If this home is running inside cursor and resolved it that way, <remedy>; firstmate will not choose one for you."resolved it that wayisdetect_own, reached only when both config knobs are absent ordefault(bin/fm-harness.sh:158-168). But the ordinary way to hit this refusal is an EXPLICIT config value:printf 'cursor\n' > config/secondmate-harnessthenbin/fm-spawn.sh sm <home> --secondmateis exactly the fixture at tests/fm-secondmate-harness.test.sh:625, andconfig/crew-harness=cursoris the ship/scout equivalent. For those operators the sentence's condition is plainly false, yet the remedy that follows it is the only one that clears the refusal. This is the mirror of the shape the last several rounds corrected: instead of a universal asserted where the code branches, it is a universally-applicable remedy conditioned on one branch. Neither new secondmate test catches it, because both assert only that the remedy substring is present, not that it is reachable guidance for the case that produced it. Ungate the remedy - state it unconditionally, and keep the detection case as the separate note it already is in the preceding sentence.🔧 **Test** - 1 issue found → auto-fixed ✅
bin/fm-remote-home-seed.sh:160- tests/fm-remote-secondmate-trace-context.test.sh (new in this change) fails on this macOS machine, but not because of this change: bin/fm-remote-home-seed.sh line 160 expands "${PROJECT_NAMES[@]}" on an empty array underset -u, which stock macOS bash 3.2 rejects as unbound, so every--no-projectsseed dies before doing anything. That file is untouched by this branch, and the pre-existing tests/fm-remote-secondmate-lifecycle-e2e.test.sh fails the same way at the same call. Reproduced standalone:bash bin/fm-remote-home-seed.sh probe remote-mac /tmp/remote-root <home> --no-projects-> "line 190: PROJECT_NAMES[@]: unbound variable". Linux CI (bash 5) is unaffected and the repo's macos-stock-bash lane only parses files plus two snapshot suites, so CI will stay green. Consequence for this phase: the new remote traceparent/exemption wire coverage cannot execute on stock macOS bash, so I verified that boundary manually instead (attended refused, malformed envelope refused, valid envelope accepted past the grant gate, bare W3C carrier still accepted, unknown token refused). Fixing it means a one-line change to an untouched production script ("${PROJECT_NAMES[@]:-}"plus the same guard at the count), which is outside this change's declared scope and the split-PR boundary - the captain's call whether to take it here or separately.bin/fm-test-run.sh tests/fm-spawn-dispatch-profile.test.sh tests/fm-control-relaunch.test.sh tests/fm-control.test.sh tests/fm-remote-secondmate-trace-context.test.sh tests/fm-secondmate-harness.test.sh tests/fm-bootstrap.test.sh tests/fm-cursor-harness.test.sh tests/fm-harness-adapter-references.test.sh tests/fm-backend-orca.test.sh- 8 of 9 suites pass; only the new remote trace-context suite fails, on the pre-existing macOS bash 3.2 seed defectManual end-to-end transcript driving the realbin/fm-spawn.shfor claude, codex and cursor ship/scout/secondmate spawns against an isolated FM_HOME and a fake tmux endpoint, capturing the literal launch command, thespawned ...line, andstate/<id>.metaManualbin/fm-control.sh <id> relaunchruns covering: attended record refused before the agent is stopped (pane command unchanged, nothing sent, record untouched), envelope record inherited and relaunched, fresh--cursor-exemption attendedon the verb accepted,--harness codexswitch dropping the grantManualbin/fm-remote-secondmate-control.sh launch sm cursor - - herdr <arg>forexemption:attended,exemption:envelope:bad name,exemption:envelope:routing-benchmark, a bare W3C traceparent, and an unknownfuture-tokenbin/fm-bootstrap.shon a home whose config/crew-dispatch.json routes a rule to cursor - emits the CREW_DISPATCH advisory, not the invalid-config channelVendor CLI corroboration with negative controls:codex -s workspace-write -a never -c sandbox_workspace_write.network_access=true --help,claude --permission-mode auto --helpvs--permission-mode not-a-mode, andcursor-agent --helpflag semanticscodex sandbox -c sandbox_mode=workspace-write [-c sandbox_workspace_write.network_access=true] -- ...egress and write probes (network comparison inconclusive - this environment has no DNS at all, host shell included)bash bin/fm-remote-home-seed.sh probe remote-mac /tmp/remote-root <home> --no-projects- standalone reproduction isolating the bash 3.2 unbound-array failure behind the one failing suitebash tests/fm-remote-secondmate-lifecycle-e2e.test.sh- pre-existing suite confirming the same seed failure exists independently of this change🔧 Fix: fix pre-existing bash 3.2 empty-array crash in remote seed
✅ Re-checked - no issues remain.
bash /tmp/repro-seed.sh <pre-fix-copy>- standalonefm-remote-home-seed.sh probe remote-mac /srv/fm-root /srv/fm-home --no-projectsagainst bin/fm-remote-home-seed.sh at 8e6b1f9: reproducesline 190: PROJECT_NAMES[@]: unbound variable, exit 0 (masked by the EXIT trap)bash /tmp/repro-seed.sh <worktree>- same invocation at 5d8bcab: loop skipped, run reaches the first real remote step, honest exit 1bin/fm-test-run.sh tests/fm-remote-secondmate-trace-context.test.sh tests/fm-remote-secondmate-lifecycle-e2e.test.sh- 2 scripts, failed=0, skipped_gate=0 (both were unrunnable on this machine before the fix)bin/fm-test-run.sh tests/fm-spawn-dispatch-profile.test.sh tests/fm-control-relaunch.test.sh tests/fm-control.test.sh tests/fm-bootstrap.test.sh tests/fm-secondmate-harness.test.sh tests/fm-backend-orca.test.sh- 6 scripts, failed=0, skipped_gate=0Manual:FM_HOME=<tmp> FM_ROOT_OVERRIDE=<tmp> bin/fm-bootstrap.shon a home whose config/crew-dispatch.json names cursor - emits the CREW_DISPATCH ineligibility diagnosis naming --cursor-exemption at session start rather than validating cleangit status --porcelain- worktree clean, no transient artifacts left behindbin/fm-remote-secondmate-control.sh:141- Judgment call, resolved as no-op: the mixed-version wire degradation for remote secondmate launches (a new parent sendingtraceparent:<value>to a not-yet-upgraded host breaks every carrier-bearing remote launch, including ordinary codex and claude ones) is operator-visible fleet-upgrade guidance, but it is documented only in cmd_launch's code comment. The user intent states that degradation is deliberately stated in code, and docs/remote-secondmates.md has no version-skew section to extend, so documenting it in prose would mean creating a new surface and a second copy of a code-owned contract. Left as is..agents/skills/harness-adapters/SKILL.md:35- Out-of-scope consolidation worth a follow-up: the router's "Non-negotiable safety" section states muse's kind restriction inline ("Muse is verified only for crewmate and scout work, never a secondmate or primary") but not the parallel, now-broader cursor unattended bar, which lives in references/harness/cursor.md and AGENTS.md. The two comparable kind rules are placed inconsistently. Not fixed here because adding cursor's rule would duplicate AGENTS.md and cursor.md, and removing muse's line is unrelated restructuring; a follow-up should pick one placement for both.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.