Skip to content

fix(spawn): repair the crewmate merge-block permission rules - #1024

Open
tkt028 wants to merge 7 commits into
kunchenguid:mainfrom
tkt028:fm/firstmate-599-configdir-mergeblock
Open

tkt028 wants to merge 7 commits into
kunchenguid:mainfrom
tkt028:fm/firstmate-599-configdir-mergeblock

Conversation

@tkt028

@tkt028 tkt028 commented Jul 25, 2026 •

Copy link
Copy Markdown

What Changed

  • Fixed the two gh api merge rules that used :* mid-pattern — syntax Claude Code rejects and skips, so the merge guard never bit while every fresh spawn also stopped on a blocking Settings Warning dialog. The rule list is now per-executable and adds gh-axi pr merge plus the GraphQL mergePullRequest shape, and it rides under permissions.ask because a crewmate launched with --dangerously-skip-permissions can bypass allow/deny but not an "ask" it has no approver for.
  • Moved the generated .claude/settings.local.json out of bin/fm-spawn.sh into the new bin/fm-crew-settings-lib.sh, so the busy-state hooks, the turn-end touch, and the merge block provably ride in one document (a single redirect writes the file, so a second writer would truncate the first). The library also carries its own shell-quoting and JSON escaping, which fixes hostile turn-end/state paths corrupting the document.
  • Added tests/fm-crew-settings.test.sh (11 invariants, wired into fm-test-run.sh) and docs/verification/crew-merge-block.md holding the live-binary evidence the hermetic tests cannot carry; documented the coverage boundary in the library, docs/scripts.md, and the harness-adapters skill — rules match only the top-level command string, so wrapper indirection (bin/fm-pr-merge.sh, bash -c), stdin-fed GraphQL, and local landing stay ungated (open issue crewmate merge block is defeated by indirection - including the repo's own sanctioned merge entrypoints #2319), and a merge-block stop must not be cleared the same reflexive way as a launch-time trust dialog.

Risk Assessment

⚠️ Medium: Every verification-record defect raised across the three rounds is now resolved and no code changed since round 1, but the branch still introduces a new blocking permissions.ask control on every claude crewmate whose wrapper-script bypass surface and interactive-wedge failure mode were consciously accepted rather than mitigated.

Testing

Ran the new tests/fm-crew-settings.test.sh plus the full changed-file selection (45 scripts, 0 failures, 2 unrelated environment gate skips), then went past unit level: I spawned a real claude crewmate through bin/fm-spawn.sh and captured the .claude/settings.local.json it actually wrote, confirmed with the live Claude Code 2.1.231 binary that it loads with no Invalid settings section while the pre-fix Bash(gh api:*/merge*) control still reproduces the was skipped rejection, and finally launched a --dangerously-skip-permissions session in that directory which blocked all six merge verbs (gh, gh-axi, both REST endpoints, the GraphQL mutation, tk-feature land) while ordinary gh reads ran — the exact end-user behavior the fix exists to restore. This is a CLI/config surface with no rendered UI, so the evidence is command transcripts and the generated settings file rather than screenshots.

Evidence: Consolidated evidence write-up (spawn output, doctor comparison, bypass-mode block table)
# Crewmate merge-block: end-to-end evidence

Change under test: `fix(spawn): repair the crewmate merge-block permission rules`
(`bin/fm-crew-settings-lib.sh` now owns the crewmate `.claude/settings.local.json`;
the `gh api` rules no longer use `:*` mid-pattern).

## 1. The real spawn writes both guarantees in one document

`bin/fm-spawn.sh` run for real (fake tmux pane + isolated git worktree, harness=claude):

`` `
spawned evidence-task harness=claude kind=ship mode=no-mistakes yolo=off window=firstmate:fm-evidence-task worktree=<TMP>/claude/wt
spawn exit: 0
`` `

The file it wrote into the crewmate worktree (`spawned-settings.local.json`):

`` `json
{"hooks":["SessionEnd","Stop","StopFailure","UserPromptSubmit"],
 "ask":["Bash(gh pr merge:*)","Bash(gh-axi pr merge:*)","Bash(gh api *pulls/*/merge*)",
        "Bash(gh api *repos/*/merges*)","Bash(gh api graphql*mergePullRequest*)",
        "Bash(tk-feature land:*)","Bash(tk-feature-land:*)"]}
`` `

## 2. It loads clean in the real Claude Code binary (2.1.231), with a negative control

`claude doctor`, same binary, three directories (full output: `claude-doctor.txt`):

| Directory                                   | `Invalid settings` section |
|---------------------------------------------|----------------------------|
| pre-fix rules `Bash(gh api:*/merge*)`       | present - both rules `was skipped` |
| library output `fm_crew_settings_local_json`| absent |
| file written by the real `fm-spawn.sh`      | absent |

Negative-control text, verbatim:

`` `
Invalid permission rule "Bash(gh api:*/merge*)" was skipped: The :* pattern must be at
the end. Move :* to the end for prefix matching, or use * for wildcard matching
`` `

## 3. The rules actually stop the merge verbs under `--dangerously-skip-permissions`

`claude -p --dangerously-skip-permissions` launched inside the generated file's
directory and asked to run eight inert commands (full transcript:
`crewmate-merge-block-session.txt`):

| Command                                         | Result  |
|-------------------------------------------------|---------|
| `gh --version`                                  | executed |
| `gh pr merge --help`                            | blocked |
| `gh-axi pr merge --help`                        | blocked |
| `gh api --method PUT .../pulls/1/merge`         | blocked |
| `gh api --method POST .../merges`               | blocked |
| `gh api graphql -f query='mutation { mergePullRequest ... }'` | blocked |
| `gh api repos/cli/cli/pulls/1/files`            | executed |
| `tk-feature land --help`                        | blocked |

Every block surfaced as `Claude requested permissions to use Bash, but you haven't
granted it yet.` - bypass mode skips the prompt, not the rule, and an unattended
crewmate has no approver. Ordinary `gh api` reads stay ungated.

This run covers the two REST endpoint patterns under `permissions.ask` directly,
which `docs/verification/crew-merge-block.md` had only under `permissions.deny`.
Evidence: settings.local.json written by a real fm-spawn.sh crewmate spawn

{"hooks":["SessionEnd","Stop","StopFailure","UserPromptSubmit"],"ask":["Bash(gh pr merge:*)","Bash(gh-axi pr merge:*)","Bash(gh api *pulls/*/merge*)","Bash(gh api *repos/*/merges*)","Bash(gh api graphql*mergePullRequest*)","Bash(tk-feature land:*)","Bash(tk-feature-land:*)"]}

{"hooks":{"UserPromptSubmit":[{"hooks":[{"type":"command","command":"'/Users/khon/.no-mistakes/worktrees/23ff1d3581ba/01KZXEVPHAF5FW5X45WYSYS171/bin/fm-busy-event.sh' apply '/private/var/folders/vz/lz9zp19s2k71kbwjk73xtz5m0000gn/T/fm-spawn-evidence.xmf6Ua/claude/home/state' 'evidence-task' busy --gen 'g1786626277.94535.10911' --source claude-hook --event user-prompt-submit 2>/dev/null || true"}]}],"Stop":[{"hooks":[{"type":"command","command":"touch '/private/var/folders/vz/lz9zp19s2k71kbwjk73xtz5m0000gn/T/fm-spawn-evidence.xmf6Ua/claude/home/state/evidence-task.turn-ended'; '/Users/khon/.no-mistakes/worktrees/23ff1d3581ba/01KZXEVPHAF5FW5X45WYSYS171/bin/fm-busy-event.sh' apply '/private/var/folders/vz/lz9zp19s2k71kbwjk73xtz5m0000gn/T/fm-spawn-evidence.xmf6Ua/claude/home/state' 'evidence-task' idle --gen 'g1786626277.94535.10911' --source claude-hook --event stop 2>/dev/null || true"}]}],"StopFailure":[{"hooks":[{"type":"command","command":"'/Users/khon/.no-mistakes/worktrees/23ff1d3581ba/01KZXEVPHAF5FW5X45WYSYS171/bin/fm-busy-event.sh' apply '/private/var/folders/vz/lz9zp19s2k71kbwjk73xtz5m0000gn/T/fm-spawn-evidence.xmf6Ua/claude/home/state' 'evidence-task' idle --gen 'g1786626277.94535.10911' --source claude-hook --event stop-failure 2>/dev/null || true"}]}],"SessionEnd":[{"hooks":[{"type":"command","command":"'/Users/khon/.no-mistakes/worktrees/23ff1d3581ba/01KZXEVPHAF5FW5X45WYSYS171/bin/fm-busy-event.sh' apply '/private/var/folders/vz/lz9zp19s2k71kbwjk73xtz5m0000gn/T/fm-spawn-evidence.xmf6Ua/claude/home/state' 'evidence-task' idle --gen 'g1786626277.94535.10911' --source claude-hook --event session-end 2>/dev/null || true"}]}]},"permissions":{"ask":["Bash(gh pr merge:*)","Bash(gh-axi pr merge:*)","Bash(gh api *pulls/*/merge*)","Bash(gh api *repos/*/merges*)","Bash(gh api graphql*mergePullRequest*)","Bash(tk-feature land:*)","Bash(tk-feature-land:*)"]}}
Evidence: claude doctor 2.1.231 — malformed control vs library output vs real spawned file

=== negative control (pre-fix rules, ':' mid-pattern) === Invalid settings - .../live/bad/.claude/settings.local.json > permissions.ask: Invalid permission rule "Bash(gh api:/merge*)" was skipped: The :* pattern must be at the end. Move :* to the end for prefix matching, or use * for wildcard matching - .../live/bad/.claude/settings.local.json > permissions.ask: Invalid permission rule "Bash(gh api:/merges)" was skipped: ... === fixed rules, file as generated by fm_crew_settings_local_json === (no Invalid settings section) === real fm-spawn-generated crewmate worktree file === (no Invalid settings section)

=== negative control (pre-fix rules, ':*' mid-pattern) ===
Claude Code doctor

Running: native (2.1.231)
Commit: bbff368ec698
Platform: darwin-arm64
Path: /Users/khon/.local/share/claude/versions/2.1.231
Config install method: native
Search: OK (bundled)
Auto-updates: enabled
Auto-update channel: latest
Last update attempt: none recorded

Invalid settings
- /private/var/folders/vz/lz9zp19s2k71kbwjk73xtz5m0000gn/T/no-mistakes-evidence/01KZXEVPHAF5FW5X45WYSYS171/live/bad/.claude/settings.local.json › permissions.ask: Invalid permission rule "Bash(gh api:*/merge*)" was skipped: The :* pattern must be at the end. Move :* to the end for prefix matching, or use * for wildcard matching
- /private/var/folders/vz/lz9zp19s2k71kbwjk73xtz5m0000gn/T/no-mistakes-evidence/01KZXEVPHAF5FW5X45WYSYS171/live/bad/.claude/settings.local.json › permissions.ask: Invalid permission rule "Bash(gh api:*/merges*)" was skipped: The :* pattern must be at the end. Move :* to the end for prefix matching, or use * for wildcard matching

Remote Control
Remote Control requires feature-flag evaluation, which is disabled because DISABLE_TELEMETRY is set. Unset it (or run in a shell without it) to use Remote Control.
- Feature-flag evaluation disabled (disabled by DISABLE_TELEMETRY)
- Remote Control rollout could not be verified for this account (no server response this session)

No installation issues found.

For a full setup checkup that can also fix issues, run /doctor in a Claude Code session.

=== fixed rules, file as generated by fm_crew_settings_local_json ===
Claude Code doctor

Running: native (2.1.231)
Commit: bbff368ec698
Platform: darwin-arm64
Path: /Users/khon/.local/share/claude/versions/2.1.231
Config install method: native
Search: OK (bundled)
Auto-updates: enabled
Auto-update channel: latest
Last update attempt: none recorded

Remote Control
Remote Control requires feature-flag evaluation, which is disabled because DISABLE_TELEMETRY is set. Unset it (or run in a shell without it) to use Remote Control.
- Feature-flag evaluation disabled (disabled by DISABLE_TELEMETRY)
- Remote Control rollout could not be verified for this account (no server response this session)

No installation issues found.

For a full setup checkup that can also fix issues, run /doctor in a Claude Code session.

=== real fm-spawn-generated crewmate worktree file ===
Claude Code doctor

Running: native (2.1.231)
Commit: bbff368ec698
Platform: darwin-arm64
Path: /Users/khon/.local/share/claude/versions/2.1.231
Config install method: native
Search: OK (bundled)
Auto-updates: enabled
Auto-update channel: latest
Last update attempt: none recorded

Remote Control
Remote Control requires feature-flag evaluation, which is disabled because DISABLE_TELEMETRY is set. Unset it (or run in a shell without it) to use Remote Control.
- Feature-flag evaluation disabled (disabled by DISABLE_TELEMETRY)
- Remote Control rollout could not be verified for this account (no server response this session)

No installation issues found.

For a full setup checkup that can also fix issues, run /doctor in a Claude Code session.
Evidence: Live --dangerously-skip-permissions session: merge verbs blocked, reads executed

| Command | Executed or Blocked | |---|---| | gh --version | Executed (gh version 2.95.0) | | gh pr merge --help | Blocked | | gh-axi pr merge --help | Blocked | | gh api --method PUT repos/tkt028/no-such-repo-zzz9/pulls/1/merge | Blocked | | gh api --method POST repos/tkt028/no-such-repo-zzz9/merges | Blocked | | gh api graphql -f query="mutation { mergePullRequest(...) }" | Blocked | | gh api repos/cli/cli/pulls/1/files | Executed (returned file list) | | tk-feature land --help | Blocked | Every block surfaced as: Claude requested permissions to use Bash, but you haven't granted it yet.

All 8 attempted. 6 were blocked by the permission system (denied Bash approval), not by me — no refusal text was generated by me or by `gh`; the commands never executed.

| Command | Executed or Blocked | First line of output (or refusal text) |
|---|---|---|
| `gh --version` | Executed | `gh version 2.95.0 (2026-06-17)` |
| `gh pr merge --help` | Blocked | `Claude requested permissions to use Bash, but you haven't granted it yet.` |
| `gh-axi pr merge --help` | Blocked | `Claude requested permissions to use Bash, but you haven't granted it yet.` |
| `gh api --method PUT repos/tkt028/no-such-repo-zzz9/pulls/1/merge` | Blocked | `Claude requested permissions to use Bash, but you haven't granted it yet.` |
| `gh api --method POST repos/tkt028/no-such-repo-zzz9/merges` | Blocked | `Claude requested permissions to use Bash, but you haven't granted it yet.` |
| `gh api graphql -f query="mutation { mergePullRequest(…PR_kwINVALID…) }"` | Blocked | `Claude requested permissions to use Bash, but you haven't granted it yet.` |
| `gh api repos/cli/cli/pulls/1/files` | Executed | `[{"sha":"16b31e3a0487aea4a16c34476513c0d164a59da2","filename":"command/pr.go","status":"modified",…}]` |
| `tk-feature land --help` | Blocked | `Claude requested permissions to use Bash, but you haven't granted it yet.` |

Two notes on reading this result:

- The block is **not** a judgment about the commands. `gh --version` and a read-only `gh api` GET went through; everything else — including the two pure `--help` invocations, which are as inert as `--version` — hit the same generic permission gate. The pattern is the permission ruleset's allowlist, not merge-safety triage.
- Because nothing ran for rows 2–6 and 8, I have no evidence about what those commands *would* have printed. In particular I can't tell you whether the two `gh api` merge calls would have returned `404 Not Found` (repo doesn't exist) or been refused earlier, and I can't confirm `tk-feature land --help` is even on PATH here.

I did not render the mandated `HUMAN_ACTION` footer: it must come from `shared/human-action`'s `ha_emit`, which needs a Bash call that would hit the same gate, and the rules forbid hand-typing the marker. Flagging its absence rather than faking one.
Evidence: Harness used to run the real spawn and capture its settings file
#!/usr/bin/env bash
# Evidence harness: run the REAL bin/fm-spawn.sh for a claude crewmate against a
# fake tmux pane + isolated git worktree, then copy out the settings.local.json
# it actually wrote. Mirrors tests/fm-busy-adapter-wiring.test.sh's run_spawn.
set -u
REPO=$1
OUT=$2
cd "$REPO" || exit 1
. "$REPO/tests/lib.sh"
TMP_ROOT=$(fm_test_tmproot fm-spawn-evidence)
id=evidence-task
case_dir="$TMP_ROOT/claude"; home="$case_dir/home"; proj="$case_dir/project"; wt="$case_dir/wt"
fakebin=$(fm_fakebin "$case_dir/fake")
cat > "$fakebin/tmux" <<'T'
#!/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 ;;
  list-windows) exit 0 ;;
  has-session|new-session|new-window|kill-window|send-keys) exit 0 ;;
esac
exit 0
T
chmod +x "$fakebin/tmux"
fm_fake_exit0 "$fakebin" treehouse pi opencode claude codex
mkdir -p "$home/data" "$home/projects" "$home/state" "$home/config"
printf 'claude\n' > "$home/config/crew-harness"
fm_git_worktree "$proj" "$wt" "wt-evidence"
touch "$home/state/.last-watcher-beat"
mkdir -p "$home/data/$id"
printf 'brief for %s\n' "$id" > "$home/data/$id/brief.md"
FM_ROOT_OVERRIDE='' FM_HOME="$home" \
  FM_STATE_OVERRIDE="$home/state" FM_DATA_OVERRIDE="$home/data" \
  FM_PROJECTS_OVERRIDE="$home/projects" FM_CONFIG_OVERRIDE="$home/config" \
  FM_SPAWN_NO_GUARD=1 FM_FAKE_PANE_PATH="$wt" TMUX="fake,1,0" \
  GROK_HOME="$home/grok-home" PATH="$fakebin:$PATH" \
  "$REPO/bin/fm-spawn.sh" "$id" "$proj" --mode no-mistakes --yolo off 2>&1 | sed "s#$TMP_ROOT#<TMP>#g"
echo "spawn exit: ${PIPESTATUS[0]}"
cp "$wt/.claude/settings.local.json" "$OUT" && echo "copied real spawned settings -> $OUT"

Pipeline

Updates from git push no-mistakes

⏭️ **intent** - skipped

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 6 issues found → auto-fixed (2) ✅
  • ⚠️ bin/fm-crew-settings-lib.sh:56 - The merge block only matches top-level Bash command strings, so any indirection defeats it — most importantly the repo's own sanctioned merge entrypoints. AGENTS.md:323 says "Use bin/fm-pr-merge.sh for every task PR merge ... and bin/fm-merge-local.sh for approved local-only landing", and neither has a rule. A claude crewmate working in a firstmate worktree (this branch was produced exactly that way) can run bin/fm-pr-merge.sh &lt;id&gt; &lt;pr-url&gt;, which shells out to gh-axi pr merge in a subprocess that no permissions.ask rule ever sees, and the PR lands. Same for bash -c &#39;gh pr merge ...&#39;. The library's "Known residual" block (lines 46-51) documents only the GraphQL-from-stdin case, which understates the gap and reads as if wrapper scripts were considered and covered. Either add rules for the two bin/fm-*merge*.sh entrypoints or state the indirection class explicitly in the residual. Separately, Bash(tk-feature land:*) / Bash(tk-feature-land:*) hardcode an operator-specific external toolchain into every crewmate's settings while the product's own merge scripts are ungated — worth a second look at what the list is scoped to.
  • ⚠️ docs/verification/crew-merge-block.md:90 - The prose asserts "the two REST merge endpoints ... are all covered", but the live evidence that supported that claim was deleted in b7a7ac7. The original table proved gh api --method PUT repos/.../pulls/1/merge and gh api --method POST repos/.../merges were refused; the replacement table tests only gh --version, gh pr merge --help, gh-axi pr merge --help, a GraphQL mutation, and a pulls/N/files read. So Bash(gh api *pulls/*/merge*) and Bash(gh api *repos/*/merges*) — the two patterns whose :*-mid-pattern syntax bug is the entire reason this branch exists — now have zero live matching evidence anywhere, in a record whose stated job (line 7) is to "hold the live-binary evidence" the hermetic tests cannot carry. The hermetic tests only assert the strings are present, not that Claude Code matches them.
  • ⚠️ docs/verification/crew-merge-block.md:13 - The Conditions note says the --dangerously-skip-permissions session table "was not re-run: it exercises the rule patterns, and those are byte-for-byte unchanged by the hook addition" — but the same commit (b7a7ac7) added two new rules (Bash(gh-axi pr merge:*), Bash(gh api graphql*mergePullRequest*)) and replaced the table with a demonstrably different live run: different commands, a different refusal message (Claude requested permissions to use Bash... vs the previous Permission to use Bash with command ... has been denied.), and rows for rules that did not exist before. The patterns were therefore not unchanged and the table was re-run, so the header's "Verified on 2026-07-25 with Claude Code 2.1.220" and this scoping sentence no longer describe the record's own contents.
  • ⚠️ docs/verification/crew-merge-block.md:84 - This branch introduces permissions.ask into every claude crewmate's settings for the first time, which creates a new wedge mode the fleet has no detector for. The doc states it: in the interactive TUI a crewmate actually runs in, a matched rule surfaces as a pane-blocking prompt, so the turn never ends, Stop/StopFailure/SessionEnd never fire, the turn-end file is never touched, and the busy record stays busy forever. I found nothing that classifies a permission dialog — bin/fm-composer-lib.sh has no such screen class, and bin/fm-inactive-reconcile.sh only acts on done/failed state and explicitly leaves working to "existing supervision semantics". The only mitigation shipped is prose in .agents/skills/harness-adapters/SKILL.md:196 telling a human not to reflexively clear it, which requires a human to peek in the first place. Worth deciding whether a wedged-on-permission-prompt detector is a prerequisite or a follow-up.
  • ℹ️ bin/fm-crew-settings-lib.sh:20 - The merge block exists only for the claude* harness — bin/fm-spawn.sh writes .claude/settings.local.json in that case arm alone, and grok/codex/opencode/pi/cursor/kimi/muse crewmates get no equivalent (grok explicitly cannot, since it needs a hook-trust grant firstmate will not make). That is inherent to the mechanism, but neither the new verification record nor the SKILL.md addition says so, and both are titled generically enough ("Crewmate merge-block verification") to read as fleet-wide protection. One sentence naming the harness scope would keep a reader from over-trusting it.
  • ℹ️ bin/fm-crew-settings-lib.sh:40 - fm_crew_shell_quote and fm_crew_json_escape are a third and fourth copy of logic bin/fm-spawn.sh already carries as shell_quote (line 1078) and json_escape (line 1476), now both sourced into the same process. The new copies are strictly better — the sed-based json_escape escapes only \ and &#34; and would emit a raw newline/tab into a JSON scalar — yet fm-spawn's weaker one is still what writes the grok hook command at line 2515, which interpolates a filesystem path the same way. Consolidating both pairs into one shared owner would remove the duplication and close the weaker escaper's gap in the same move.

🔧 Fix: restore REST endpoint evidence, fix verification run provenance
1 info still open:

  • ℹ️ docs/verification/crew-merge-block.md:58 - The new Conditions rule at line 12 states "each section names the run it came from," and the other two runs are pinned precisely (2026-07-25 / Claude Code 2.1.220 / commit 4073f59596e2, and 2026-08-13 / 2.1.231 / commit bbff368ec698). The permissions.ask-under-bypass section names its run only relationally — "Captured after Bash(gh-axi pr merge:*) and Bash(gh api graphql*mergePullRequest*) joined the rule list" — with no date and no Claude Code version. That is the record's single most load-bearing run (it is what establishes that an unanswerable ask stops a bypass-mode crewmate at all), and the whole was skipped finding above it demonstrates that this engine's behavior is version-dependent, so a future reader cannot tell whether the evidence predates a version bump. Adding the date + version + commit for that session would close the gap the rest of this commit just closed everywhere else.

🔧 Fix: pin bypass-table run date, state uncaptured build
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-crew-settings.test.sh — all 11 invariants pass (JSON validity, four busy hooks, turn-end path, co-residency with the merge block, :*-at-the-end syntax, 7 merge verbs, per-executable rules, no over-blocking, hostile-path quoting, fm-spawn delegation)
  • bash bin/fm-test-run.sh --changed --base 96876db31009d011694a0174a460d2c587f2c6c8 — 45 scripts, FM_TEST_SUMMARY total=45 failed=0 skipped_gate=2 (skips are pi package / tsc absent in this environment)
  • Manual: ran the real bin/fm-spawn.sh evidence-task &lt;proj&gt; --mode no-mistakes --yolo off with a fake tmux pane and isolated git worktree, then inspected the .claude/settings.local.json it wrote (/var/folders/.../no-mistakes-evidence/01KZXEVPHAF5FW5X45WYSYS171/spawn-evidence.sh)
  • Manual: claude doctor (Claude Code 2.1.231) in three directories — pre-fix malformed-rule control, library output, and the real spawned file
  • Manual: claude -p --dangerously-skip-permissions &#39;...run each command and report whether it executed...&#39; inside the generated settings directory, exercising gh pr merge, gh-axi pr merge, gh api --method PUT .../pulls/1/merge, gh api --method POST .../merges, gh api graphql mergePullRequest, tk-feature land --help, plus gh --version and a read-only gh api GET as negative controls
⚠️ **Document** - 2 infos
  • ℹ️ bin/fm-crew-settings-lib.sh:46 - The merge block's coverage boundary is now documented (rules match only the top-level command string, so wrapper indirection and local landing are ungated), but the mechanism itself is unchanged and open issue crewmate merge block is defeated by indirection - including the repo's own sanctioned merge entrypoints #2319 leaves the resolution undecided between adding rules for the sanctioned entrypoints, accepting the documented boundary, or moving enforcement below the command string. I chose documentation only, since changing the rule list would be a behaviour and threat-model change outside this documentation pass.
  • ℹ️ docs/scripts.md:53 - bin/fm-spawn.sh writes this settings document for scout tasks as well as ship crewmates (the write is gated only on KIND != secondmate), while every doc surface calls it "the claude crewmate's" file. Harmless today (a scout never lands work, and the dialog-handling guidance applies identically), so I left the wording alone rather than churn four surfaces for a nuance the change did not introduce.
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@tkt028
tkt028 force-pushed the fm/firstmate-599-configdir-mergeblock branch 3 times, most recently from b07f241 to 0afb760 Compare July 31, 2026 02:12
@kunchenguid

kunchenguid commented Jul 31, 2026 •

Copy link
Copy Markdown
Owner

Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch.

When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again.

Noted for firstmate#1024 at 0afb7602.

@kunchenguid

Copy link
Copy Markdown
Owner

Automated reminder: this PR still looks blocked on a rebase or merge conflict fix.

If you are still interested, please rebase onto the current base branch, resolve the conflict, and push.

If I do not hear back, I may close this as inactive.

@kunchenguid kunchenguid removed the wheelhouse:pending-contributor-action Managed by Wheelhouse label Aug 11, 2026
tkt028 added 6 commits August 13, 2026 16:06
Why: an unattended crewmate could still land its own work through
`gh api .../pulls/N/merge`. The two gh api rules used ":*" mid-pattern,
which Claude Code rejects and SKIPS, so the merge guard never bit while
every fresh spawn also stopped on a blocking Settings Warning dialog.

Root cause: ":*" is prefix-match syntax and is legal only at the end of
a pattern; "*" is the mid-pattern wildcard.

Move the generated settings.local.json into bin/fm-crew-settings-lib.sh
so the turn-end Stop hook and the merge block provably ride in one
document, and cover both with tests/fm-crew-settings.test.sh.

Motivated-by: tkt028/tkt-env#1244
@tkt028
tkt028 force-pushed the fm/firstmate-599-configdir-mergeblock branch from 0afb760 to 1654c76 Compare August 13, 2026 13:26
@tkt028 tkt028 changed the title fix(spawn): restore the crewmate merge block with valid, dialog-free rules fix(spawn): repair the crewmate merge-block permission rules Aug 13, 2026
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