Repository navigation
fix: ignore secondmate home marker during sync - #417
Merged
Merged
Conversation
bin/fm-home-seed.sh writes an untracked .fm-secondmate-home marker into every seeded secondmate home. A secondmate home is a worktree of the firstmate repo, so any plain `git status --porcelain` dirtiness check counted the untracked marker and the home read as dirty forever: fleet-sync reported it STUCK and the local fast-forward convergence sweeps risked leaving it stale on firstmate updates. Add .fm-secondmate-home to the tracked .gitignore so the marker is invisible to every dirtiness check uniformly, without weakening fleet-sync's deliberate untracked-counting for project clones. Convergence chicken-and-egg: existing homes predate the fix and it only arrives by fast-forward. The already-present marker-tolerant ff-skip (ignore_seed_marker=yes, used by the bootstrap sweep, /updatefirstmate, and spawn pre-launch) advances such a home past the fix commit, after which .gitignore takes over - no hand intervention. Tests in tests/fm-secondmate-sync.test.sh cover a freshly seeded home reading clean, an existing marker-only home converging then reading clean, and a genuinely dirty home still skipping.
Keigyoku
pushed a commit
to Keigyoku/firstmate
that referenced
this pull request
Jul 11, 2026
* fix: gitignore the secondmate home marker bin/fm-home-seed.sh writes an untracked .fm-secondmate-home marker into every seeded secondmate home. A secondmate home is a worktree of the firstmate repo, so any plain `git status --porcelain` dirtiness check counted the untracked marker and the home read as dirty forever: fleet-sync reported it STUCK and the local fast-forward convergence sweeps risked leaving it stale on firstmate updates. Add .fm-secondmate-home to the tracked .gitignore so the marker is invisible to every dirtiness check uniformly, without weakening fleet-sync's deliberate untracked-counting for project clones. Convergence chicken-and-egg: existing homes predate the fix and it only arrives by fast-forward. The already-present marker-tolerant ff-skip (ignore_seed_marker=yes, used by the bootstrap sweep, /updatefirstmate, and spawn pre-launch) advances such a home past the fix commit, after which .gitignore takes over - no hand intervention. Tests in tests/fm-secondmate-sync.test.sh cover a freshly seeded home reading clean, an existing marker-only home converging then reading clean, and a genuinely dirty home still skipping. * no-mistakes(review): Captain: document standalone-clone update path * no-mistakes(document): Document secondmate marker migration (cherry picked from commit 171207c)
Keigyoku
added a commit
to Keigyoku/firstmate
that referenced
this pull request
Jul 11, 2026
…, kunchenguid#435 deferred) (#8) * feat: add harness-aware supervision (kunchenguid#367) * Add harness-aware supervision * no-mistakes(review): Captain, harden watcher supervision regressions * no-mistakes(review): Captain, harden watcher supervision cadence * no-mistakes(review): Harden watcher supervision ownership * no-mistakes(review): Captain, harden Pi extension marker * no-mistakes(review): Captain, harden Pi supervision restart checks * no-mistakes(review): Harden watcher ownership checks * no-mistakes(review): Captain, harden Pi supervision loading * no-mistakes(review): Captain, require Pi guard extension loading * no-mistakes(review): Captain, harden watcher supervision recovery * no-mistakes(test): Fix fm-send baseline log filtering * no-mistakes(document): Sync harness supervision docs * no-mistakes: apply CI fixes (cherry picked from commit 090483e) * fix: split X-mode replies by platform (kunchenguid#369) * fix: make x replies split by platform * no-mistakes(review): Captain: preserve Discord recovery relink context * no-mistakes(test): Captain: keep split markers outside fences * no-mistakes(document): Sync X-mode reply docs (cherry picked from commit 4790bc5) * fix: make stow memory writes inspect before update (kunchenguid#372) * docs: make stow inspect-then-update * no-mistakes(review): Remove unsupported archive-body guidance * no-mistakes(review): Clarify stow read-before-write exception * no-mistakes(test): Require archive-body for stow task notes * no-mistakes(document): Sync stow memory docs * no-mistakes(lint): Silence ShellCheck source warning (cherry picked from commit af5361e) * fix(watcher): wait when arm attaches to a healthy watcher (kunchenguid#375) * fix: attach-and-wait when arm finds a healthy watcher Grok and Claude re-arm after every turn with work in flight. When a watcher was already healthy, fm-watch-arm exited immediately with watcher: healthy, which completed the harness background task and injected an empty false wake. Attach to the live identity-matched holder instead, stay until that cycle ends, then exit 0 so notify fires for a real end-of-cycle. The peer-startup-race path uses the same contract. --restart and the started path are unchanged. * no-mistakes(review): Gate restart watcher peer attach * no-mistakes(document): Sync watcher arm docs (cherry picked from commit 7302a95) * feat(pi): simplify primary session launch (kunchenguid#386) * docs(readme): reformat Quick Start and recommend Grok equally with Claude Code * no-mistakes(review): Captain: align harness launch guidance * no-mistakes(review): Captain, clarify Pi supervised launch * no-mistakes(review): Captain, document Pi first-launch bridge * feat(pi): track primary watcher extension for plain-pi launch Move Pi's primary watcher bridge from a generated state/ file to a tracked .pi/extensions/fm-primary-pi-watch.ts, matching how the turn-end guard extension already works: self-hashing version, project-local auto-discovery after one-time Pi trust. This drops the state/-generation step and dual -e requirement from the happy path, so Pi's Quick Start launch becomes plain 'pi', the same friction class as 'claude' and 'grok --trust'. - bin/fm-pi-watch-extension.sh is removed; nothing generates the extension anymore since it is committed. - fm-session-start.sh and fm-supervision-instructions.sh resolve the watcher extension path from FM_ROOT instead of state/, and the session-start diagnostic now points at restarting plain pi after trust, with -e as a documented fallback. - fm-spawn.sh points Pi secondmate launches at the tracked extension path in the secondmate home instead of generating a state/ copy. - README Quick Start Pi block is now just 'pi' plus a trust note. - Tests, docs, and the harness-adapters skill updated to match. * fix(pi): drop backticks from session-start diagnostic to satisfy shellcheck SC2016 (cherry picked from commit 1b5a9f5) * feat(supervision): prevent unsafe watcher-arm commands (kunchenguid#387) * feat(supervision): add PreToolUse seatbelt against watcher-arm anti-patterns Adds bin/fm-arm-pretool-check.sh, a shared PreToolUse-style checker that denies a primary shell command backgrounding, piping, or bundling the watcher arm/checkpoint, or force-killing the watcher process broadly - the exact shapes that silently took Grok's supervision down. Wires it into all five verified harnesses (grok, claude, codex, opencode, pi), each validated empirically against the real harness. Also fixes a grok 0.2.93 regression discovered during that validation: the existing turnend-guard Stop hook's bare root variable broke grok's own variable pre-substitution and silently no-op'd the hook. * no-mistakes(review): Harden watcher arm validation * no-mistakes(review): Harden arm guard metacharacter checks * no-mistakes(review): Harden nested shell arm guard * fix(lint): rewrite SC2015 guards in fm-arm-pretool-check.sh as if/then A && B || C is not if-then-else; C can run when A is true. Replace both occurrences of the quote-state early-continue with an explicit if/then. (cherry picked from commit 766f772) * fix(pi): restore primary watcher supervision lifecycle (kunchenguid#397) * fix Pi primary supervision lifecycle * no-mistakes(document): Synchronize Pi primary extension documentation (cherry picked from commit 80ecc8d) * fix: keep persistent secondmates out of the main backlog (kunchenguid#398) * fix secondmate backlog guidance * no-mistakes(review): Require reasons for captain backlog holds * no-mistakes(test): Document secondmate handoff skill requirement * fix secondmate teardown reminder * no-mistakes(document): sync teardown reminder docs to work-items-only backlog contract (cherry picked from commit 7525a37) * fix(backlog-handoff): move full item blocks including indented bodies (kunchenguid#401) * fix(backlog-handoff): move full item blocks including indented bodies fm-backlog-handoff only moved the checklist header line, so multi-line item bodies were left orphaned in the source backlog and never reached the secondmate. Move the full block (header plus indented body lines) atomically, treating body membership by indentation so lines like ## Intent stay with the item, and add regression coverage. * no-mistakes(review): Captain: preserve EOF handoff terminators * no-mistakes(review): treat blank lines inside item bodies as movable body * no-mistakes(document): sync backlog-handoff docs with full-block move behavior (cherry picked from commit 600075e) * feat(herdr): make Herdr lab lifecycle safety deterministic for briefs (kunchenguid#402) * guard Herdr lab lifecycle in briefs * no-mistakes(review): Fix Herdr lab helper and provisioning safety * no-mistakes(review): Captain, harden Herdr lab lifecycle safety * no-mistakes(review): fix Herdr lab test cleanup ordering and brief help range * no-mistakes(review): reject leading options in Herdr lab run guard * no-mistakes(review): strip leading non-alnum in Herdr lab name generator * no-mistakes(document): document Herdr lab helper and --herdr-lab brief flag * no-mistakes(lint): add shellcheck disable for deliberate SC2016 literals in fm-brief herdr-lab * no-mistakes: apply CI fixes (cherry picked from commit 4bc0824) * fix(watcher): classify arm-command seatbelt by execution position (kunchenguid#403) * fix watcher arm command policy * no-mistakes(review): Harden watcher command policy parsing * no-mistakes(review): Captain: harden watcher policy parsing * no-mistakes(review): harden watcher policy for expanded paths, direct-watch, and sound prefilter * no-mistakes(review): close prefilter and classifier locale/ANSI-C watcher-path decode gaps * no-mistakes(review): fail closed on loop-wrapped broad watcher kills * no-mistakes(document): sync docs for watcher-arm command-position policy (cherry picked from commit
Intent
Make the .fm-secondmate-home marker stop reading as a dirty secondmate home to firstmate's sync machinery. bin/fm-home-seed.sh writes an untracked, unignored .fm-secondmate-home marker into every seeded home; because a home is a worktree/clone of the firstmate repo, any plain 'git status --porcelain' dirtiness check counted it, so a home read as dirty forever (fleet-sync reported STUCK). Fix: add .fm-secondmate-home to the tracked .gitignore - the uniform root-cause fix that makes the marker invisible to every dirtiness check at once, WITHOUT broadening fleet-sync's deliberate untracked-counting for project clones and WITHOUT switching the ff-skip to a blanket --untracked-files=no (which would weaken the leave-a-home's-genuine-untracked-in-flight-work-untouched guarantee); the pre-existing marker-specific ignore_seed_marker tolerance stays as the convergence bridge. Convergence of existing pre-fix homes is SCOPED BY HOME TYPE and this scope is INTENDED and already documented on this branch (the no-mistakes(review) commit 'document standalone-clone update path' narrowed the T13 test comment; this resolves the earlier standalone-clone-migration review finding, which the captain approved): a linked-worktree home - the canonical treehouse-lease case that shares the primary's object store - advances past the fix commit on its next bootstrap or spawn sweep via the marker-tolerant local-HEAD fast-forward, after which .gitignore takes over with no hand intervention; a standalone-clone home instead receives the fix commit via /updatefirstmate's origin fetch, since the local-HEAD sweep deliberately never fetches a commit absent from a clone - and origin fetch via /updatefirstmate is a standalone clone's only firstmate-update path anyway - so no home is left permanently marker-dirty. Verified the linked-worktree interaction: the marker is per-working-tree, no cross-worktree object-store interference, and runtime marker reads via [ -f ]/cat are unaffected by gitignore. Four colocated tests in tests/fm-secondmate-sync.test.sh cover: a freshly seeded home reads clean to the exact plain-porcelain signal fleet-sync uses and to the ff sweep; an existing linked-worktree marker-only-dirty home converges then reads clean; a genuinely dirty home (a real tracked edit alongside the marker) still skips; and a guard test pinning the shipped .gitignore entry. Out of scope: tests/fm-session-start.test.sh (a pi-harness fake-ps supervision-block check) fails pre-existing and unrelated on the base tree with these changes stashed.
What Changed
Captain,
.fm-secondmate-homemarker so seeded secondmate homes no longer register as dirty to porcelain-based sync checks.Risk Assessment
✅ Low: Captain, the change is narrowly scoped to ignoring the seeded marker and the reviewed convergence coverage preserves genuine-dirtiness handling.
Testing
The supplied full-suite baseline passed. Focused secondmate-sync coverage passed, and a real-script CLI transcript confirmed fresh seeded homes are porcelain-clean and fleet-sync clean, marker-only linked worktrees fast-forward through bootstrap then become clean, and a real tracked edit still causes the sync to skip and preserves the edit. This CLI-only change has transcript evidence rather than visual UI evidence.
Evidence: End-to-end secondmate marker behavior transcript
Evidence: Focused secondmate-sync test output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
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"Baseline previously run successfully: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-secondmate-sync.test.shbash /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KX5WD1GPQQ3YQPJ06D0P3D8C/run-marker-e2e.sh "$PWD" 31afb8c6e349576f5553e3a372b45ed9bd430e3d 9abb0ac839650d35e3fbb176aad55b2ac67bc343✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.