Repository navigation
fix: clean up workers after their pull requests land - #5317
Merged
Merged
Conversation
…turn During the 2026-09-22 away window every exemption worker whose pull request had merged was left sitting for nine hours. The supervision branch received the stale wake, the merge-landed check, and the hourly inactive-outcome row for each of them, ran the recovery playbook, found nothing to recover, and reported "no further action". The branch prompt granted ordinary teardown of a confirmed-landed task without ever naming the moment or the command, and the playbook has no landed exit, so the stale path ended at "nothing to recover". The return brief then listed only blockers, decisions, and the latest five routine outcomes, so the landed workers stayed invisible after the captain came back. - bin/fm-branch-prompt.sh: name the merge-landed wake, and any later stale, inactive-outcome, or heartbeat row on a done task with a merged PR, as the moment to claim the lease and run bin/fm-teardown.sh with no flags; a refusal is reported, never forced or worked around. Add teardown to the handling tool list. - stuck-crewmate-recovery: a landed worker is not a recovery case; point at the ordinary teardown owner for each actor. - bin/fm-afk-return.sh: render a "Landed, cleanup due" section from durable records only (a live task record whose recorded PR carries the merge-notification marker), between could-not-fix and handled, without holding the gate; the afk skill's return step closes each listed task through ordinary teardown once the check clears. - tests: pin the prompt rule in fm-branch-supervision and the brief section in fm-afk-return through the real marker writer.
BohnBawerick
added a commit
to BohnBawerick/firstmate
that referenced
this pull request
Sep 23, 2026
Intent
Investigate the away-window transcripts and fix the root cause of this gap: after pull requests landed, the workers were left sitting. Supervision should have closed them. It recorded that nothing needed recovery and stopped. The return also did not close them.
The away window was 2026-09-22T07:28:14Z to 2026-09-22T16:18:35Z. The words were: all no-mistakes workflow changes should merge and complete. The sitting workers were the exemption changes whose pull requests had already merged.
What Changed
Risk Assessment
✅ Low: The change is narrowly scoped, preserves teardown safety checks, adds durable merge-marker-based return visibility, and covers the new observable return-brief behavior without introducing a substantiated defect.
Testing
A real isolated away-entry and return cycle used two live Herdr endpoints: the durably merge-marked task appeared as cleanup due, while the done task lacking merge evidence did not; endpoint checks, the targeted return regression, cleanup, and lab teardown all succeeded.
landed-liveas a running Herdr pane before return and underLanded, cleanup duein the real return brief.unproved-liveas a running Herdr pane with done status, while the real return brief omits it fromLanded, cleanup due.Evidence: Live AFK return transcript with endpoint state and return brief
Source: Live AFK return transcript with endpoint state and return brief
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
🔧 **Test** - 1 issue found → no changes applied (2) ✅
bin/fm-teardown.sh landedbefore catch-up clears.landedworker, not theopencontrol worker.bin/fm-test-run.sh tests/fm-afk-return.test.sh tests/fm-branch-supervision.test.shIsolated Herdr 0.9.0 lab viabin/fm-herdr-lab.sh provision/run/teardown: created two live workers, marked one PR merged, entered away posture, and ranbin/fm-afk-return.sh beginbin/fm-branch-prompt.shruntime protocol generation, extracting the landed-worker lifecycle instructionsVerified the worktree was clean after removing transient live-test data🔧 No changes applied.
1 warning still open:
live-supervision-summary.txtshows the durable merge-landed wake, successful ordinaryteardown landed-live complete, and confirmation that both the task record and exact Herdr pane were removed.live-supervision-summary.txtrecords the exact uncommitted-work refusal and confirms the task record, Herdr pane, and dirty file all remained.fm-afk-returntest, not by driving an actual away-and-return flow against the live product. A live Firstmate away/return session with a…fm-afk-returntest, not by driving an actual return flow against the live product. A live Firstmate away/return session with a done but…bin/fm-test-run.sh tests/fm-afk-return.test.sh tests/fm-branch-supervision.test.sh~/.no-mistakes/evidence/01M351FDMW4618QZPN0N9NYHYV/live-supervision-scenarios.shExtracted wake, teardown, refusal, state-check, and version evidence intolive-supervision-summary.txtusingjq,grep, and the scenario assertions.🔧 No changes applied.
✅ Re-checked - no issues remain.
landed-liveas a running Herdr pane before return and underLanded, cleanup duein the real return brief.unproved-liveas a running Herdr pane with done status, while the real return brief omits it fromLanded, cleanup due.Provisioned, drove, and tore down an isolated named Herdr session throughbin/fm-herdr-lab.sh provision|run|teardown.Ran real away entry with isolatedFM_HOME:bin/fm-afk-launch.sh enter --words 'all no-mistakes workflow changes should merge and complete'.Ran the real return path with isolated state/data:bin/fm-afk-return.sh.Verified both recorded Herdr endpoints were live before and after return usingpane process-info --pane <id>.Ran targeted regression testtests/fm-afk-return.test.sh.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.