Skip to content

fix(bin): grant codex crewmates and scouts the writable roots their brief needs - #3385

Open
npayette84 wants to merge 31 commits into
kunchenguid:mainfrom
npayette84:fm/codex-writable-roots
Open

npayette84 wants to merge 31 commits into
kunchenguid:mainfrom
npayette84:fm/codex-writable-roots

Conversation

@npayette84

@npayette84 npayette84 commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Give codex-launched crewmates and scouts the write access they need to fulfil their own brief.

THIS PR IS THE SECOND OF TWO DELIBERATELY SPLIT CHANGES, stacked on the launch-hardening PR. Its base branch content (the crewmate launch hardening: claude --permission-mode auto with CLAUDE_CODE_DISABLE_FAST_MODE=1, codex -s workspace-write -a never with an explicit network_access grant, cursor --auto-review --sandbox enabled plus the cursor unattended bar and its per-invocation exemption) is ALREADY REVIEWED AND CI-GREEN in that other PR and is NOT the subject of this one. Review only the writable-roots grant. Do not re-litigate the hardening, the cursor bar, or the exemption mechanism, and do not pull their concerns into this change.

The defect this PR fixes: codex runs under -s workspace-write, which confines writes to the task worktree. Every firstmate task worktree is a LINKED worktree, so that confinement denied the three things every brief requires outside it - the scout report at data//report.md, the status appends supervision reads, and the captain-hold completion gate - and denied git add too, because a linked worktree's index lock lives in the primary checkout's git directory. Observed 2026-08-26: a codex scout produced a full report it could not deliver, and the completion gate recursed inside its own lock retry until the filename was too long. Codex had been out of rotation since, for plumbing reasons rather than capability.

The fix composes repeatable --add-dir writable roots, scoped PER KIND as narrowly as the sandbox mechanism allows: a ship crewmate gets only its own state/.status and state/.turn-ended FILES plus the out-of-tree git common dir; a scout gets state/ itself, its own data//, and the git common dir; a secondmate gets only the parent's state/.status file. state/ must be a whole directory for the scout alone because the completion gate creates a lock symlink and a mktemp-named owner directory in it and neither can be named ahead of time - that is a deliberate, documented limit of the mechanism, not an oversight. FM_HOME itself, .env, config/, projects/, and the shared data/ root are never granted. --add-dir is used rather than -c sandbox_workspace_write.writable_roots because the -c form REPLACES an operator's own configured roots instead of adding to these.

Deliberate scope decisions: no other harness's launch is changed by this PR. Only codex is launched inside a filesystem sandbox. The lock-retry recursion itself is NOT fixed here - removing the denial removes the trigger seen on 2026-08-26, but another permanent write failure would still recurse - and that is stated plainly rather than implied. A codex worker still cannot drive no-mistakes because ~/.no-mistakes stays denied, which is also stated rather than hidden.

Evidence: a portable suite pins the composition and proves each root load-bearing with no codex present, and an opt-in live guard (FM_CODEX_LIVE_E2E=1) proves the vendor still enforces exactly these roots, including the captain-hold completion gate, and refuses to pass without the real binary. Both are green on this rebased head against codex-cli 0.150.1.

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

  • bin/fm-spawn.sh now composes repeatable --add-dir writable roots for every codex launch, scoped per kind: a ship crewmate gets only its own state/<id>.status, state/<id>.turn-ended, and state/<id>.inbox/ plus the linked worktree's out-of-tree git common dir; a scout gets state/ itself (the captain-hold gate creates an unnameable lock symlink and mktemp owner dir there), its own data/<id>/, and the git common dir; a secondmate gets only the parent's status file and parent-side inbox. $FM_HOME, .env, config/, projects/, and the shared data/ root stay ungranted. File and directory roots are pre-created so they resolve (and marked already-reported so fm-watch.sh does not wake the captain for a file the spawn conjured), every root is emitted canonicalized, and a symlinked record or a root resolving outside its container refuses the whole launch instead of composing a short grant. A no-mistakes codex ship spawn also prints one notice that the sandbox still denies the pipeline data directory, so that worker can commit and reach the network but cannot run validation itself.
  • The stacked launch-hardening base is part of this delta and was reviewed separately: claude --permission-mode auto with CLAUDE_CODE_DISABLE_FAST_MODE=1, codex -s workspace-write -a never with an explicit network_access grant, and cursor --auto-review --sandbox enabled behind an unattended-kind bar with the per-invocation --cursor-exemption attended|envelope:<name> grant threaded through the spawn, control, batch, and remote-secondmate routes.
  • Added tests/fm-codex-sandbox-grant.test.sh, a portable suite that pins the composition and proves each root load-bearing with no codex binary present, and tests/fm-codex-sandbox-grant-live-e2e.test.sh, an opt-in FM_CODEX_LIVE_E2E=1 guard that exercises the real vendor sandbox (including the completion gate) and refuses to pass without the binary. Documented the mechanism and its measurements in the new docs/verification/codex-sandbox.md, with matching updates to AGENTS.md, docs/configuration.md, docs/agent-control.md, and the claude, codex, and cursor harness references.

Risk Assessment

✅ Low: The change is gated entirely behind HARNESS=codex, other adapters are proven untouched, and I verified the composed ship and secondmate launches, the symlink guards, the watcher-marker seeding, and the FILE-form --add-dir acceptance against the real fm-spawn and the installed codex-cli 0.150.1, finding no open defect - the two remaining items are informational.

Testing

Ran the two suites this change ships plus the two adjacent composition suites it touches, then reproduced the fixed defect manually against codex-cli 0.150.1: the portable grant suite passed all 11 checks with no codex present, the opt-in live guard passed end to end without any manual gate bypass (validating the head commit), the dispatch-profile and secondmate-harness suites passed at 31 and 50 checks, and a real scout turn without the grant was denied both its report and its status append while the same turn with the composed --add-dir roots delivered both and still could not write config/. No baseline commands from earlier phases were re-run, transcripts and composed launch commands were captured as artifacts, and both scratch labs created under the repo worktree were removed, leaving it clean. This is a CLI launch change with no rendered UI surface, so the evidence is CLI transcripts and the resulting on-disk artifacts rather than screenshots.

Evidence: Real codex turn: scout report denied without the grant, delivered with it (before/after)

Source: Real codex turn: scout report denied without the grant, delivered with it (before/after)

== BEFORE: codex exec -s workspace-write (no grant) == sandbox: workspace-write [workdir, /tmp, $TMPDIR] (network access enabled) codex: 1. Denied: operation not permitted. 2. Denied: operation not permitted. report.md ABSENT (scout could not deliver its report) status EMPTY (supervision sees nothing) == AFTER: same turn, with the --add-dir roots fm-spawn composed == sandbox: workspace-write [workdir, /tmp, $TMPDIR, <lab>/fmhome/state, <lab>/fmhome/data/codex-repro-scout, <lab>/project/.git] codex: 1. Succeeded. 2. Succeeded. report.md EXISTS: scout report: the repo builds status line: done: report delivered config/ still denied

Manual end-to-end reproduction against codex-cli 0.150.1: a codex SCOUT in a linked task worktree
delivering its report to $FM_HOME/data/<id>/report.md and appending its status line.
BEFORE = the launch codex got before this change (-s workspace-write alone).
AFTER  = the same turn with the exact --add-dir roots bin/fm-spawn.sh composes on this head.
Script: repro-scout-report-denial.sh (in this evidence directory).

== writable roots fm-spawn composed for this scout ==
  <lab>/fmhome/state
  <lab>/fmhome/data/codex-repro-scout
  <lab>/project/.git

== BEFORE: codex exec -s workspace-write (no grant) ==
Reading additional input from stdin...
OpenAI Codex v0.150.1
--------
workdir: <lab>/wt
model: gpt-5.6-terra
provider: custom
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR] (network access enabled)
reasoning effort: low
reasoning summaries: detailed
session id: 01a05d71-1188-7b63-b3f3-625e2ed72904
--------
user
You are a firstmate scout finishing your brief. Run exactly these two shell commands, each separately, then stop: (1) printf 'scout report: the repo builds\n' > <lab>/fmhome/data/codex-repro-scout/report.md (2) echo 'done: report delivered' >> <lab>/fmhome/state/codex-repro-scout.status . Report for each whether it succeeded or was denied. Do nothing else and do not retry a denied command.
**Clarifying command execution protocol**
codex
Running the two specified commands separately.
codex
1. Denied: operation not permitted.  
2. Denied: operation not permitted.
tokens used
11,791
1. Denied: operation not permitted.  
2. Denied: operation not permitted.
-- delivered artifacts after BEFORE turn --
  report.md ABSENT (scout could not deliver its report)
  status EMPTY (supervision sees nothing)

== AFTER: same turn, with the --add-dir roots fm-spawn composed ==
Reading additional input from stdin...
OpenAI Codex v0.150.1
--------
workdir: <lab>/wt
model: gpt-5.6-terra
provider: custom
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR, <lab>/fmhome/state, <lab>/fmhome/data/codex-repro-scout, <lab>/project/.git] (network access enabled)
reasoning effort: low
reasoning summaries: detailed
session id: 01a05d71-4f47-7642-93ee-7be2c1fe25ac
--------
user
You are a firstmate scout finishing your brief. Run exactly these two shell commands, each separately, then stop: (1) printf 'scout report: the repo builds\n' > <lab>/fmhome/data/codex-repro-scout/report.md (2) echo 'done: report delivered' >> <lab>/fmhome/state/codex-repro-scout.status . Report for each whether it succeeded or was denied. Do nothing else and do not retry a denied command.
codex
I’ll run the two specified commands separately and report each result.
exec
/bin/zsh -lc "printf 'scout report: the repo builds\\n' > <lab>/fmhome/data/codex-repro-scout/report.md" in <lab>/wt
 succeeded in 0ms:
exec
/bin/zsh -lc "echo 'done: report delivered' >> <lab>/fmhome/state/codex-repro-scout.status" in <lab>/wt
 succeeded in 0ms:
codex
1. Succeeded.  
2. Succeeded.
tokens used
12,003
1. Succeeded.  
2. Succeeded.
-- delivered artifacts after AFTER turn --
  report.md EXISTS: scout report: the repo builds
  status line: done: report delivered
-- the home itself stays denied --
  config/ still denied
Evidence: Composed launch commands and granted roots per kind (ship, scout, secondmate, claude unchanged, symlink refusal)

Source: Composed launch commands and granted roots per kind (ship, scout, secondmate, claude unchanged, symlink refusal)

fm-spawn codex writable-root grant, as composed on this head
codex version: codex-cli 0.150.1

===== codex SHIP crewmate (--mode no-mistakes) =====
granted writable roots (--add-dir):
  $FM_HOME/state/codex-ship.status
  $FM_HOME/state/codex-ship.turn-ended
  $FM_HOME/state/codex-ship.inbox
  <project>/project/.git
launch command placed in the pane:
  env -u CURSOR_AGENT -u CURSOR_INVOKED_AS codex -s workspace-write --add-dir '$FM_HOME/state/codex-ship.status' --add-dir 
  '$FM_HOME/state/codex-ship.turn-ended' --add-dir '$FM_HOME/state/codex-ship.inbox' --add-dir '<project>/project/.git' -a never -c 
  sandbox_workspace_write.network_access=true -c "notify=[\"bash\",\"-c\",\"touch '$FM_HOME/state/codex-ship.turn-ended'\"]" 
  "$('<fm-root>/bin/fm-operational-input.sh' encode launch-brief < '$FM_HOME/data/codex-ship/brief.md')"
captain-facing dispatch notice:
  notice: codex-ship ships mode=no-mistakes on codex, whose sandbox denies the no-mistakes data directory - the worker can commit and reach the network 
  but cannot run validation itself; expect to land it another way or choose another harness

===== codex SCOUT =====
granted writable roots (--add-dir):
  $FM_HOME/state
  $FM_HOME/data/codex-scout
  <project>/project/.git
launch command placed in the pane:
  env -u CURSOR_AGENT -u CURSOR_INVOKED_AS codex -s workspace-write --add-dir '$FM_HOME/state' --add-dir '$FM_HOME/data/codex-scout' --add-dir 
  '<project>/project/.git' -a never -c sandbox_workspace_write.network_access=true -c "notify=[\"bash\",\"-c\",\"touch 
  '$FM_HOME/state/codex-scout.turn-ended'\"]" "$('<fm-root>/bin/fm-operational-input.sh' encode launch-brief < '$FM_HOME/data/codex-scout/brief.md')"

===== claude SHIP crewmate (unchanged, no grant) =====
granted writable roots (--add-dir):
  (none)
launch command placed in the pane:
  env -u CURSOR_AGENT -u CURSOR_INVOKED_AS CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false CLAUDE_CODE_DISABLE_FAST_MODE=1 claude --permission-mode auto 
  "$('<fm-root>/bin/fm-operational-input.sh' encode launch-brief < '$FM_HOME/data/claude-ship/brief.md')"

===== codex SECONDMATE =====
granted writable roots (--add-dir):
  $FM_HOME/state/sm-a.status
  $FM_HOME/state/sm-a.inbox
launch command placed in the pane:
  FM_ROOT_OVERRIDE= FM_STATE_OVERRIDE= FM_DATA_OVERRIDE= FM_PROJECTS_OVERRIDE= FM_CONFIG_OVERRIDE= FM_PUBLIC_FOLLOWUP_PRIMARY_HOME='$FM_HOME' 
  FM_HOME='<project>' FM_TRACE_CONTEXT=off FM_SUPERVISION_MODEL=persistent env -u CURSOR_AGENT -u CURSOR_INVOKED_AS codex -s workspace-write --add-dir 
  '$FM_HOME/state/sm-a.status' --add-dir '$FM_HOME/state/sm-a.inbox' -a never -c sandbox_workspace_write.network_access=true 
  "$('<fm-root>/bin/fm-operational-input.sh' encode launch-brief < '<project>/data/charter.md')"

===== refusal: a state record that has become a symlink =====
exit code: 1
  error: $FM_HOME/state/symlink.inbox is a symlink; firstmate never resolves, creates, or grants a codex writable root through a link - repair or 
  remove that record before spawning
Evidence: Live guard result on head bb3ef80, run with no manual env bypass

Source: Live guard result on head bb3ef80, run with no manual env bypass

ok - codex-cli 0.150.1 enforces exactly the granted writable roots, and the launch flags reach that policy ok - codex-cli 0.150.1 admits the captain-hold completion gate under the granted roots and denies it without them ok - codex-cli 0.150.1 accepts and enforces the FILE form of --add-dir: the ship keeps its own two state files while a sibling task record stays denied

=== live guard on head bb3ef80, run with NO manual env bypass ===
$ FM_CODEX_LIVE_E2E=1 FM_CODEX_KEEP_LAB=1 bash tests/fm-codex-sandbox-grant-live-e2e.test.sh   (exit 0)
ok - codex-cli 0.150.1 enforces exactly the granted writable roots, and the launch flags reach that policy
ok - codex-cli 0.150.1 admits the captain-hold completion gate under the granted roots and denies it without them
ok - codex-cli 0.150.1 accepts and enforces the FILE form of --add-dir: the ship keeps its own two state files while a sibling task record stays denied
lab preserved: <lab>
Evidence: Live scout model turn transcript (report and status allowed, config/ denied)

Source: Live scout model turn transcript (report and status allowed, config/ denied)

codex-cli 0.150.1 - real model turn under the --add-dir flags fm-spawn composed for a SCOUT
(worktree is the task worktree; the report and status live outside it, config/ must stay denied)

Reading additional input from stdin...
OpenAI Codex v0.150.1
--------
workdir: <lab>/wt
model: gpt-5.6-terra
provider: custom
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR, <lab>/fmhome/state, <lab>/fmhome/data/codex-grant-live, <lab>/project/.git] (network access enabled)
reasoning effort: low
reasoning summaries: detailed
session id: 01a05d6f-b55a-7322-869f-e36a6864bd66
--------
user
Run exactly these three shell commands, each separately, then stop: (1) echo 'working: live guard' >> <lab>/fmhome/state/codex-grant-live.status (2) printf '# report\n' > <lab>/fmhome/data/codex-grant-live/report.md (3) echo x >> <lab>/fmhome/config/must-stay-denied.txt . Report for each whether it succeeded or was denied. Do nothing else and do not retry a denied command.
codex
Running the three commands once each, in the requested order.
exec
/bin/zsh -lc "echo 'working: live guard' >> <lab>/fmhome/state/codex-grant-live.status" in <lab>/wt
 succeeded in 0ms:
exec
/bin/zsh -lc "printf '# report\\n' > <lab>/fmhome/data/codex-grant-live/report.md" in <lab>/wt
 succeeded in 0ms:
codex
1. Succeeded  
2. Succeeded  
3. Denied
tokens used
13,287
1. Succeeded  
2. Succeeded  
3. Denied
Evidence: Live ship model turn transcript (own status file allowed, sibling task record denied)

Source: Live ship model turn transcript (own status file allowed, sibling task record denied)

codex-cli 0.150.1 - real model turn under the FILE-form --add-dir flags fm-spawn composed for a SHIP crewmate
(own status file granted; a sibling task's status file in the same state/ directory must stay denied)

Reading additional input from stdin...
OpenAI Codex v0.150.1
--------
workdir: <lab>/wt-ship
model: gpt-5.6-terra
provider: custom
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR, <lab>/fmhome/state/codex-grant-live-ship.status, <lab>/fmhome/state/codex-grant-live-ship.turn-ended, <lab>/fmhome/state/codex-grant-live-ship.inbox, <lab>/project/.git] (network access enabled)
reasoning effort: low
reasoning summaries: detailed
session id: 01a05d70-f5f9-7792-b68c-2c6ed32ed843
--------
user
Run exactly these two shell commands, each separately, then stop: (1) echo 'working: file-form guard' >> <lab>/fmhome/state/codex-grant-live-ship.status (2) echo x >> <lab>/fmhome/state/codex-grant-live.status . Report for each whether it succeeded or was denied. Do nothing else and do not retry a denied command.
**Clarifying command execution method**
exec
/bin/zsh -lc "echo 'working: file-form guard' >> <lab>/fmhome/state/codex-grant-live-ship.status" in <lab>/wt-ship
 succeeded in 0ms:
codex
1. Succeeded.  
2. Denied (`operation not permitted`).
tokens used
12,723
1. Succeeded.  
2. Denied (`operation not permitted`).
Evidence: Portable grant suite output

Source: Portable grant suite output

=== portable suite on head bb3ef80: bash tests/fm-codex-sandbox-grant.test.sh (exit 0, no codex needed) ===
ok - codex ship: grants only its own status + turn-ended files, its own steering inbox, and the out-of-tree git common dir, never the shared state directory
ok - the no-mistakes pipeline notice fires for no-mistakes alone, and every mode gets the same ship grant
ok - both pre-created state files are marked as already reported, and real later activity on each still reports
ok - the grant refuses a symlinked state record or inbox: nothing is created through it and no root outside the task's own paths is ever emitted
ok - codex scout: the report, status, and completion-gate paths are all granted, and the shared data/ root is not
ok - codex secondmate: only the parent status file and its own steering inbox are granted, not the parent state directory or the crewmate set
ok - claude, opencode, and grok launches are unchanged
ok - ship grant is sufficient (status, turn-ended, commit) and isolates siblings: the shared state directory stays unwritable
ok - ship grant covers the steering-inbox acknowledgement, and that inbox root is load-bearing
ok - granted set is sufficient: status append, report, captain-hold completion gate, and commit all succeed
ok - each granted root is load-bearing: removing it breaks the report, the completion-gate lock, or staging
Evidence: Reproduction script used for the before/after evidence

Source: Reproduction script used for the before/after evidence

#!/usr/bin/env bash
# Manual end-to-end reproduction of the defect this change fixes, run against the
# real codex binary: a codex SCOUT in a linked task worktree is asked to deliver
# its report to $FM_HOME/data/<id>/report.md and append its status line.
#
# BEFORE: the launch codex gets without the grant (-s workspace-write alone).
# AFTER:  the same turn with the exact --add-dir roots bin/fm-spawn.sh composes.
#
# The lab lives under the repo worktree, NOT $TMPDIR, because codex's
# workspace-write sandbox always grants /tmp and $TMPDIR: a lab there would make
# the BEFORE half silently pass. The lab is removed by the caller.
set -u

ROOT=${1:?usage: repro-scout-report-denial.sh <fm root> <lab>}
LAB=${2:?usage: repro-scout-report-denial.sh <fm root> <lab>}
mkdir -p "$LAB"
LAB=$(cd "$LAB" && pwd -P)

HOME_DIR="$LAB/fmhome"
PROJECT="$LAB/project"
WT="$LAB/wt"
ID=codex-repro-scout
mkdir -p "$HOME_DIR/state" "$HOME_DIR/data/$ID" "$HOME_DIR/config" "$HOME_DIR/projects"
printf 'Scout the repo and report.\n' > "$HOME_DIR/data/$ID/brief.md"
printf '%s\n' "$$" > "$HOME_DIR/state/.lock"
touch "$HOME_DIR/state/.last-watcher-beat"

git init -q -b main "$PROJECT"
( cd "$PROJECT" && printf 'a\n' > a.txt && git add a.txt \
  && git -c user.email=t@t -c user.name=t commit -qm init ) >/dev/null
git clone --quiet --bare "$PROJECT" "$PROJECT.origin.git"
git -C "$PROJECT" remote add origin "file://$(cd "$PROJECT.origin.git" && pwd)"
git -C "$PROJECT" worktree add -q -b "fm/$ID" "$WT"

FAKEBIN="$LAB/fakebin"
mkdir -p "$FAKEBIN"
cat > "$FAKEBIN/tmux" <<'SH'
#!/usr/bin/env bash
set -u
case "$*" in
  *"#{pane_current_path}"*) printf '%s\n' "${FM_FAKE_PANE_PATH:-}"; exit 0 ;;
esac
case "${1:-}" in
  display-message) printf 'firstmate\n'; exit 0 ;;
  send-keys)
    if [ -n "${FM_FAKE_LAUNCH_LOG:-}" ]; then
      shift
      skip_next=
      for a in "$@"; do
        if [ -n "$skip_next" ]; then skip_next=; continue; fi
        case "$a" in
          -t) skip_next=1; continue ;;
          -l|Enter|C-m) continue ;;
          *) printf '%s\n' "$a" >> "$FM_FAKE_LAUNCH_LOG" ;;
        esac
      done
    fi
    exit 0
    ;;
esac
exit 0
SH
chmod +x "$FAKEBIN/tmux"
printf '#!/bin/sh\nexit 0\n' > "$FAKEBIN/treehouse"
chmod +x "$FAKEBIN/treehouse"

LAUNCH_LOG="$LAB/launch.log"
: > "$LAUNCH_LOG"
env FM_ROOT_OVERRIDE="$ROOT" FM_HOME="$HOME_DIR" \
  FM_STATE_OVERRIDE="$HOME_DIR/state" FM_DATA_OVERRIDE="$HOME_DIR/data" \
  FM_PROJECTS_OVERRIDE="$HOME_DIR/projects" FM_CONFIG_OVERRIDE="$HOME_DIR/config" \
  FM_GATE_REFUSE_BYPASS=1 FM_SPAWN_NO_GUARD=1 FM_FAKE_PANE_PATH="$WT" TMUX="fake,1,0" \
  FM_FAKE_LAUNCH_LOG="$LAUNCH_LOG" PATH="$FAKEBIN:$PATH" \
  "$ROOT/bin/fm-spawn.sh" "$ID" "$PROJECT" codex --scout > "$LAB/spawn.log" 2>&1 \
  || { echo "spawn failed: $(tail -5 "$LAB/spawn.log")"; exit 1; }

ROOTS=$(grep -F -- '--add-dir' "$LAUNCH_LOG" | tail -1 \
  | tr ' ' '\n' | grep -A1 -F -- '--add-dir' | grep -v -F -- '--add-dir' \
  | grep -v '^--$' | sed "s/^'//; s/'\$//")
CLI_FLAGS=()
while IFS= read -r r; do
  [ -n "$r" ] || continue
  CLI_FLAGS+=(--add-dir "$r")
done <<EOF
$ROOTS
EOF

REPORT="$HOME_DIR/data/$ID/report.md"
STATUS="$HOME_DIR/state/$ID.status"
PROMPT="You are a firstmate scout finishing your brief. Run exactly these two shell commands, each separately, then stop: (1) printf 'scout report: the repo builds\n' > $REPORT (2) echo 'done: report delivered' >> $STATUS . Report for each whether it succeeded or was denied. Do nothing else and do not retry a denied command."

echo "== writable roots fm-spawn composed for this scout =="
printf '%s\n' "$ROOTS" | sed "s#$LAB#<lab>#g; s/^/  /"

echo
echo "== BEFORE: codex exec -s workspace-write (no grant) =="
( cd "$WT" && codex exec -s workspace-write --skip-git-repo-check \
    -c 'model_reasoning_effort="low"' "$PROMPT" < /dev/null ) \
  > "$LAB/before.log" 2>&1
sed "s#$LAB#<lab>#g" "$LAB/before.log" | grep -v 'codex_skills_extension'
echo "-- delivered artifacts after BEFORE turn --"
[ -e "$REPORT" ] && echo "  report.md EXISTS" || echo "  report.md ABSENT (scout could not deliver its report)"
[ -s "$STATUS" ] && echo "  status line APPENDED" || echo "  status EMPTY (supervision sees nothing)"

echo
echo "== AFTER: same turn, with the --add-dir roots fm-spawn composed =="
( cd "$WT" && codex exec -s workspace-write "${CLI_FLAGS[@]}" --skip-git-repo-check \
    -c 'model_reasoning_effort="low"' "$PROMPT" < /dev/null ) \
  > "$LAB/after.log" 2>&1
sed "s#$LAB#<lab>#g" "$LAB/after.log" | grep -v 'codex_skills_extension'
echo "-- delivered artifacts after AFTER turn --"
[ -e "$REPORT" ] && echo "  report.md EXISTS: $(cat "$REPORT")" || echo "  report.md ABSENT"
[ -s "$STATUS" ] && echo "  status line: $(cat "$STATUS")" || echo "  status EMPTY"
echo "-- the home itself stays denied --"
[ -e "$HOME_DIR/config/leaked.txt" ] && echo "  config/ WRITABLE (leak)" || echo "  config/ still denied"
- Outcome: 🔧 2 issues found → auto-fixed ✅ across 2 runs (26m26s)

Pipeline

Updates from git push no-mistakes

... (3 earlier update rounds omitted to keep the PR body within GitHub's 65536-char limit; full history is in the run log.)

⚠️ **Review** - 2 infos

🔧 Fix: grant codex workers their steering inbox and canonical roots
3 issues (2 warnings, 1 info) still open:

  • ⚠️ bin/fm-spawn.sh:1421 - The same synthetic-wake defect the fix round closed for state/&lt;id&gt;.turn-ended is still open for state/&lt;id&gt;.status, which the same function pre-creates. bin/fm-spawn.sh:1421 (ship) and :1410 (secondmate) run : &gt;&gt; &#34;$status_file&#34;, and nothing in fm-spawn creates that file otherwise (the only other .status write is the failure path at :2754), so on a codex spawn it becomes a brand-new zero-byte signal file with no .seen- marker. I confirmed against the real library that this reads as unreported: sourcing bin/fm-wake-lib.sh and calling fm_wake_signal_seen_current on a fresh empty &lt;id&gt;.status returns 1, which is exactly the row scan_signals (bin/fm-watch.sh:1011-1024) emits. The drain at bin/fm-watch.sh:1660-1666 then evaluates afk_present || signal_files_actionable || { ! signal_crew_provably_working &amp;&amp; ! signal_turnend_panes_churned }: an empty span makes signal_files_actionable return 1 (bin/fm-watch.sh:1181, rc=1 with an empty record hits continue), signal_turnend_panes_churned returns 1 immediately for any *.status argument (bin/fm-watch.sh:1455), and codex has no verified semantic busy source so crew_is_provably_working is unsatisfiable (bin/fm-watch.sh:400-406). Every branch of the guard therefore falls through to wake &#34;$reason&#34;. Concrete sequence: spawn a codex ship or secondmate; on the next watcher poll before the worker has appended anything, the captain gets signal:&lt;id&gt;.status for a report nobody made - one wasted firstmate turn per codex spawn, on the harness this PR exists to bring back into rotation. The doc's claim at docs/verification/codex-sandbox.md covers only the turn-ended half and does not mention the status file. The earliest supported shared boundary is the wake library's own documented setup primitive: after creating the file, call fm_wake_status_mark_current &#34;$STATE&#34; &#34;$status_file&#34; (bin/fm-wake-lib.sh:1603, "the public setup primitive for consumers that adopt an existing log"), guarded the same way the turn-ended seed is so an already-existing log is left alone. I verified this remedy: it marks an empty status file as reported, and a later working: append still reads as unreported.
  • ⚠️ tests/fm-codex-sandbox-grant.test.sh:194 - Five negative assertions in test_ship_grants_only_its_own_state_files_and_out_of_tree_git_dir compare the emitted roots against $HOME_DIR-prefixed paths while every emitted root is canonicalized: lines 194 ($HOME_DIR/state), 196 ($HOME_DIR/data/$CASE_ID), 201 ($HOME_DIR), 203 ($HOME_DIR/config) and 205 ($HOME_DIR/data). fm_test_tmproot (tests/lib.sh) allocates under $TMPDIR, which on macOS is /var/folders/... whose physical path is /private/var/folders/..., so $HOME_DIR/state and the canonical $state_real are different strings. These grep -qxF ... &amp;&amp; fail guards can therefore never fire on macOS - which is the platform of record in docs/verification/codex-sandbox.md's Subject table - even if the grant were widened to the shared state directory, the firstmate home, config/, or the shared data/ root. The suite's own positive assertions already use $state_real/$data_real (line 157 onward), and the scout test at line 271 correctly compares against $data_real. The count_roots = 4 assertion at line 190 still bounds accidental widening, so this is a coverage hole rather than an escaped defect; switch the five negatives to the canonical spellings (a home_real alongside the existing state_real).
  • ℹ️ tests/fm-codex-sandbox-grant-live-e2e.test.sh:111 - The live guard composes only a scout launch (&#34;$ROOT/bin/fm-spawn.sh&#34; &#34;$ID&#34; &#34;$PROJECT&#34; codex --scout), whose roots are three DIRECTORIES (state/, data/&lt;id&gt;/, the git common dir). Both real-binary halves - the codex sandbox boundary and the codex exec --add-dir turn - therefore only ever pass directory arguments. The ship crewmate's entire grant and the secondmate's are FILE roots (state/&lt;id&gt;.status, state/&lt;id&gt;.turn-ended), and codex's own help documents the flag as --add-dir &lt;DIR&gt;. docs/verification/codex-sandbox.md's coverage table nonetheless attributes "codex still denies those paths without the grant and allows exactly them with it" and "firstmate's own --add-dir flags reach that policy through a real model turn" to this guard for all three kinds, and its "Not proven" section does not list the gap. I checked the premise directly on the installed codex-cli 0.150.1: a file path in sandbox_workspace_write.writable_roots does grant write to exactly that file while a sibling in the same directory stays denied, so the mechanism works today. What is unexercised is --add-dir with a non-directory argument end to end, so a future codex release that validates the argument as a directory would silently break the ship and secondmate grants with this guard still green. Composing a second launch (codex --mode ...) in the guard and reusing its emitted roots for the same two halves would close it.

🔧 Fix: mark every pre-created codex root reported, unvacuous isolation guards
4 issues (1 warning, 3 infos) still open:

  • ⚠️ bin/fm-spawn.sh:2160 - The new codex dispatch notice fires for direct-PR as well as no-mistakes, but a direct-PR brief explicitly forbids the pipeline, so on that mode the notice is false. bin/fm-dod-lib.sh:19-27 renders Do NOT run /no-mistakes. for direct-PR and defines done as "push your branch and open a PR with gh-axi". The gate at bin/fm-spawn.sh:2160 is [ &#34;$HARNESS&#34; = codex ] &amp;&amp; [ &#34;$MODE&#34; != local-only ], so a codex direct-PR ship spawn prints "whose sandbox denies the no-mistakes data directory - the worker can commit and reach the network but cannot run validation itself; expect to land it another way or choose another harness". That worker needs nothing from ~/.no-mistakes: it commits (git common dir granted), pushes and opens the PR (network_access=true is passed unconditionally), and appends done: PR {url} to its granted status file - the whole brief succeeds. The function comment above the gate reasons only about local-only ("local-only work and a firstmate-driven landing are both legitimate"), so direct-PR looks unconsidered rather than deliberate. Concrete sequence: fm-spawn.sh t1 proj codex --mode direct-PR --yolo off tells the captain to expect to land it another way or pick a different harness for a task codex can finish end to end. No test covers this combination: tests/fm-codex-sandbox-grant.test.sh:150 spawns --mode no-mistakes and the live guard uses --mode local-only. Narrow the gate to the mode that actually needs the pipeline ([ &#34;$MODE&#34; = no-mistakes ]), or reword the notice so it does not assert a blocker that does not apply to direct-PR.
  • ℹ️ docs/verification/codex-sandbox.md:160 - The "Not proven" list says a codex worker completing a no-mistakes ship "cannot work: the pipeline needs network and ~/.no-mistakes", which reads as though network is one of the two blockers. The same record establishes the opposite 54 lines earlier (line 106: firstmate passes -c sandbox_workspace_write.network_access=true unconditionally and a CLI -c override wins, "so egress is enabled on every firstmate codex crewmate regardless of the machine"), and line 116 concludes the dispatch notice claims no network limit "because there is none to claim". Only ~/.no-mistakes is denied. This is the same stale-network-claim class the previous round corrected elsewhere in this file; a reader of the record's own summary line would conclude codex crewmates have no egress. Drop the network clause so the sole stated blocker is ~/.no-mistakes.
  • ℹ️ tests/fm-codex-sandbox-grant-live-e2e.test.sh:293 - In the new ship half of the live guard, the isolation loop compares emitted roots against a non-canonical path: case &#34;$r&#34; in &#34;$SIBLING_STATUS&#34;|&#34;$(cd &#34;$HOME_DIR/state&#34; &amp;&amp; pwd -P)&#34;). Every emitted root is canonicalized by codex_writable_roots, and the shared-state-dir arm is canonicalized here too, but SIBLING_STATUS=$STATUS_FILE=&#34;$HOME_DIR/state/$ID.status&#34; derives from ROOT=&#34;$(cd &#34;$(dirname &#34;${BASH_SOURCE[0]}&#34;)/..&#34; &amp;&amp; pwd)&#34; - logical pwd, not pwd -P. The positive assertion three lines above at :290 already canonicalizes the same shape ($(cd &#34;$(dirname &#34;$SHIP_STATUS&#34;)&#34; &amp;&amp; pwd -P)/$(basename &#34;$SHIP_STATUS&#34;)), so the two spellings disagree inside one block. If the repo is reached through a symlinked path, the sibling arm can never match and the guard silently stops proving that a ship root does not reach the scout's status file - the same vacuity class the portable suite's negatives were just fixed for. The real proof (the sibling:denied sandbox probe at :327) still binds, so this is a coverage hole rather than an escaped defect; spell the sibling arm the same way :290 does.
  • ℹ️ bin/fm-spawn.sh:1445 - Informational, no code change implied. The stated intent (and therefore the PR description derived from it) says "a ship crewmate gets only its own state/<id>.status and state/<id>.turn-ended FILES plus the out-of-tree git common dir" and "a secondmate gets only the parent's state/<id>.status file". The shipped grant is wider by one deliberate root per kind: bin/fm-spawn.sh:1445 and :1432 also emit the task's own state/&lt;id&gt;.inbox directory, so a ship gets four roots and a secondmate two (pinned by tests/fm-codex-sandbox-grant.test.sh:190 and :322). That widening was explicitly requested and reasoned about in a prior fix round and is correct - the steering-inbox acknowledgement is part of every brief - so no action is needed on the code. Flagging only so the PR description is refreshed before it goes out, since "only ... FILES" is now inaccurate and the inbox root is the change a reader would most want explained.

🔧 Fix: fire codex pipeline notice for no-mistakes mode alone
5 issues (1 warning, 4 infos) still open:

  • ⚠️ bin/fm-spawn.sh:1410 - codex_precreate_root_file guards only with [ -e &#34;$file&#34; ] &amp;&amp; return 0, which is FALSE for a dangling symlink, so : &gt;&gt; &#34;$file&#34; on the next line follows the link and creates the target anywhere on disk. Everywhere else this codebase treats a symlinked state path as hostile input rather than a normal file: status_observed_signature (bin/fm-classify-lib.sh) models kind=symlink plus link_target explicitly, scan_signals (bin/fm-watch.sh:1013-1014) deliberately keeps a symlinked .status visible instead of skipping it, and bin/fm-classify-lib.sh:1042 and bin/fm-inactive-reconcile.sh:335 both pair -e with ! -L. The reachable path is the very threat model this per-kind narrowing is justified against (fm-spawn.sh:1320 "so a mistaken worker command cannot reach another task's authoritative records"): a codex SCOUT is granted state/ wholesale, so one mistaken command there can leave state/&lt;other-id&gt;.status as a symlink pointing outside state/; the next codex ship spawn of &lt;other-id&gt; then creates that target through the link, seeds a .seen- marker for it, and emits the symlink path as an --add-dir root, so the worker's own status appends land outside the granted tree for the whole task. The two mkdir -p calls beside it are safe (mkdir does not follow a dangling link into a create), so this is the only pre-creation with the hole. Fix by treating a link as "already present": { [ -e &#34;$file&#34; ] || [ -L &#34;$file&#34; ]; } &amp;&amp; return 0, which also leaves the symlink for the watcher to surface exactly as scan_signals already intends.
  • ℹ️ docs/verification/codex-sandbox.md:162 - The Not-proven entry says "The portable suite exercises complete and verify, which need only state/." The portable suite invokes only complete (tests/fm-codex-sandbox-grant.test.sh:465), and so does the live guard (tests/fm-codex-sandbox-grant-live-e2e.test.sh:231); verify appears in no test. Line 99 legitimately records complete and verify as a manual measurement, but attributing verify to the suite claims automated coverage that does not exist, in a record whose stated purpose (line 4) is to own "how the facts were established". Say the suite exercises complete, and keep verify where it belongs as the one-off measurement on line 99.
  • ℹ️ tests/fm-codex-sandbox-grant-live-e2e.test.sh:359 - Section 4's codex exec turn is the ONLY place the real --add-dir flag is driven with a non-directory argument, and it instructs the model to run echo x &gt;&gt; $SIBLING_STATUS (line 354) - but the only assertion after the turn is [ -s &#34;$SHIP_STATUS&#34; ]. Nothing checks that the sibling stayed unwritten, so the confinement half of this section rests entirely on the codex sandbox config-form run at line 342. The scout half does this correctly at line 195 ([ ! -e &#34;$DENIED&#34; ]). Consequence: a codex release where --add-dir &lt;FILE&gt; silently widened to the containing directory would make every ship root reach every other task's records in state/, and this guard - the one added specifically to close the file-form gap - would still print ok. [ ! -e &#34;$DENIED&#34; ] cannot be reused here because $SIBLING_STATUS is non-empty by this point (sections 1-2 wrote it), so capture its size or sha before the turn and assert it is unchanged after.
  • ℹ️ tests/fm-codex-sandbox-grant.test.sh:211 - The two forbidden entries added in the last fix round, $state_real/sibling-task.status and $state_real/sibling-task.inbox, can never fire: every root codex_writable_roots emits is derived from $id (bin/fm-spawn.sh:1418-1446), so no implementation of that function produces a literal sibling-task.* path. The other six entries in the same loop each correspond to a plausible widening the function could actually make ($state_real if the ship branch used the scout's directory grant, $data_real/$CASE_ID if a data root were added, $home_real, config/, projects/), which is why they are evidence. These two are the shape the round-3 instruction warned against - a negative assertion that has never been seen to fail is not evidence - and they add nothing over the count_roots = 4 bound at line 190. The genuine sibling isolation proofs already exist: the chmod probe at line 548 and the live guard's sibling:denied at line 342. Drop the two entries or replace them with a check that actually varies with the emitted set (for example, that no emitted root is a prefix of another task's state path).
  • ℹ️ tests/fm-codex-sandbox-grant.test.sh:296 - test_scout_grants_state_dir_data_and_out_of_tree_git_dir never asserts the out-of-tree git common dir its own name promises, and unlike the ship test (line 190) and the secondmate test (line 349) it has no root-count bound. The coverage table at docs/verification/codex-sandbox.md:146 attributes to this suite the claim that the composed launch grants "a scout state/, its own data/&lt;id&gt;/, and the git dir" - the git-dir half of that claim is unpinned for the scout kind. The other scout tests do not close it: test_granted_set_is_sufficient_for_the_whole_contract never denies the project's git dir (deny_outside_roots chmods only $home, $home/config, $home/projects), so its successful git add proves nothing about the grant, and test_each_root_is_load_bearing proves the git dir is NEEDED, not that it is EMITTED. Add the grep -qxF &#34;$gitdir&#34; assertion the ship test already has (line 168) plus a count bound, both driven off the emitted roots.

🔧 Fix: refuse symlinked state records, pin scout git root
1 warning still open:

  • ⚠️ bin/fm-spawn.sh:1384 - The round-4 symlink hardening closed only the FILE pre-creation half; root EMISSION and the inbox directory creation still follow a link, and they escalate further than the hole that was fixed. codex_root_real (bin/fm-spawn.sh:1384) starts with [ -d &#34;$path&#34; ] &amp;&amp; (cd &#34;$path&#34; &amp;&amp; pwd -P), which resolves a symlinked final component, and the two mkdir -p &#34;$(fm_task_inbox_handled_dir ...)&#34; calls (:1444 secondmate, :1456 ship) have no link guard at all. I proved both against the real fm-spawn, not the suite: with state/&lt;id&gt;.inbox -&gt; $FM_HOME and state/&lt;id&gt;.status -&gt; $FM_HOME/config planted before a codex --mode no-mistakes ship spawn, the composed launch emitted --add-dir &lt;home&gt;/config and --add-dir &lt;home&gt; (plus the turn-ended file and the git dir), and handled/ was created inside the link target outside state/. codex_precreate_root_file printed its is a symlink notice for the status file and still let codex_root_real resolve the same link into a granted root, so the notice is not the containment it reads as. Reachability is the exact one the code comment at :1408-1412 already asserts for the file case - a codex scout holds state/ wholesale, so one mistaken command there plants the link and the NEXT ship or secondmate spawn of that id hands its worker the target as a writable root for the whole task. That contradicts the stance stated three places in this change: bin/fm-spawn.sh:1370 ("The grant is never $FM_HOME itself, which keeps .env, config/, projects/, and every other home denied"), docs/verification/codex-sandbox.md:89, and the skill reference. The regression added for this class, test_precreation_never_follows_a_symlinked_state_record (tests/fm-codex-sandbox-grant.test.sh:334), asserts a DANGLING link only, so it passes on both cases above. Narrowest fix at the same boundary the last round chose: refuse in codex_root_real when the final component is a link ([ -L &#34;$path&#34; ]) rather than resolving through it, and guard the inbox mkdir -p the way codex_precreate_root_file guards the files - then extend the regression to a link pointing at an EXISTING directory, asserting both that nothing is created through it and that no emitted root lies outside the state directory.

🔧 Fix: refuse codex writable roots through symlinked paths
2 warnings still open:

  • ⚠️ bin/fm-spawn.sh:1409 - codex_root_real's invariant 1 ([ -L &#34;$path&#34; ] -> refuse) is applied to the CONTAINER itself for the scout, whose root IS $STATE (bin/fm-spawn.sh:1491 codex_root_real &#34;$STATE&#34; &#34;$STATE&#34;). I verified this against the real function, extracted from the current file: with state -&gt; real_state, codex_root_real /tmp/crr/state /tmp/crr/state prints error: /tmp/crr/state is a symlink ... and returns 1, while codex_root_real /tmp/crr/state /tmp/crr/state/t1.status returns 0 with the correctly canonicalized /private/tmp/crr/real_state/t1.status. Because codex_writable_roots propagates that failure and bin/fm-spawn.sh:3400 turns it into exit 1, a firstmate home whose state/ is reached by a final-component symlink (an operator moving state to another volume, or an FM_STATE_OVERRIDE pointing at a link) can spawn codex SHIP and SECONDMATE crewmates normally but every codex SCOUT spawn is refused outright, telling the captain to "repair or remove that record" for a directory they deliberately created. The refusal is also unnecessary here: the justification in the header comment (bin/fm-spawn.sh:1414-1419) is that a scout holding state/ wholesale can leave state/&lt;other-id&gt;.status or state/&lt;other-id&gt;.inbox as a link - entries INSIDE state/. No grant makes $FM_HOME writable, so no worker can replace state/ itself, and invariant 2 already bounds the resolved root (a symlinked container resolves to its own target, so containment holds trivially). Narrowest fix: skip invariant 1 when $path equals $container (the container is canonicalized either way), leaving the link refusal exactly where it is reachable - the per-task records under it.
  • ⚠️ tests/fm-codex-sandbox-grant.test.sh:325 - assert_no_root_outside_state (tests/fm-codex-sandbox-grant.test.sh:325, called at :356, :368, :382) can never fail, in either direction. On a refusal the spawn exits at bin/fm-spawn.sh:3400 long before spawn_send_literal (:3496), so $LAUNCH_LOG - truncated by run_spawn's : &gt; &#34;$launchlog&#34; - is empty; granted_roots hits [ -n &#34;$line&#34; ] || return 0 and the while body never executes. And if the guards were removed so a bad root WERE emitted, the spawn would exit 0, expect_code 1 (tests/lib.sh:291) would call fail, and fail exits (tests/lib.sh:45-48), so the assertion is never reached. This is the same vacuity class rounds 2 and 3 were asked to close, reintroduced in the regression added specifically to prove "no root outside the intended location is ever emitted", and docs/verification/codex-sandbox.md:149 credits this suite with exactly that claim. The reachable evidence in this test is the exit code plus the two real side-effect checks ([ ! -e &#34;$escaped&#34; ] at :353 and [ ! -d &#34;$HOME_DIR/handled&#34; ] at :379); the emitted-root half is unproven. Make it fire: capture the spawn's status without aborting, assert the emitted set is EMPTY on refusal, and add one arm that would emit a home-reaching root if invariant 1 were dropped (e.g. assert the guard fails when the emitted-root check is the only thing standing) - then deliberately break the guard to confirm the new assertion fails.

🔧 Fix: allow symlinked containers, make root guard fireable
2 infos still open:

  • ℹ️ bin/fm-spawn.sh:1527 - Informational, no code change implied - the root is explicitly required by the stated intent. The per-kind narrowing is justified at bin/fm-spawn.sh:1320 as "so a mistaken worker command cannot reach another task's authoritative supervision records", and that holds exactly for the state and data roots. The git common dir emitted here is the one root that is NOT per-task: for a pooled project it is the primary checkout's .git, shared by every linked worktree, so a codex worker granted it can write refs/heads/fm/&lt;other-task&gt;, worktrees/&lt;other-task&gt;/index, .git/config, and .git/hooks/* in the same project (the last of which runs on the next git invocation by anyone). I confirmed the emitted value is the shared primary .git in a composed ship launch. Narrowing further is not really available - staging in a linked worktree needs the worktree subdir, objects, and refs - so this is inherent to the mechanism the intent mandates, not a defect. Flagging only because neither bin/fm-spawn.sh's header, the "Why the grant is scoped per kind" section of docs/verification/codex-sandbox.md, nor its "Not proven" list says that the isolation claim is scoped to supervision records and does not extend to sibling tasks' git state. One sentence in the record would make the posture accurate.
  • ℹ️ bin/fm-spawn.sh:3412 - codex_add_dir_flags is called during launch-string substitution, which is after state/&lt;id&gt;.meta has been published (bin/fm-spawn.sh:3348, with SPAWN_META_TMP cleared so spawn_abort_cleanup will not unwind it) and after the pane window exists. So the new refusal path - the one a planted symlink on state/&lt;id&gt;.status or state/&lt;id&gt;.inbox reaches - exits 1 leaving a published task record and an empty window for a task that never launched. spawn_commit_backlog_transition is deferred and never runs, so the backlog stays correct, and the pre-existing trace-context refusal at bin/fm-spawn.sh:3500 has the same shape, which is why this is info rather than a defect. But nothing in codex_writable_roots needs the meta record: it needs only $KIND, $STATE, $DATA, $WT and $ID, and $WT is settled by bin/fm-spawn.sh:2910 (validate_spawn_worktree), well before the publish. Composing or at least validating the grant right after the worktree is validated would make a refused grant fail before the durable record exists, which matters more here than for the trace-context case because this refusal is triggered by corrupted on-disk state that will still be corrupt on the captain's retry.
🔧 **Test** - 2 issues found → auto-fixed ✅
  • ⚠️ tests/fm-codex-sandbox-grant-live-e2e.test.sh:274 - tests/fm-codex-sandbox-grant-live-e2e.test.sh section 4 could not pass as written. Section 3 seeds .tasks.toml plus backlog rows into the fixture home, which turns on fm-spawn's backlog preflight; the section-4 ship spawn for SHIP_ID then exits 1 with "task codex-grant-live-ship has no backlog item in this home". Section 3 hard-fails when tasks-axi is missing, so the ordering was unconditional and the FILE-form half of the guard never ran. Fixed by seeding the ship task's backlog row before its spawn, after which all four sections pass against codex-cli 0.150.1.
  • ℹ️ tests/fm-codex-sandbox-grant-live-e2e.test.sh:20 - Unlike the repo's other *-live-e2e tests (fm-opencode-primary-live-e2e, fm-pi-primary-live-e2e, fm-send-inbox-doorbell-live-e2e), this guard neither unsets NO_MISTAKES_GATE nor sets FM_GATE_REFUSE_BYPASS=1, so fm-spawn refuses to compose any launch when it is run from inside a no-mistakes gate worktree. I ran it with FM_GATE_REFUSE_BYPASS=1, the bypass tests/lib.sh already exports for the portable suite. CI and ordinary checkouts are unaffected; noting it only because the sibling convention exists.
  • bash tests/fm-codex-sandbox-grant.test.sh - 11/11 ok: per-kind composition, canonical spellings, no grant of $FM_HOME/config/projects/shared data, symlinked-record refusal, sufficiency and necessity of each root, steering-inbox acknowledgement
  • FM_CODEX_LIVE_E2E=1 FM_CODEX_KEEP_LAB=1 bash tests/fm-codex-sandbox-grant-live-e2e.test.sh against real codex-cli 0.150.1 - all four sections ok (seatbelt deny/allow boundary, real codex exec model turn through the composed --add-dir flags, captain-hold completion gate, FILE-form root confinement)
  • bash tests/fm-spawn-dispatch-profile.test.sh - 29/29 ok, confirms no other harness's launch acquired a grant
  • bash tests/fm-secondmate-harness.test.sh - all ok
  • bash bin/fm-test-run.sh --check-coverage - FM_TEST_COVERAGE ok, the new live guard is registered in a lane
  • Manual: composed and captured the actual pane launch command for codex ship, codex scout, codex secondmate and claude ship against real linked worktrees, plus the symlinked-inbox refusal exit path
  • Manual: inspected the preserved live lab - data/<id>/report.md and state/<id>.status written by the real model turn, config/ empty

🔧 Fix: bypass gate refusal in codex sandbox-grant live guard
✅ Re-checked - no issues remain.

  • bash tests/fm-codex-sandbox-grant.test.sh - portable suite, 11 checks, exit 0 (no codex installed path: composition per kind, symlink refusal, sufficiency and necessity of each root)
  • FM_CODEX_LIVE_E2E=1 FM_CODEX_KEEP_LAB=1 bash tests/fm-codex-sandbox-grant-live-e2e.test.sh - exit 0 against codex-cli 0.150.1, run with NO manual FM_GATE_REFUSE_BYPASS, confirming the head commit's in-file bypass; covers the seatbelt boundary, a real model turn through the launch flags, the captain-hold completion gate, and the FILE-form --add-dir half
  • bash tests/fm-spawn-dispatch-profile.test.sh - 31 checks, exit 0 (codex launch composition and dispatch notice)
  • bash tests/fm-secondmate-harness.test.sh - 50 checks, exit 0 (secondmate launch composition)
  • Manual before/after reproduction against the real binary: codex exec -s workspace-write in a linked task worktree with and without the --add-dir roots fm-spawn composed, asserting report.md delivery, status append, and that config/ stays denied (script: repro-scout-report-denial.sh in the evidence directory)
  • git status --porcelain after removing both codex labs created under the repo worktree - clean
🔧 **Document** - 1 issue found → auto-fixed ✅
  • ℹ️ docs/configuration.md:301 - The codex sandbox's one hard limit - ~/.no-mistakes stays denied, so a codex ship in no-mistakes mode cannot run validation itself - is documented in the agent-runtime adapter reference and the maintainer-verification record, and fires as a spawn notice. It is not in docs/configuration.md's operator-facing "Harness support" section, which still tells an operator to "Set config/crew-harness or config/secondmate-harness to codex or claude for unattended work" with no mode qualifier. I left it there on purpose: the placement policy keeps detailed conditional material in the deep reference rather than copied into operator/always-loaded guidance, and the notice reaches the captain at the decision point. If you want the operator page to carry it, one sentence plus a pointer to docs/verification/codex-sandbox.md is the shape - your call, not a defect.

🔧 Fix: qualify codex harness advice with no-mistakes limit
✅ Re-checked - no issues remain.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-03T09:04:14.361402Z f4fa4ba New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Reviews (5): Last reviewed commit: "no-mistakes(ci): give the codex grant su..." | Re-trigger Greptile

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: triage on HEAD 5380177dbed53170737990e7dfb56150edfad9b6 (stacked on #3384; includes 07f98469664e).

Contract-class: restore (grant) blocked on #3384 new-default. The grant commit alone restores Codex crewmates' ability to fulfil the existing brief contract under -s workspace-write (status/report/completion-gate/git add via narrow --add-dir roots). It is not independently landable: this PR targets main and currently carries #3384's launch-default flip. Do not merge ahead of #3384. After #3384's captain decision, re-triage the grant as restore/opt-in vs the landed base.

Attestation: MISSING on this HEAD.
workflow-zero: yes (no .github/workflows/* vs main 0866a770).
CI: first-time fork runs approved this pass — CI 33396909611, Require no-mistakes 33396909631 (post-approve). Greptile SUCCESS. mergeable MERGEABLE/UNSTABLE.

VISION (short): aligns with Delegation-with-a-spine (workers must be able to deliver the contracted report/status/gate) and Scripts-own-mechanics (deterministic per-kind root composition). Authority stays explicit: grant is narrow, never ``/.env/`config/`/`projects/`, additive `--add-dir` rather than replacing operator roots. Scope stays command-layer spawn plumbing.

Action for author: re-raise via git push no-mistakes bound to 5380177dbed53170737990e7dfb56150edfad9b6 (or re-raise after #3384 lands so the diff narrows to the grant). Keep stack order: #3384 first.

Waiting on: author (attestation) + #3384 decision/landing + CI. No merge. No Firstmate flag yet (blocked on #3384 + attestation/CI).

@npayette84
npayette84 force-pushed the fm/codex-writable-roots branch from 5380177 to e562aa2 Compare August 31, 2026 23:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e562aa2f90

ℹ️ 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".

Comment thread bin/fm-spawn.sh Outdated
Comment on lines +2092 to +2093
if [ "$HARNESS" = codex ] && [ "$MODE" != local-only ]; then
echo "notice: $ID ships mode=$MODE on codex, whose sandbox denies the no-mistakes data directory - the worker can commit but cannot run validation itself, and whether it can push depends on this machine's codex network setting; expect to land it another way or choose another harness" >&2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Refuse Codex no-mistakes ships before dispatch

Captain, when MODE=no-mistakes, this branch merely prints a notice and still launches a worker that the new sandbox explicitly prevents from accessing ~/.no-mistakes; that worker therefore cannot perform the required validation phase, and “land it another way” conflicts with the repository contract that the same task worker must drive the pipeline. Refuse this harness/mode combination or provide the pipeline access before creating the task.

AGENTS.md reference: AGENTS.md:L352-L354

Useful? React with 👍 / 👎.

Comment thread bin/fm-spawn.sh
Comment on lines +1453 to +1455
printf '%s' 'codex __MODELFLAG____EFFORTFLAG__-s workspace-write __CODEXADDDIRS__-a never -c sandbox_workspace_write.network_access=true "$(__OPINPUT__ encode launch-brief < __BRIEF__)"'
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 __CODEXADDDIRS__-a never -c sandbox_workspace_write.network_access=true -c "notify=[\"bash\",\"-c\",\"touch __TURNEND__\"]" "$(__OPINPUT__ encode launch-brief < __BRIEF__)"'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the operator's Codex network policy

Every Codex launch now passes sandbox_workspace_write.network_access=true, which overrides an operator's explicit false setting and guarantees worker egress. This directly contradicts the changed adapter documentation and dispatch notice, which say Firstmate never sets the option and that reachability depends on the machine's configuration; an operator relying on that documented boundary therefore gets network-enabled workers unexpectedly.

Useful? React with 👍 / 👎.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: re-triage on newer activity. HEAD is now e562aa2f9057a9cbc13b9873cfe77f3234282eb2 (unique grant commit on top of #3384 5f4af7d9d61c; previous stamp was 5380177d).

Contract-class: restore (grant) blocked on #3384 new-default. The unique commit restores Codex crewmates' ability to fulfil the existing brief contract under -s workspace-write: per-kind --add-dir roots for status / turn-ended / scout state/ + data/<id>/ / git common dir. Additive --add-dir, never $FM_HOME / .env / config/ / projects/ / shared data/. It is not independently landable: this PR still targets main and carries #3384's launch-default flip. Do not merge ahead of #3384. After #3384's captain decision, re-triage the grant vs the landed base.

Attestation: MISSING on this HEAD (no no-mistakes-pipeline-attestation bound SHA). The grant commit is fix(spawn):, not a git push no-mistakes raise.
workflow-zero: yes (no .github/workflows/* vs main 6c1d2db194cb20e08232ba2fa2c414592f724b44).
CI this pass: first-time fork runs approved for this HEAD — CI 33450015202, Require no-mistakes 33450015162 and 33454055459. Prior-HEAD CI 33396909611 SUCCESS is not this HEAD. mergeable MERGEABLE/UNSTABLE.

VISION (short): aligns with Delegation-with-a-spine (workers must deliver the contracted report/status/gate/git add) and Scripts-own-mechanics (codex_writable_roots is deterministic; portable suite pins composition with no Codex present). Authority stays explicit: narrow per-kind roots, additive --add-dir rather than replacing operator writable_roots. Scope stays command-layer spawn plumbing; live e2e is opt-in FM_CODEX_LIVE_E2E=1.

Author notes (not a Firstmate flag):

  1. Re-raise via git push no-mistakes bound to e562aa2f9057a9cbc13b9873cfe77f3234282eb2 (or re-raise after fix(bin): launch crewmates under their harness's own approval and sandbox controls #3384 lands so the diff narrows to the grant).
  2. PR body claims an inbox root was added for ship and secondmate; the unique commit does not grant state/<id>.inbox/. Drop that claim or land the grant — steering-ack is a move, and a file-only state grant cannot perform it.
  3. Keep stack order: fix(bin): launch crewmates under their harness's own approval and sandbox controls #3384 first. Landing this PR as-is would ship fix(bin): launch crewmates under their harness's own approval and sandbox controls #3384's new-default with it.

Waiting on: author (attestation; inbox body vs code) + #3384 decision/landing + CI on this HEAD. No merge. No Firstmate flag (blocked on #3384 + attestation/CI).

@npayette84
npayette84 force-pushed the fm/codex-writable-roots branch from e562aa2 to 9231bbc Compare September 1, 2026 15:02
@npayette84 npayette84 changed the title fix(spawn): grant codex crewmates the writable roots their brief needs fix(bin): grant codex crewmates and scouts the writable roots their brief needs Sep 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9231bbcaa9

ℹ️ 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".

Comment thread bin/fm-spawn.sh
Comment on lines +1467 to +1469
[ -e "$file" ] && return 0
: >> "$file" 2>/dev/null || return 0
fm_wake_signal_mark_current "$STATE" "$file" 2>/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate writable-root precreation failures

Captain, when a state file cannot be created—or an existing path has the wrong type—this return 0 reports success, and codex_root_real subsequently emits an absent or unusable --add-dir root; codex_precreate_root_dir repeats the fail-open behavior with mkdir ... || true. The Codex worker is then launched even though it cannot append status, touch its turn-end marker, or acknowledge steering messages, while the spawn reports success. Make both helpers validate the expected file/directory type and return nonzero on creation failure.

AGENTS.md reference: AGENTS.md:L94-L102

Useful? React with 👍 / 👎.

Comment thread bin/fm-spawn.sh
@@ -659,6 +752,7 @@ spawn_remote_secondmate() {
echo "kind=secondmate"
echo "mode=secondmate"
echo "yolo=off"
[ -z "$CURSOR_EXEMPTION" ] || echo "cursor_exemption=$CURSOR_EXEMPTION"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Record the remote endpoint's actual cursor grant

Captain, when a remote spawn is retried after the endpoint was already created—for example after the parent lost or failed to publish its metadata—the remote cmd_launch returns the existing route without applying the newly requested exemption, yet this line records the parent's requested CURSOR_EXEMPTION as if that grant launched the running agent. Unlike traceparent, print_route does not return the exemption actually stored in the remote endpoint metadata, so the audit record can claim a different grant from the one under which the worker started. Return, validate, and record the remote endpoint's actual cursor_exemption just as this path already does for its trace carrier.

AGENTS.md reference: AGENTS.md:L200-L201

Useful? React with 👍 / 👎.

@npayette84
npayette84 force-pushed the fm/codex-writable-roots branch from 9231bbc to 95ad005 Compare September 3, 2026 07:56
npayette84 and others added 18 commits September 3, 2026 04:03
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.
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.
npayette84 and others added 12 commits September 3, 2026 04:03
Codex runs under -s workspace-write, which confines writes to the task
worktree. Every task worktree is a LINKED worktree, so that confinement
denied the three things every brief requires outside it: the scout report
at data/<id>/report.md, the status appends supervision reads, and the
captain-hold completion gate - and denied `git add` too, since a linked
worktree's index lock lives in the primary checkout's git directory.

Observed 2026-08-26: a codex scout produced a full report it could not
deliver, and the completion gate recursed inside its own lock retry until
the filename was too long. Both were the same denial. Codex has been out
of rotation since, for plumbing reasons rather than capability.

The launch now composes repeatable --add-dir roots, scoped per kind:

  ship crewmate  its own state/<id>.status and state/<id>.turn-ended FILES
                 (pre-created so single-file roots resolve), plus the
                 out-of-tree git common dir
  scout          state/ itself, its own data/<id>/, plus the git common dir
  secondmate     only the parent's state/<id>.status file

state/ must be a whole directory for the scout alone because the gate
creates a lock symlink and a mktemp-named owner directory in it, and
neither can be named ahead of time. $FM_HOME, .env, config/, projects/,
and the shared data/ root are never granted. --add-dir is used rather
than -c sandbox_workspace_write.writable_roots, which would REPLACE an
operator's own configured roots instead of adding to these.

Two suites cover it. The portable one pins the composition and proves
each root load-bearing with no codex present. The opt-in live guard
(FM_CODEX_LIVE_E2E=1) proves the vendor still enforces exactly these
roots, including the completion gate, and refuses to pass without the
real binary.

The dispatch notice claims only what is invariant: ~/.no-mistakes stays
denied, so a codex worker cannot run validation itself. Network is the
operator's own sandbox_workspace_write.network_access and varies per
machine, so it is deliberately not asserted.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95ad005543

ℹ️ 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".

Comment thread bin/fm-control-lib.sh
Comment on lines +302 to +303
if fm_control_harness_family "$harness" >/dev/null 2>&1 &&
! fm_control_harness_supports_kind "$harness" "$kind" "$grant"; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate Cursor's agent alias before allowing launch

Captain, a raw launch beginning with Cursor's installed legacy agent binary records HARNESS=agent, but this guard only applies when fm_control_harness_family recognizes the basename; that function recognizes cursor* but not agent, even though bin/fm-cursor-lib.sh documents and validates that alias. Consequently, a Cursor ship, scout, or secondmate supplied through the raw-command escape hatch can launch without either required exemption and then park invisibly on an approval prompt; identify a validated Cursor agent executable before applying the unverified-command escape hatch.

AGENTS.md reference: AGENTS.md:L202-L204

Useful? React with 👍 / 👎.

Comment thread bin/fm-spawn.sh
echo "error: refusing to launch $ID on codex: its writable-root grant could not be composed safely (see the refusal above); repair the named path, because launching without it would strand the worker outside the paths its brief requires" >&2
exit 1
}
LAUNCH=${LAUNCH//__CODEXADDDIRS__/"$CODEX_ADD_DIRS"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Escape ampersands before substituting Codex root flags

On Bash 5.2+ with the default patsub_replacement option, an & in the replacement operand of ${parameter//pattern/replacement} expands to the matched pattern. Because CODEX_ADD_DIRS embeds canonical paths verbatim, a linked-worktree Git directory such as /repo/a&b/.git is transformed into /repo/a__CODEXADDDIRS__b/.git; the resulting launch therefore grants the wrong directory instead of the Git metadata that Codex needs to stage and commit.

Useful? React with 👍 / 👎.

…rebase

The rebase onto main picked up the brief split (kunchenguid#3597): a spawn now refuses
a brief without nonempty `## Captain's intent` and `## Firstmate spec`
subsections, so both codex sandbox-grant suites failed at the first ship
spawn on their one-line fixture brief.

Both fixtures now carry the two subsections, matching what
tests/fixtures.sh fm_test_spawn_brief writes. Nothing about the grant under
test changes.
@npayette84
npayette84 force-pushed the fm/codex-writable-roots branch from 95ad005 to f4fa4ba Compare September 3, 2026 08:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4fa4ba8cd

ℹ️ 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".

Comment thread bin/fm-spawn.sh
codex_root_real "$STATE" "$inbox_dir" || return 1
fi
wt_real=$(cd "$worktree" 2>/dev/null && pwd -P) || return 0
gitdir=$(git -C "$worktree" rev-parse --git-common-dir 2>/dev/null) || return 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pin the Git grant to the recorded project

Captain, on a Codex ship or scout relaunch, the previous worker can rewrite its workspace-local .git file to point at another repository; git -C "$worktree" rev-parse --git-common-dir still succeeds for that redirected metadata and these lines then grant the next worker write access to the other repository's refs, config, and hooks. This escapes the intended per-project sandbox boundary, so derive the expected common directory from the recorded project or refuse when the worktree's reported common directory differs from it.

AGENTS.md reference: AGENTS.md:L212-L212

Useful? React with 👍 / 👎.

Comment thread bin/fm-spawn.sh
Comment on lines +1447 to +1450
if [ "$path" != "$container" ] && [ -L "$path" ]; then
echo "error: $path is a symlink; firstmate never resolves, creates, or grants a codex writable root through a link - repair or remove that record before spawning" >&2
return 1
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject hard-linked writable-root files

If an existing per-task status or turn-ended record is a hard link to another same-filesystem file, this check accepts it because -L detects only symbolic links and the lexical pathname remains inside state/. The resulting file-form --add-dir lets the Codex worker modify the shared inode through the allowed state path, thereby changing the file outside the intended task boundary; reject multiply linked file roots before granting them.

AGENTS.md reference: AGENTS.md:L212-L212

Useful? React with 👍 / 👎.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is waiting on the author / blocked on #3384.

HEAD f4fa4ba8cde26652ecbeb341f00b064c62c56b90 vs main 3d2a08b2097dd24f9ce03fdafe6501e39b79dbd0. MERGEABLE/UNSTABLE. Still stacked content: this PR targets main and carries #3384's launch-hardening (new-default) plus the grant.

Contract-class: restore (grant) blocked on #3384 new-default. The unique grant restores Codex crewmates/scouts' ability to fulfil the existing brief under -s workspace-write via narrow per-kind --add-dir roots (status / turn-ended / scout state/ + data/<id>/ / git common dir). Additive roots; ``, .env, `config/`, `projects/`, shared `data/` stay ungranted. Do not merge ahead of #3384. After #3384's captain decision, re-triage the grant vs the landed base.

VISION (grant slice):

  1. One captain, one interface — aligns (workers can deliver status/report without captain firefighting).
  2. Authority explicit — aligns for the grant (restores brief contract under existing sandbox; fix(bin): launch crewmates under their harness's own approval and sandbox controls #3384's launch-default flip is separate and does not align as default).
  3. Scripts own mechanics — aligns (composed roots, pre-create, symlink refuse).
  4. Restart non-event — aligns.
  5. Delegation with a spine — aligns (brief fulfilment + completion gate).
  6. Fleet outlives vendor — aligns (Codex-only sandbox grant; other harnesses untouched by the grant).
  7. Scope — aligns. Closing: grant restores promised worker write paths; stack remains blocked on fix(bin): launch crewmates under their harness's own approval and sandbox controls #3384 new-default.

Security: clean for tip workflow approve. No .github/**. Greptile SUCCESS on tip. Grant stays narrow (no FM_HOME/.env/config). Full stack still includes #3384 launch flags — do not land the bundle as restore alone.

Attestation: MISMATCH — body binds 9231bbcaa9d446b33402da8aaf83c757fb848d1e, not tip f4fa4ba8….

Workflow approval this pass (tip action_required):

  • CI 33734995733 (queued/in progress after approve)
  • Require no-mistakes 33734995725 (approved; FAILED on attestation MISMATCH)

Land-eligible: NO (blocked on open #3384 new-default; attestation MISMATCH; NM red). Firstmate-flag: no — #3384 is not otherwise-ready for the grant alone; do not flag yet.

Please keep tip attestation MATCH after any push, and do not expect merge until #3384 is decided and this grant is rebased/re-triaged against that base.

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.

2 participants