Repository navigation
fix: keep persistent secondmates out of landed-work cleanup - #5696
Merged
Merged
Conversation
The return brief's "Landed, cleanup due" scan listed every state/*.meta record carrying a pr= and a merge-notified marker without regard to kind, so a secondmate record holding a relayed child's merged PR put the mate itself up for "bin/fm-teardown.sh <mate>" cleanup. A secondmate is a persistent worker, never landed work. - bin/fm-afk-return.sh: skip kind=secondmate in the landed-cleanup scan. - bin/fm-pr-check.sh: refuse to record pr= or arm a merge watch on a kind=secondmate record before any side effect; a PR reported on its routed status channel belongs to a task in the mate's own home, which arms its own watch. - bin/fm-watch.sh: a merged result from a poll already armed on a secondmate retires the poll silently - no merge outcome, marker, or wake.
…e three-second wait was sensitive to runner load. Increased the wait for both state- and home-deletion cases without changing watcher behavior. The full fm-watch-arm suite passed locally; syntax and diff checks passed
mehulbhagwani
pushed a commit
to mehulbhagwani/firstmate
that referenced
this pull request
Sep 26, 2026
…uid#5696) * fix(bin): never offer a persistent secondmate for teardown The return brief's "Landed, cleanup due" scan listed every state/*.meta record carrying a pr= and a merge-notified marker without regard to kind, so a secondmate record holding a relayed child's merged PR put the mate itself up for "bin/fm-teardown.sh <mate>" cleanup. A secondmate is a persistent worker, never landed work. - bin/fm-afk-return.sh: skip kind=secondmate in the landed-cleanup scan. - bin/fm-pr-check.sh: refuse to record pr= or arm a merge watch on a kind=secondmate record before any side effect; a PR reported on its routed status channel belongs to a task in the mate's own home, which arms its own watch. - bin/fm-watch.sh: a merged result from a poll already armed on a secondmate retires the poll silently - no merge outcome, marker, or wake. * no-mistakes(document): Document secondmate merge-watch and return-brief exclusions * no-mistakes(ci): CI failed in an unchanged watcher-shutdown test whose three-second wait was sensitive to runner load. Increased the wait for both state- and home-deletion cases without changing watcher behavior. The full fm-watch-arm suite passed locally; syntax and diff checks passed
kunchenguid
added a commit
that referenced
this pull request
Sep 26, 2026
Main has been red since fm-pr-check.sh began refusing to arm a merge poll on a kind=secondmate record (#5696): the relaunch-ordering case in tests/fm-remote-secondmate-relaunch.test.sh armed its fixture through that entry point and could no longer be set up. The ordering guarantee still matters: a secondmate record armed before the refusal can legitimately carry a trailing pr=/pr_head= identity block until the watcher retires it, and fm-remote-secondmate-relaunch.sh must still keep that block last when republishing harness/model/effort. Seed the fixture the way such a record was really written - pr= appended last to the meta, then the poll artifacts published through the same fm_pr_poll_prepare/fm_pr_poll_publish_prepared pair fm-pr-check.sh uses, a pattern tests/fm-pr-check-security.test.sh already follows - and drop the now-unused fake gh fixture. The #5696 refusal itself stays pinned by the security suite's secondmate-record case.
mehulbhagwani
pushed a commit
to mehulbhagwani/firstmate
that referenced
this pull request
Sep 26, 2026
…uid#5696) * fix(bin): never offer a persistent secondmate for teardown The return brief's "Landed, cleanup due" scan listed every state/*.meta record carrying a pr= and a merge-notified marker without regard to kind, so a secondmate record holding a relayed child's merged PR put the mate itself up for "bin/fm-teardown.sh <mate>" cleanup. A secondmate is a persistent worker, never landed work. - bin/fm-afk-return.sh: skip kind=secondmate in the landed-cleanup scan. - bin/fm-pr-check.sh: refuse to record pr= or arm a merge watch on a kind=secondmate record before any side effect; a PR reported on its routed status channel belongs to a task in the mate's own home, which arms its own watch. - bin/fm-watch.sh: a merged result from a poll already armed on a secondmate retires the poll silently - no merge outcome, marker, or wake. * no-mistakes(document): Document secondmate merge-watch and return-brief exclusions * no-mistakes(ci): CI failed in an unchanged watcher-shutdown test whose three-second wait was sensitive to runner load. Increased the wait for both state- and home-deletion cases without changing watcher behavior. The full fm-watch-arm suite passed locally; syntax and diff checks passed
kunchenguid
added a commit
that referenced
this pull request
Sep 26, 2026
) Main has been red since fm-pr-check.sh began refusing to arm a merge poll on a kind=secondmate record (#5696): the relaunch-ordering case in tests/fm-remote-secondmate-relaunch.test.sh armed its fixture through that entry point and could no longer be set up. The ordering guarantee still matters: a secondmate record armed before the refusal can legitimately carry a trailing pr=/pr_head= identity block until the watcher retires it, and fm-remote-secondmate-relaunch.sh must still keep that block last when republishing harness/model/effort. Seed the fixture the way such a record was really written - pr= appended last to the meta, then the poll artifacts published through the same fm_pr_poll_prepare/fm_pr_poll_publish_prepared pair fm-pr-check.sh uses, a pattern tests/fm-pr-check-security.test.sh already follows - and drop the now-unused fake gh fixture. The #5696 refusal itself stays pinned by the security suite's secondmate-record case.
ashkonmousavi
added a commit
to ashkonmousavi/firstmate
that referenced
this pull request
Sep 26, 2026
Intent
yup
Context: that approved fixing a defect seen in the main home's first real away window on the supervision host (Claude primary, config/supervision-host on, 2026-09-25 07:51Z-16:41Z). The return brief from bin/fm-afk-return.sh listed persistent second mates as finished work: its "Landed, cleanup due" section listed axi-a1, eddies-wallet-e1, mini-default, and sshhip-h7 (kind=secondmate direct reports) with a merged PR each and printed "close it with bin/fm-teardown.sh once catch-up clears". A second mate is persistent and must never be offered for teardown; this likely affects the daemon path too. Fix it so secondmates never appear there, and check whatever else feeds that list. Reproduce end to end in an isolated lab home first, make the minimal root-cause fix, and turn the reproduction into a behavioral regression test.
What Changed
Risk Assessment
✅ Low: The change blocks secondmates from the return-brief cleanup list, prevents new PR watches on their records, and silently retires existing merged polls, with behavioral regression coverage.
Testing
The return-brief regression suite ran. The PR-check security suite passed its simulated secondmate watcher case but timed out later. The return and PR-check commands were also driven in disposable lab homes, with CLI output saved. No visual surface was identified.
Evidence: Live return brief
Source: Live return brief
Evidence: Live secondmate PR-check refusal
Source: Live secondmate PR-check refusal
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
tests/fm-afk-return.test.sh && tests/fm-pr-check-security.test.sh(second suite timed out after the simulated secondmate watcher case passed)FM_HOME="$LAB" bin/fm-afk-return.sh checkwith merged delivery and secondmate records in a disposable lab homeFM_HOME="$LAB" bin/fm-pr-check.sh axi-mate https://github.com/example/child/pull/7in a disposable lab home; checked exit status and absence of poll artifacts✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.