Skip to content

fix(bin): strip AI co-author trailers from fleet-launched commits - #5695

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/fm5665-ai-trailer-strip
Sep 25, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/fm5665-ai-trailer-strip

Conversation

@tiago-peixoto

@tiago-peixoto tiago-peixoto commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Fixes #5665.
Implement ready-for-pr issue #5665: worker runtimes other than Claude Code can add an AI Co-authored-by trailer to the commits they make, and nothing in the launch path removes it. Commits made inside any worker pane that firstmate launches should carry no AI co-author trailer, whatever the runtime, while human co-authors and the author identity are left untouched.

What Changed

  • Added bin/fm-git-strip-ai-trailers.sh.
    As a commit-msg hook, it removes Co-authored-by trailers that match known AI product names (Cursor, Claude, Copilot, Codex, ChatGPT, Gemini, Grok, OpenAI) or bot addresses seen in practice.
    Human co-authors and the author identity are left untouched.
    Its install mode builds a read-only per-task hooks directory.
    Every other client-side hook in that directory is a wrapper that runs the hook of the same name from the repository git is actually running in, so project hooks such as husky still run.
  • fm-spawn.sh now installs state/<id>.git-hooks for every launch kind, including secondmates, and fails closed if the install fails.
    The pane gets that directory as core.hooksPath through GIT_CONFIG_COUNT/GIT_CONFIG_KEY_0/GIT_CONFIG_VALUE_0, so the project's own git config is not rewritten.
    A failed spawn removes the directory unless the launched agent's pane may still be open.
  • fm-teardown.sh restores the owner write bit on the read-only hooks directory and then removes it, both for a task and for a secondmate home's children.
    The tests/lib.sh cleanup does the same for test fixtures.
    Added tests/fm-git-strip-ai-trailers.test.sh and updated the existing spawn tests for the new launch prefix.
    Documented the mechanism in docs/configuration.md, docs/scripts.md, AGENTS.md, and the Cursor harness reference.

Risk Assessment

⚠️ Medium: The change hooks into git for every fleet pane and is well tested for the verified adapters, but a raw launch that chains several commands skips the strip, and the generated-with stripping goes beyond the stated intent.

Testing

Everything ran in a disposable lab home with its own tmux socket. I spawned three real workers with the real fm-spawn.sh: two raw launches, one of them chained, and one real cursor-agent with attribution on. For each, I checked the commit object git wrote. The AI trailers were gone in all three, while human co-authors, author identity and the project's husky hooks were untouched. A control run of Cursor outside a fleet pane reproduced the original trailer. fm-teardown.sh removed the strip directories. I also ran the focused strip test file. All scenarios passed. Transcripts are in the evidence dir, and I removed the lab, its tmux server and the treehouse pool it created.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Real Cursor worker spawned by firstmate commits with attribution on; the commit object carries no Cursor co-author trailer ✅ pass live cursor-fleet-pane.txt shows Cursor ran git commit --trailer &#34;Co-authored-by: Cursor &lt;[email protected]&gt;&#34;; the commit in lab-transcript.md has no trailer. The control run outside a pane kept it…
Raw-launch worker commit with Cursor/Claude/Copilot AI trailers lands without them, keeping human co-authors (including a vendor-domain human) and author identity ✅ pass live lab-transcript.md 'plain' commit: only Alice Human and Aidan Openaire <[email protected]> remain; AUTHOR/COMMITTER Worker Person unchanged
Chained raw launch (cd src &amp;&amp; agent) still gets the strip on its commit ✅ pass live lab-transcript.md 'chained' env shows hooksPath=state/s2.git-hooks inside src/; AI trailers stripped from the commit
The project's own husky commit-msg and pre-commit hooks still run inside fleet panes, and the project's core.hooksPath config is not rewritten ✅ pass live Every fleet commit carries 'Husky-Ran: yes'; precommit.log shows each pre-commit run; git config --show-origin core.hooksPath is still .husky in .git/config
Teardown removes the read-only state/<id>.git-hooks strip directories ✅ pass live lab-transcript.md teardown section: s1-s3 teardown complete, exit=0, 0 git-hooks dirs left
Evidence: Live lab transcript: spawn logs, commit objects, control repro, teardown

Source: Live lab transcript: spawn logs, commit objects, control repro, teardown

# Live lab transcript (fm-5665 AI trailer strip)
## Spawn logs
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.GVjPQb
spawned s1 harness=bash kind=scout window=primary:fm-s1 worktree=~/.treehouse/app-a2b8b4/1/app
exit=0
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.GVjPQb
spawned s2 harness=cd kind=scout window=primary:fm-s2 worktree=~/.treehouse/app-a2b8b4/2/app
exit=0
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.GVjPQb
spawned s3 harness=cursor kind=scout window=primary:fm-s3 worktree=~/.treehouse/app-a2b8b4/3/app
exit=0
## raw launch 'plain' pane env
pwd=~/.treehouse/app-a2b8b4/1/app
hooksPath=/tmp/fm-lab.GVjPQb/state/s1.git-hooks
rc=0
## 'plain' commit object (message typed with Cursor/Claude/Copilot AI trailers + 2 human co-authors)
AUTHOR=Worker Person <[email protected]>
COMMITTER=Worker Person <[email protected]>
---
feat: lab commit
Body line.

Co-authored-by: Alice Human <[email protected]>
Co-authored-by: Aidan Openaire <[email protected]>
Husky-Ran: yes

## raw launch 'chained' pane env
pwd=~/.treehouse/app-a2b8b4/2/app/src
hooksPath=/tmp/fm-lab.GVjPQb/state/s2.git-hooks
rc=0
## 'chained' commit object (message typed with Cursor/Claude/Copilot AI trailers + 2 human co-authors)
AUTHOR=Worker Person <[email protected]>
COMMITTER=Worker Person <[email protected]>
---
feat: lab commit
Body line.

Co-authored-by: Alice Human <[email protected]>
Co-authored-by: Aidan Openaire <[email protected]>
Husky-Ran: yes

## project pre-commit hook invocations (chained husky)
precommit
precommit
precommit
precommit
## CONTROL: real cursor-agent outside a fleet pane (bug reproduction)
AUTHOR=Proj Human <[email protected]>
---
chore: add control file

Co-authored-by: Cursor <[email protected]>
Husky-Ran: yes

## FLEET: real cursor-agent in spawned pane (--harness cursor)
AUTHOR=Proj Human <[email protected]>
COMMITTER=Proj Human <[email protected]>
---
chore: add probe file

Husky-Ran: yes

## teardown
teardown s1 complete (window primary:fm-s1, worktree ~/.treehouse/app-a2b8b4/1/app)
Backlog: s1 just finished (this home keeps no markdown backlog at /tmp/fm-lab.GVjPQb/data/backlog.md). Update /tmp/fm-lab.GVjPQb/data/backlog.md - move s1 to Done, keep Done to the 10 most recent, then re-scan Queued and dispatch only work whose blockers are gone and date is due.
exit=0
teardown s2 complete (window primary:fm-s2, worktree ~/.treehouse/app-a2b8b4/2/app)
Backlog: s2 just finished (this home keeps no markdown backlog at /tmp/fm-lab.GVjPQb/data/backlog.md). Update /tmp/fm-lab.GVjPQb/data/backlog.md - move s2 to Done, keep Done to the 10 most recent, then re-scan Queued and dispatch only work whose blockers are gone and date is due.
exit=0
teardown s3 complete (window primary:fm-s3, worktree ~/.treehouse/app-a2b8b4/3/app)
Backlog: s3 just finished (this home keeps no markdown backlog at /tmp/fm-lab.GVjPQb/data/backlog.md). Update /tmp/fm-lab.GVjPQb/data/backlog.md - move s3 to Done, keep Done to the 10 most recent, then re-scan Queued and dispatch only work whose blockers are gone and date is due.
exit=0
state/*.git-hooks after teardown: 0
Evidence: Real cursor-agent pane capture showing it ran git commit --trailer Co-authored-by: Cursor

Source: Real cursor-agent pane capture showing it ran git commit --trailer Co-authored-by: Cursor

treehouse get
firstmate@firstmate-hz:/tmp/fm-lab.GVjPQb/projects/app$ treehouse get
A new version of treehouse is available: v2.3.0 → v3.0.0
Run "treehouse update" to update

🌳 Setting up worktree...
🌳 Entered worktree at ~/.treehouse/app-a2b8b4/3/app. Type 'exit' to return.
firstmate@firstmate-hz:~/.treehouse/app-a2b8b4/3/app$ export GOTMPDIR=/tmp/fm-s3/gotmp
firstmate@firstmate-hz:~/.treehouse/app-a2b8b4/3/app$ export COMPACT_ADVISER_DISABLE=1
firstmate@firstmate-hz:~/.treehouse/app-a2b8b4/3/app$ export FM_TASK_ID=s3
firstmate@firstmate-hz:~/.treehouse/app-a2b8b4/3/app$ . '/tmp/fm-s3+81681fd1abcde90e511791f6fdcbf30d2e2972d685e95c54d6b5f3ce5179b36e/launch.s1790356942.930011.22268.sh'


  Cursor Agent
  v2026.09.23-86fc751
  Tip: Use subagents to parallelize work and preserve context.


  ⁣FIRSTMATE_OP: v1 launch-brief: # Current worker role contract
  You are a crewmate: an autonomous worker agent managed by firstmate.
  This section establishes your current identity before every project or task instruction below and supersedes any conflicting role identity in those instructions.
  Do the assigned work yourself and report only to firstmate; do not adopt a firstmate or secondmate supervisor identity, delegate the task, run fleet supervision, or address the captain.
  Your steering inbox is `/tmp/fm-lab.GVjPQb/state/s3.inbox`; this exact path belongs to your current task even when it is outside the worktree or under the supervising firstmate home, so read
  and acknowledge its messages and do not reject it as another home's state.
  Never inspect or change any other home's endpoint namespace; this authorization is limited to the exact task paths named by this brief.
  When this task works on Firstmate itself, the repository root `AGENTS.md` (also imported by `CLAUDE.md`) is project content and the supervisor contract for the firstmate managing you: follow
  this brief instead of that supervisor contract.
  Project instructions still govern the work wherever they do not conflict with this worker identity, including `CONTRIBUTING.md` and `firstmate-coding-guidelines` for Firstmate changes.

  You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

  # Task
  ## Captain's intent
  In your worktree, create a file named probe.txt containing the word probe, then run exactly: git add probe.txt && git commit -m 'chore: add probe file'. Then write a one-line report and
  append done to the status file.

  ## Firstmate spec
  Lab scenario only; the single commit is the deliverable.

  # Herdr lifecycle declaration - NOT ENABLED
  **HARD SAFETY GATE:** this scaffold cannot inspect the task text filled in above.
  If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
  Do not add Herdr lifecycle commands to this unguarded brief by hand.

  # Setup
  You are in a disposable git worktree of app, at a detached HEAD on a clean default branch.
  This is a SCOUT task: the deliverable is a written report, not a PR.
  The worktree is your laboratory - install, run, edit, and make scratch commits freely; all of it is discarded at teardown.
  The report is the only thing that survives, so anything worth keeping must be in it.

  # Rules
  1. Never push to any remote and never open a PR.
  2. Stay inside this worktree; the only files you may write outside it are the report and the status file below.
  3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
  4. Report status by appending one line:
     `echo "{state} [at=<epoch>]: {one short line}" >> '/tmp/fm-lab.GVjPQb/state/s3.status' && { [ ! -e '/tmp/fm-lab.GVjPQb/config/fleet-ledger' ] ||
     '~/.no-mistakes/worktrees/5284051b2355/01M3CR91TK8869ETS8XTY61GT5/bin/fm-fleet-ledger.sh' appended '/tmp/fm-lab.GVjPQb/config' '/tmp/fm-lab.GVjPQb/state/s3.status'
     >/dev/null 2>&1 || true; }`
     States: working, needs-decision, blocked, paused, done, failed.
     Substitute `<epoch>` with the current Unix time in seconds - run `date +%s` and write the number it printed; a stamp that is not plain digits records no time at all.
     Each append wakes firstmate, so report sparingly: only phase changes a supervisor
     would act on and the needs-decision/blocked/paused/done/failed states. No step-by-step
     FYI progress lines; firstmate reads your pane for that.
     Whenever you mention a PR anywhere - a status line, your terminal, a summary - write its full
     https:// URL exactly as the forge printed it, never a bare number such as "PR 108"; firstmate
     copies that URL from your line rather than assembling one.
     Use `paused: {why}` - distinct from `blocked:` - ONLY when you are deliberately idling on a
     known external wait you expect to clear on its own (an upstream release, a rate-limit reset, a scheduled window, or your own validation round):
     firstmate then leaves your idle pane alone and rechecks it on a long cadence instead of
     treating it as a possible wedge. When you know when the wait clears, say so in the line with
     `until <YYYY-MM-DDTHH:MMZ>` (UTC) and firstmate rechecks at that time instead.
     Use `blocked:` when you are stuck and need help.
  5. If you hit the same obstacle twice, append `blocked [at=<epoch>]: {why}` and stop; firstmate will help.
  6. If a decision belongs to a human (product choices, destructive actions),
     append `needs-decision [at=<epoch>]: {summary of options}` and stop. Firstmate will reply with the decision.
     A decision or blocker you opened stays open until a `resolved` line carrying its exact key lands; a later `done:` or `working:` line never closes it, even when the answer is what started
     that work.
     Firstmate's reply normally writes that closing line at answer time; when a blocker or wait clears WITHOUT a firstmate reply, append `resolved [at=<epoch>]: {how it cleared}` yourself
     (same `[key=<slug>]` if you opened it with one) as you resume.
  7. Never administer infrastructure that every lane shares. Two things are shared:
     - The `no-mistakes` daemon - one instance serving every lane/home, so stopping, restarting, or
       updating it kills other lanes' in-flight pipeline runs; only firstmate manages the daemon.
       Before you append `blocked:` about the pipeline, run `no-mistakes daemon status` and
       `no-mistakes axi status`. If the daemon socket refuses connections or is missing, append
       `blocked [at=<epoch>]: {the daemon error}` and stop even when the local run record still says running or
       fixing, because that record can be stale after the daemon exits. A run record failed with a
       daemon error is also a real block.
       Only after ruling out socket refusal, if the run is still running or fixing, reattach and keep
       going. A drive-call error, timeout, slow read, or generic unreachability is NOT a daemon error:
       the daemon accepts `respond` immediately and runs the round in the background, so a killed or
       timed-out call was only waiting for a read while the run kept working.
     - The worktree pool your own worktree came from, and the repository every lane's worktree
       shares. Never create, remove, return, prune, move, or reassign a worktree or pool slot, and
       never write into a sibling slot's directory. Rule 2 does not cover this: removing a worktree
       is administration rather than an edit outside your directory, and it lands on lanes that are
       running right now. The act is the rule and commands are only examples of it - `treehouse`
       get/return/remove/prune, the equivalent operations on any other worktree provider or runtime
       backend, and `git worktree add|remove|move|prune`. A slot that looks unused is not evidence
       that it is free, and returning your own worktree is firstmate's job at cleanup, not yours.
     If you genuinely need a second checkout, another slot, or the daemon touched, append
     `blocked [at=<epoch>]: {what you need}` and stop; firstmate arranges it.

  # Firstmate instruction inbox
  Firstmate steers you through durable message files in '/tmp/fm-lab.GVjPQb/state/s3.inbox'.
  When a terminal message says an instruction is waiting there - and at any natural checkpoint when you are unsure - list '/tmp/fm-lab.GVjPQb/state/s3.inbox'/*.msg, read and act on each
  message in numeric order, then acknowledge each handled message by moving it: `mv '/tmp/fm-lab.GVjPQb/state/s3.inbox'/NNN.msg '/tmp/fm-lab.GVjPQb/state/s3.inbox'/handled/`.
  The move IS the acknowledgement: without it firstmate rings again and eventually treats you as stuck. An empty or absent inbox needs no action.

  # Definition of done
  Write your findings to `/tmp/fm-lab.GVjPQb/data/s3/report.md`.
  The report must stand alone: what you did, what you found, the evidence (commands run, output, file:line references), and what you recommend.
  If your deliverable is a visual artifact the captain will review and iterate on, use the lavish-axi rule: arm your board with bin/fm-procevent-lavish.sh arm <artifact.html> --for <task-id>;
  never run lavish-axi poll yourself. Re-arm with the reply after each nonterminal round to acknowledge it, route the board feedback through your steering inbox, write needs-decision
  [key=board-review] with the live board URL when the captain owes a decision, and stop at session_ended or an empty End without re-arming - acknowledge that final round with
  bin/fm-procevent.sh handled <source-id> <sequence> to conclude and retire your board.
  Before reporting done, read and follow `~/.no-mistakes/worktrees/5284051b2355/01M3CR91TK8869ETS8XTY61GT5/.agents/skills/captain-hold-lifecycle/SKILL.md` and pass its shared
  completion gate for the report and any visual review.
  When the report is complete, append `done [at=<epoch>]: {one-line conclusion}` to the status file and stop.
  If your findings reveal work that should ship (e.g. you reproduced a bug and the fix is clear), say so in the report; firstmate may promote this task in place, and you would then receive
  mode-specific ship instructions as a follow-up message.


  I'll create the probe file, make the requested commit, and follow the report and status steps. First I'm checking the steering inbox and the completion skill.

    Globbed, read 3 globs, 1 file
    Globbed "*.msg" in /tmp/fm-lab.GVjPQb/state/s3.inbox
    Used captain-hold-lifecycle
    Globbed "**/fm-captain-hold.sh" in /tmp/fm-lab.GVjPQb
    Globbed "**/fm-captain-hold.sh" in ...rktrees/5284051b2355/01M3CR91TK8869ETS8XTY61GT5

  $ ls -la /tmp/fm-lab.GVjPQb/bin/fm-captain-hold.sh ~/.no-mistakes/worktrees/5284051b2355/01M3CR91TK8869ETS8XTY61GT5/bin/fm-captain-hold.sh 2>&1; ls /tmp/fm-lab.GVjPQb/state/s3.inbox
    2>&1; pwd; git status --short; git log -3 --oneline 1.0s
    … 3 output lines hidden · ctrl+o to expand
    ~/.treehouse/app-a2b8b4/3/app
    c7647ac init

  $ printf 'probe\n' > probe.txt && git add probe.txt && git commit --trailer "Co-authored-by: Cursor <[email protected]>" -m 'chore: add probe file' && git log -1 --format='%H %s' && git
    status --short && echo '---' && ls -la /tmp/fm-lab.GVjPQb 2>&1 | head -50 254ms
    … 18 output lines hidden · ctrl+o to expand
    drwxrwxr-x    3 firstmate firstmate    60 Sep 25 19:21 tmux
    drwxrwxr-x    2 firstmate firstmate    40 Sep 25 19:21 user-home

  $ ls -la /tmp/fm-lab.GVjPQb/state; echo '---inbox---'; ls -la /tmp/fm-lab.GVjPQb/state/s3.inbox 2>&1; echo '---help---'; FM_HOME=/tmp/fm-lab.GVjPQb
    ~/.no-mistakes/worktrees/5284051b2355/01M3CR91TK8869ETS8XTY61GT5/bin/fm-captain-hold.sh complete --help 2>&1 | head -80 212ms
    … 93 output lines hidden · ctrl+o to expand
    task id - no identity arithmetic. The optional fourth field selects the close:
    empty or `done` completes the task, `release` lifts the hold so held work

    Read 2 files
    Read /tmp/fm-lab.GVjPQb/state/s3.meta
    Read /tmp/fm-lab.GVjPQb/.fm-lab-home

 ⠘⠣ Thinking  5.25k tokens


  → Add a follow-up                                                                                                                                                                     ctrl+c to stop


  Grok 4.7 256K Medium · 8.8%                                                                                                                                                           Run Everything
  ~/.treehouse/app-a2b8b4/3/app · ac77787
Evidence: Fleet-pane Cursor commit vs control
CONTROL (outside pane):
chore: add control file

Co-authored-by: Cursor <[email protected]>
Husky-Ran: yes

FLEET PANE (--harness cursor, agent ran git commit --trailer "Co-authored-by: Cursor <[email protected]>"):
AUTHOR=Proj Human <[email protected]>
chore: add probe file

Husky-Ran: yes

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 issues (1 warning, 1 info)
  • ⚠️ bin/fm-spawn.sh:4921 - The core.hooksPath override is added in front of the launch command as a one-command prefix (GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=... $LAUNCH). A shell prefix like this only applies to the first simple command. For a raw launch that chains several steps (for example cd sub &amp;&amp; my-agent or setup; my-agent), the override reaches only cd/setup. The agent then commits without the strip hook, and its AI trailer lands in the commit. The code a few lines below already relies on this rule: the compact-adviser switch is an export precisely so it 'carries the value across an entire compound raw launch expression' (fm-spawn.sh:4924-4926). The raw-launch escape hatch is how unverified runtimes are launched, and the intent requires the strip 'whatever the runtime'. Fix: emit export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=&lt;dir&gt;; next to the COMPACT_ADVISER_DISABLE export. That scopes the override to the worker pane shell, not the spawn process. Then update the expected launch strings built by ai_trailer_hooks_prefix in the spawn tests.
  • ⚠️ bin/fm-git-strip-ai-trailers.sh:120 - Simplification: the matcher also deletes lines that start with 'Generated with ...claude...' and 'Generated-by: ...claude/cursor...'. The intent asks only that commits carry no AI Co-authored-by trailer. These lines go beyond that, and Claude launches already turn them off through the attribution settings. Recommended remedy: remove this generated-with branch, and the test_claude_generated_with_line_is_stripped and test_prose_mentioning_generated_with_survives cases that exist only for it. If the author wants this broader attribution cleanup, confirm it as intended scope.

🔧 Fix applied.
2 issues (1 warning, 1 info) still open:

  • ⚠️ bin/fm-git-strip-ai-trailers.sh:120 - Simplification: the matcher also deletes lines that start with 'Generated with ...claude...' and 'Generated-by: ...claude/cursor...'. The intent asks only that commits carry no AI Co-authored-by trailer. These lines go beyond that, and Claude launches already turn them off through the attribution settings. Recommended remedy: remove this generated-with branch, and the test_claude_generated_with_line_is_stripped and test_prose_mentioning_generated_with_survives cases that exist only for it. If the author wants this broader attribution cleanup, confirm it as intended scope.
  • ℹ️ bin/fm-git-strip-ai-trailers.sh:19 - The usage header still says the caller 'prefixes the pane with GIT_CONFIG_COUNT / GIT_CONFIG_KEY_0 / GIT_CONFIG_VALUE_0'. The round-1 fix changed fm-spawn.sh:4922 to an export ...; statement, so this header now describes a one-command prefix that no longer exists. A reader would believe the chained-launch gap is still present. Fix: change the wording to 'exports GIT_CONFIG_COUNT / GIT_CONFIG_KEY_0 / GIT_CONFIG_VALUE_0 in the pane command'.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Real Cursor worker spawned by firstmate commits with attribution on; the commit object carries no Cursor co-author trailer ✅ pass live cursor-fleet-pane.txt shows Cursor ran git commit --trailer &#34;Co-authored-by: Cursor &lt;[email protected]&gt;&#34;; the commit in lab-transcript.md has no trailer. The control run outside a pane kept it…
Raw-launch worker commit with Cursor/Claude/Copilot AI trailers lands without them, keeping human co-authors (including a vendor-domain human) and author identity ✅ pass live lab-transcript.md 'plain' commit: only Alice Human and Aidan Openaire <[email protected]> remain; AUTHOR/COMMITTER Worker Person unchanged
Chained raw launch (cd src &amp;&amp; agent) still gets the strip on its commit ✅ pass live lab-transcript.md 'chained' env shows hooksPath=state/s2.git-hooks inside src/; AI trailers stripped from the commit
The project's own husky commit-msg and pre-commit hooks still run inside fleet panes, and the project's core.hooksPath config is not rewritten ✅ pass live Every fleet commit carries 'Husky-Ran: yes'; precommit.log shows each pre-commit run; git config --show-origin core.hooksPath is still .husky in .git/config
Teardown removes the read-only state/<id>.git-hooks strip directories ✅ pass live lab-transcript.md teardown section: s1-s3 teardown complete, exit=0, 0 git-hooks dirs left
  • bin/fm-lab-home.sh create $LAB plus tmux -L fm-lab new-session primary pane, with a real project repo that uses core.hooksPath=.husky (commit-msg and pre-commit hooks)
  • bin/fm-spawn.sh s1 $LAB/projects/app --scout &#39;bash $LAB/agent.sh plain&#39; (raw launch; the agent commits a message carrying Cursor/Claude/Copilot trailers and two human co-authors)
  • bin/fm-spawn.sh s2 $LAB/projects/app --scout &#39;cd src &amp;&amp; bash $LAB/agent.sh chained&#39; (chained raw launch)
  • Control: real cursor-agent -p --force commit in the treehouse worktree outside a fleet pane (bug reproduction)
  • bin/fm-spawn.sh s3 $LAB/projects/app --scout --harness cursor, where the brief asks Cursor to commit a file; inspected the commit object and captured the pane
  • bin/fm-teardown.sh s1|s2|s3 --force, then checked that the state/*.git-hooks dirs are gone
  • bash tests/fm-git-strip-ai-trailers.test.sh
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Cursor and other non-Claude runtimes append the trailer after the typed
message. A per-task commit-msg hook removes it and leaves human co-authors
and the author identity untouched.
… test-only: 4 test files change, no product code. **Cause.** `fm-spawn.sh` now installs the AI-trailer strip hooks for every spawn, secondmates included. The installer refuses a worktree that is not a git repository, and the PR deliberately keeps that fail-closed rule because real secondmate homes are firstmate clones. Four test fixtures still gave secondmates a plain directory as their home, so each spawn failed with "not a git worktree ... could not install the AI-trailer strip hooks": - serial 5: `tests/fm-backlog-atomicity.test.sh` ("secondmate spawn failed"). - serial 8: `tests/fm-secondmate-harness.test.sh` ("split: no meta written"). - Herdr: `tests/fm-backend-herdr-launcher-workspace-e2e.test.sh` and `tests/fm-backend-herdr-workspace-per-home-e2e.test.sh`. **Rule that must hold.** Every home a test spawns as a secondmate must be a git worktree. I checked the other places in the changed area: the only secondmate spawns in these tests are the ones listed. The earlier rounds already fixed the other fixtures (`fm-secondmate-liveness`, `fm-secondmate-safety`) the same way. **Fix.** - Each of those four secondmate homes now gets the same `.gitignore` plus `git init -q -b main` that the liveness and safety tests already use. - The two Herdr tests clean up with their own plain `rm -rf "$TMP_ROOT"`, not the shared `tests/lib.sh` helper. Because the installer leaves each `state/<id>.git-hooks` directory read-only, that cleanup printed "Permission denied" and left the directories behind. Both cleanups now restore the owner's write bit on every directory before removing (`find ... -exec chmod u+rwx`), which is what `fm_test_remove_tree` in `tests/lib.sh` does. **Verification.** - `tests/fm-secondmate-harness.test.sh` passes. - `tests/fm-backlog-atomicity.test.sh` passes (99 ok, exit 0). - shellcheck is clean on all four files. - I could not run the two real-Herdr tests locally: the Herdr lab on this host refuses to start because it needs exactly one running default session, and I did not change the host's Herdr state to get around that. Instead I checked their two changed steps directly: the installer succeeds on a home set up the new way, and the new cleanup removes the read-only hooks directory completely. Those two tests will only be proven on CI

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Verdict: Diff reviewed (bin/fm-git-strip-ai-trailers.sh commit-msg strip + spawn GIT_CONFIG hooksPath install for every launch kind; teardown/test cleanup). Tip only strips known AI Co-authored-by product names/bot addresses; human co-authors and author identity untouched; project hooks chained. Closes ready-for-pr #5665 (Fixes verified; unfixed on main — Claude attribution-off only).

contract-class: restore — fleet-launched commits already promised no AI attribution via Claude --settings; other runtimes still land trailers on the same concrete default spawn path. Hook is mechanics to close that hole, not a new captain-facing surface.

VISION: One captain / honesty — aligns (published commits stay clean). Authority explicit — aligns (enforces existing attribution-off policy; no new autonomy). Scripts own mechanics — aligns. Restart — aligns (per-task hooks dir cleaned on teardown). Delegation/spine — aligns. Vendor — aligns (runtime-agnostic strip; Claude defense-in-depth). Scope — aligns (spawn/commit hygiene, not workshop).

Attestation: MATCH cb4199e296dd157ca76313ffbc68296655f5a1e4. NM/CI: SUCCESS (19/19). Firstmate flag: no. Merging squash.

@kunchenguid
kunchenguid merged commit 83a4bbd into kunchenguid:main Sep 25, 2026
19 checks passed

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @tiago-peixoto — really appreciate you taking the time on this.

mehulbhagwani pushed a commit to mehulbhagwani/firstmate that referenced this pull request Sep 26, 2026
…nchenguid#5695)

* fix(bin): strip AI co-author trailers from fleet-launched commits

Cursor and other non-Claude runtimes append the trailer after the typed
message. A per-task commit-msg hook removes it and leaves human co-authors
and the author identity untouched.

* no-mistakes(review): Export pane hooksPath override and drop generated-with stripping

* no-mistakes(ci): This PR caused all three CI failures, and the fix is test-only: 4 test files change, no product code. **Cause.** `fm-spawn.sh` now installs the AI-trailer strip hooks for every spawn, secondmates included. The installer refuses a worktree that is not a git repository, and the PR deliberately keeps that fail-closed rule because real secondmate homes are firstmate clones. Four test fixtures still gave secondmates a plain directory as their home, so each spawn failed with "not a git worktree ... could not install the AI-trailer strip hooks": - serial 5: `tests/fm-backlog-atomicity.test.sh` ("secondmate spawn failed"). - serial 8: `tests/fm-secondmate-harness.test.sh` ("split: no meta written"). - Herdr: `tests/fm-backend-herdr-launcher-workspace-e2e.test.sh` and `tests/fm-backend-herdr-workspace-per-home-e2e.test.sh`. **Rule that must hold.** Every home a test spawns as a secondmate must be a git worktree. I checked the other places in the changed area: the only secondmate spawns in these tests are the ones listed. The earlier rounds already fixed the other fixtures (`fm-secondmate-liveness`, `fm-secondmate-safety`) the same way. **Fix.** - Each of those four secondmate homes now gets the same `.gitignore` plus `git init -q -b main` that the liveness and safety tests already use. - The two Herdr tests clean up with their own plain `rm -rf "$TMP_ROOT"`, not the shared `tests/lib.sh` helper. Because the installer leaves each `state/<id>.git-hooks` directory read-only, that cleanup printed "Permission denied" and left the directories behind. Both cleanups now restore the owner's write bit on every directory before removing (`find ... -exec chmod u+rwx`), which is what `fm_test_remove_tree` in `tests/lib.sh` does. **Verification.** - `tests/fm-secondmate-harness.test.sh` passes. - `tests/fm-backlog-atomicity.test.sh` passes (99 ok, exit 0). - shellcheck is clean on all four files. - I could not run the two real-Herdr tests locally: the Herdr lab on this host refuses to start because it needs exactly one running default session, and I did not change the host's Herdr state to get around that. Instead I checked their two changed steps directly: the installer succeeds on a home set up the new way, and the new cleanup removes the read-only hooks directory completely. Those two tests will only be proven on CI
mehulbhagwani pushed a commit to mehulbhagwani/firstmate that referenced this pull request Sep 26, 2026
…nchenguid#5695)

* fix(bin): strip AI co-author trailers from fleet-launched commits

Cursor and other non-Claude runtimes append the trailer after the typed
message. A per-task commit-msg hook removes it and leaves human co-authors
and the author identity untouched.

* no-mistakes(review): Export pane hooksPath override and drop generated-with stripping

* no-mistakes(ci): This PR caused all three CI failures, and the fix is test-only: 4 test files change, no product code. **Cause.** `fm-spawn.sh` now installs the AI-trailer strip hooks for every spawn, secondmates included. The installer refuses a worktree that is not a git repository, and the PR deliberately keeps that fail-closed rule because real secondmate homes are firstmate clones. Four test fixtures still gave secondmates a plain directory as their home, so each spawn failed with "not a git worktree ... could not install the AI-trailer strip hooks": - serial 5: `tests/fm-backlog-atomicity.test.sh` ("secondmate spawn failed"). - serial 8: `tests/fm-secondmate-harness.test.sh` ("split: no meta written"). - Herdr: `tests/fm-backend-herdr-launcher-workspace-e2e.test.sh` and `tests/fm-backend-herdr-workspace-per-home-e2e.test.sh`. **Rule that must hold.** Every home a test spawns as a secondmate must be a git worktree. I checked the other places in the changed area: the only secondmate spawns in these tests are the ones listed. The earlier rounds already fixed the other fixtures (`fm-secondmate-liveness`, `fm-secondmate-safety`) the same way. **Fix.** - Each of those four secondmate homes now gets the same `.gitignore` plus `git init -q -b main` that the liveness and safety tests already use. - The two Herdr tests clean up with their own plain `rm -rf "$TMP_ROOT"`, not the shared `tests/lib.sh` helper. Because the installer leaves each `state/<id>.git-hooks` directory read-only, that cleanup printed "Permission denied" and left the directories behind. Both cleanups now restore the owner's write bit on every directory before removing (`find ... -exec chmod u+rwx`), which is what `fm_test_remove_tree` in `tests/lib.sh` does. **Verification.** - `tests/fm-secondmate-harness.test.sh` passes. - `tests/fm-backlog-atomicity.test.sh` passes (99 ok, exit 0). - shellcheck is clean on all four files. - I could not run the two real-Herdr tests locally: the Herdr lab on this host refuses to start because it needs exactly one running default session, and I did not change the host's Herdr state to get around that. Instead I checked their two changed steps directly: the installer succeeds on a home set up the new way, and the new cleanup removes the read-only hooks directory completely. Those two tests will only be proven on CI
ashkonmousavi added a commit to ashkonmousavi/firstmate that referenced this pull request Sep 26, 2026