Repository navigation
fix(spawn): strip agent co-author trailers in the task worktree - #4523
Closed
kkennethlau12393 wants to merge 2 commits into
Closed
kkennethlau12393 wants to merge 2 commits into
kkennethlau12393 wants to merge 2 commits into
Conversation
Every supported worker harness injects its own commit attribution into the agent's session instructions, so the launch brief's rule against naming an agent as a co-author competes with the harness and loses: workers landed 'Co-Authored-By: Claude Opus 5 <...>' and 'Claude-Session: ...' trailers on commits whose brief forbade them, and one reached a project's default branch. Enforce it below every harness instead. bin/fm-commit-trailer-lib.sh generates a commit-msg hook and points the task worktree at it through the repository's per-worktree config, so the hook binds only that disposable copy and never the captain's own checkout or the shared hooks directory. The hook chains an inherited hooks path or repository commit-msg hook rather than replacing it, then removes agent 'Co-Authored-By:' and '<Agent>-Session:' lines while leaving a human co-author untouched. fm-spawn installs it, fm-teardown retires it and restores whatever hooks path the copy had. The brief scaffold keeps one line stating the rule as the discovery layer.
tests/fm-lint.test.sh writes a real fixture into the repo's tests/ directory for the length of one case, and it was named *.test.sh. The runner's coverage and lane-union checks glob tests/*.test.sh, so a concurrent tests/fm-test-run.test.sh saw a script that exists for a second and belongs to no lane, and failed with "--list --all missing scripts" or a lane-union count off by one. tests/*.sh is still inside fm-lint.sh's canonical set, so dropping the .test.sh suffix keeps the case honest and removes the cross-test flake.
Author
|
Opened against the upstream by mistake; this change lands in our own fork. |
tiago-peixoto
added a commit
to tiago-peixoto/firstmate
that referenced
this pull request
Sep 25, 2026
…time (#57) Cursor injects the trailer after the typed message, and a per-machine cli-config opt-out is not a fleet contract. Every spawn now gives the pane a commit-msg hook that strips known AI trailers at the commit object, chaining the repository's own hooks at run time, failing closed on non-git launches, and cleaning up its read-only strip directory on abort and teardown. A secondmate home must be a git checkout so the strip cannot be skipped there; the upstream worker-account fixture is taught that. Fork patch. No upstream thread of this fleet's own tracks it; the nearest upstream threads are other contributors' brief-rule PRs kunchenguid#1379 and kunchenguid#4352 (open) and kunchenguid#4523 (closed by its author as a mistaken target).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is wrong
Every supported worker harness injects its own commit attribution into the agent's session instructions, so the launch brief's rule against naming an agent as a co-author competes with the harness and loses.
Workers landed
Co-Authored-By: Claude Opus 5 <...>andClaude-Session: ...trailers on commits whose brief forbade them, and one reached a project's default branch.The existing per-launch
attributionsetting only disables Claude Code's automatic trailer; it does nothing about an agent that types the trailer itself.The fix
Enforcement moves below every harness, into git.
bin/fm-commit-trailer-lib.sh(new) owns one constant list of agent products, generates thecommit-msghook, installs it, and removes it.extensions.worktreeConfig+git config --worktree core.hooksPath), so it never reaches the captain's own checkout, the shared.git/hooks, or any tracked file in the project.commit-msghook is chained, never replaced: it runs first, its exit status propagates, and it is resolved at run time so a hook added later is still honoured.Co-Authored-By:lines and<Agent>-Session:lines are removed; a human co-author survives untouched.bin/fm-spawn.shinstalls it once the task worktree is final, for every harness and backend at once, and refuses the spawn if it cannot.bin/fm-teardown.shretires it while the local copy still exists and restores whatever hooks path that copy had.bin/fm-brief.shkeeps one line stating the rule, as the discovery layer.A repository whose shared config sets
core.worktreeorcore.bare=truewithout per-worktree config already enabled is refused with the two migration commands, rather than silently changing where those shared settings apply.Proof
tests/fm-commit-trailer-lib.test.shspawns nothing: it builds a repository plus a linked worktree the way spawn does and asserts that agent trailers are stripped while a human co-author survives, that every listed agent product is caught case-insensitively, that an inherited repository hook still runs and still gates the commit, that a configured hooks path is chained and left unchanged, that the primary checkout is unaffected, that removal leaves no hook, no hooks path, and no rewriting behind, that a pre-existing worktree hooks path is restored, that reinstall is idempotent, and that a non-worktree path is refused.bin/fm-lint.shis green.The changed-file test selection (60 scripts) has four failures, all reproduced unchanged on the base commit: the codex and muse process-ancestry checks, the herdr missing-adapter teardown preflight case, and
fm-backend's search for a historical permissive tmux kill adapter.Also in this branch
tests/fm-lint.test.shwrote its temporary fixture into the repository astests/fm-lint-local-exclude-fixture.test.sh.The runner's coverage and lane-union checks glob
tests/*.test.sh, so a concurrenttests/fm-test-run.test.shsaw a script that exists for a second and belongs to no lane and failed.The fixture is now
tests/fm-lint-local-exclude-fixture.sh, still insidefm-lint.sh's canonical set.