Repository navigation
feat(spawn): disable commit signing per task worktree - #1
Merged
Merged
Conversation
Autonomous crewmates inherit the operator's global git config; a commit.gpgsign=true backed by an interactive signer (e.g. a GUI GPG or 1Password agent) blocks every autonomous commit. Unsigned autonomous commits are standing policy, so fm-spawn now disables commit and tag signing for each worktree it hands off. New fm-sign-lib.sh scopes the override to the one worktree via git's per-worktree config namespace (extensions.worktreeConfig + git config --worktree), so the primary checkout, sibling pooled worktrees, and the captain's own repos keep their normal signing. Applied to ship, scout, and secondmate worktrees. Colocated test reproduces the block with an unavailable signer and asserts the worktree resolves gpgsign=false while the pooled clone stays untouched.
…h signing lib and herdr regex
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.
Intent
Make bin/fm-spawn.sh disable git commit signing automatically for each task worktree it acquires, so autonomous crewmates never block on an interactive commit signer (e.g. a GUI GPG / 1Password agent that needs a click). Unsigned autonomous commits are standing policy. Requirements the reviewer would not see from the diff alone: (1) The override MUST be scoped to the task worktree only - the primary firstmate checkout, the captain's own repos, and sibling worktrees of the pooled clone must keep their normal signing. I chose git's per-worktree config namespace (git config extensions.worktreeConfig true on the shared pooled repo, then git config --worktree commit.gpgsign false / tag.gpgsign false in the task worktree) over an env-var approach, because it is persistent, observable via 'git config', and is what makes the acceptance test ('worktree resolves commit.gpgsign=false while pooled clone untouched') meaningful. I verified empirically that enabling extensions.worktreeConfig on firstmate's actual pooled clone is safe: the core.bare/core.worktree footgun does not apply (core.bare=false is harmless, core.worktree unset, git migrates/duplicates nothing), the primary keeps signing, and on a repositoryformatversion=0 repo an older git merely ignores the extension so signing stays on (degrades to today's behavior, never corrupts). Ordering matters and is deliberate: the extension is enabled first, else 'git config --worktree' silently leaks to the shared config. (2) Both commit.gpgsign and tag.gpgsign are covered. (3) Applied to ship, scout, AND secondmate worktrees - secondmate homes are deliberately included because they are worktrees of the firstmate repo that an autonomous agent commits shared material in, so the same block would hit them. (4) No opt-out knob by deliberate choice: an autonomous session can never answer a GUI signer and unsigned autonomous commits are standing policy, so per the repo's coding guidelines the script/lib header owns this rather than a config knob or docs/configuration.md. The logic lives in a new sourceable lib bin/fm-sign-lib.sh (matching the fm-ff-lib.sh / fm-config-inherit-lib.sh idiom) called once from fm-spawn after the worktree is finalized and validated for every kind; it is best-effort (warns, does not abort a live spawn, on failure). The colocated test tests/fm-sign-lib.test.sh reproduces the real block with an unavailable signer and asserts worktree gpgsign=false with the pooled clone untouched, plus idempotency and non-worktree rejection. The test also contains a one-line mkdir -p on the tmp root to work around a pre-existing harness quirk where fm_test_tmproot's cleanup trap fires in the command-substitution subshell under bash 5.3.
What Changed
bin/fm-sign-lib.sh, a sourceable library that scopes commit signing off for a single task worktree: it enablesextensions.worktreeConfigon the shared pooled repo, then setscommit.gpgsignandtag.gpgsigntofalseviagit config --worktree, leaving the pooled clone and sibling worktrees untouched. It is idempotent and rejects non-worktree targets.bin/fm-spawn.shto calldisable_worktree_commit_signingonce after the worktree is finalized and validated, for ship, scout, and secondmate spawns, as best-effort (warns without aborting the spawn on failure) so autonomous agents never block on an interactive commit signer.docs/scripts.mdanddocs/configuration.mdto document the new signing library and the regex change.Risk Assessment
✅ Low: A small, well-bounded, well-documented change with a dedicated colocated test; the mechanism is correctly scoped to the task worktree, ordered before agent launch, and fails safe with a warning.
Testing
The configured baseline suite already passed on the runner; here I focused on the signing change. tests/fm-sign-lib.test.sh passes (5/5) and reproduces the real interactive-signer block, and a hand-run end-to-end demo confirms the full intent: after the disable the task worktree resolves commit.gpgsign/tag.gpgsign=false and commits under an unavailable signer, the override lives in the worktree's own config.worktree (zero gpgsign entries in shared config), and the pooled clone plus sibling worktree keep signing=true and still block. I also confirmed fm-spawn calls the lib after $WT is finalized for ship, scout, and secondmate kinds, and the adjacent spawn/herdr/teardown suites pass. The only suite failure I observed (fm-session-start.test.sh "pi supervision block") is an environment artifact of running inside a Claude Code session — fm-harness.sh short-circuits on CLAUDECODE=1 — and is unrelated to this diff (session-start machinery is untouched); re-running with CLAUDECODE unset passes 16/16. No product issues found; worktree left clean.
Evidence: Commit-signing scope demo (end-to-end CLI transcript)
>>> BEFORE: autonomous commit in task worktree BLOCKS (signer unavailable) commit FAILED as expected -> an unattended crewmate would hang here forever >>> disable_worktree_commit_signing <task-worktree> returned 0 task worktree commit.gpgsign = false tag.gpgsign = false pooled clone commit.gpgsign = true tag.gpgsign = true (UNCHANGED) sibling worktree commit.gpgsign = true tag.gpgsign = true (UNCHANGED) per-worktree config.worktree present: yes; shared .git/config gpgsign: 0 >>> AFTER: task-worktree commit SUCCEEDED; pool commit still BLOCKSPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-sign-lib.sh:50- disable_worktree_commit_signing writes extensions.worktreeConfig to the SHARED pooled repo config (git config, which acquires .git/config.lock). If firstmate spawns two crewmates against the same project pooled clone as parallel tool calls, both may hit that lock in the brief write window; the loser gets a git-config failure, the function returns non-zero, and signing is NOT disabled for that worktree - so that autonomous crewmate can still block on an interactive signer. This is by-design best-effort (it warns loudly) and realistically rare (batch dispatch is sequential, and the collision window is tiny relative to the treehouse work each spawn does first), but the failure mode is worth noting since the whole point is to prevent an unattended block.🔧 **Test** - 1 issue found → auto-fixed ✅
command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"🔧 Fix: fix(herdr): byte-exact bare-prompt regex for composer state
✅ Re-checked - no issues remain.
command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"bash tests/fm-sign-lib.test.sh— 5/5 ok (baseline block reproduces, scoped disable, disabled worktree commits while primary blocks, idempotent, rejects non-worktree)End-to-end CLI demo sourcing bin/fm-sign-lib.sh against a pooled repo + task/sibling worktrees with a forced-signing global config pointing at a nonexistent signer; captured to signing-scope-demo.txtVerified fm-spawn.sh wiring:disable_worktree_commit_signing "$WT"at line 856 runs after $WT is finalized for secondmate (606), ship/scout (834) and after validate_spawn_worktreeRan adjacent suites covering the touched files:bash tests/fm-spawn-batch.test.sh,tests/fm-spawn-dispatch-profile.test.sh,tests/fm-backend-herdr.test.sh,tests/fm-composer-ghost.test.sh,tests/fm-tangle-guard.test.sh,tests/fm-teardown.test.sh— all okIsolatedbash tests/fm-session-start.test.shfailed only due to CLAUDECODE=1 leaking from the Claude Code session;env -u CLAUDECODE bash tests/fm-session-start.test.shpasses 16/16 (exit 0)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.