Repository navigation
feat(bin): require a Done when line in every brief and file follow-ups before cleanup - #62
Merged
Merged
Conversation
…s before cleanup fm-brief.sh now requires --done-when on ship and scout briefs and renders it in the Task section; fm-dod-lib.sh repeats it as the acceptance check. Workers record follow-ups in data/<id>/follow-ups.md or declare none with the new fm-followups.sh, and fm-teardown.sh files each one as a backlog item before cleanup or refuses.
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
Go on revised ledger. The captain approved the revised, engine-first plan for the live project ledger (the mission control / cockpit / second brain) and wants it to actually track tasks and know the goal each piece of work serves. This task is one step of that plan, step C4, and must not build the other steps (C1 event log, C2 charters, C3 renderer are out of scope). Substance of the plan for C4: in the plan's finish loop, every brief carries one runnable 'Done when' line (BMAD step 1: one check a non-builder can run - a command, a scenario, or a screen walk - proving the work is finished; a scout gets it phrased as the question its report must answer), and follow-ups become backlog items before cleanup (the design's S8 first half: 'split, never shrink' - a worker's 'wired later' is filed as its own item instead of shrinking the task; cleanup refuses until each follow-up is filed, with a --none escape). The plan's C4 row reads: 'Done when line in every brief; follow-ups filed before cleanup, with a --none escape', in the firstmate repo. The reason, from the plan: today almost no backlog items carry a finish line, work keeps stopping at 'landed', and the proof of finished must come before any view. Later decision from firstmate: this PR is delivered through the no-mistakes pipeline on the existing branch, keeping the existing commits.
What Changed
bin/fm-brief.shnow requires--done-when "<check>"on ship and scout briefs and refuses a secondmate charter that passes it. A missing, blank, or multi-line value stops the scaffold before anything is written. The line renders as a## Done whensubsection under# Task. A scout's line reads "the report answers ".bin/fm-dod-lib.shrepeats it in the Definition of done as the acceptance check to run and cite.bin/fm-spawn.sh's forge-mismatch re-scaffold hint now includes--done-when.data/<task-id>/follow-ups.md, or runs the newbin/fm-followups.sh <task-id> --none, which appendsfollowups=noneto the task's meta under its lock.bin/fm-teardown.shfiles each recorded line as a queuedkind=follow-upbacklog item throughbin/fm-tasks-axi.sh add, with an "Origin: " body. It tracks progress in the meta so a retried teardown does not file a title twice. Teardown refuses when there is neither a non-empty record nor the--noneescape, and--forceskips the check. Where no automatic backlog transition applies, it prints the titles instead of refusing.tests/lib.sh,docs/scripts.md, and the operational-home-layout skill follow the new--done-whenflag and follow-ups step. Existingfm-brief.shcall sites inbin/fm-live-lab.shandbin/fm-test-run.share updated. The suite gains cases for the Done when line and the follow-up filing, refusal, and--nonepaths.Risk Assessment
✅ Low: The round-1 fix is minimal and correct: recorded titles now win over followups=none, and followups=filed is the only early return, since fm_meta_get is last-wins.
Testing
I ran the three test files this PR touches, as the operator asked, and not the full suite. All three exited 0 with no failures, including the teardown cases for follow-ups: refuse until filed, file all before cleanup, no double filing after a partial failure, the --none escape, and filing a follow-up recorded after --none. I did not run a live Herdr or tmux lab, because these tests already drive the real scripts end to end. There is no UI, so there are no screenshots.
Evidence: fm-brief test log
Source: fm-brief test log
Evidence: fm-dod-lib test log
Source: fm-dod-lib test log
Evidence: fm-teardown test log
Source: fm-teardown test log
Acceptance criteria
Done whenline, filled at scaffold time through a required flag, and the scaffold refuses when it is missing or empty like--mode.Proof:
test_done_when_is_required_on_ship_and_scout(missing on ship and scout,--done-when=empty, whitespace-only, multi-line, and secondmate misuse all refuse and write nothing) andtest_done_when_renders_in_task_and_definition_of_done(all three ship modes).Proof: the scout half of
test_done_when_renders_in_task_and_definition_of_done.Proof:
test_dod_block_repeats_done_when_line(no-mistakes, direct-PR, local-only, and both Gerrit modes; unchanged without the argument) and the Definition of done assertions in criterion 1's render test.--noneescape is recorded in meta.Proof:
test_teardown_refuses_until_follow_ups_are_recorded(no record refuses, an empty record refuses, task record, backlog row, and worktree are all kept).data/<task>/follow-ups.md, one item per line, files each throughbin/fm-tasks-axi.sh addas kind follow-up with repo and origin task, then proceeds.Proof:
test_teardown_files_follow_ups_before_cleanup(three items, bullets stripped, blank line skipped, each(repo: project) (kind: follow-up)withOrigin: task-x1, task then closed),test_teardown_retry_never_files_a_follow_up_twice, and the review fix'stest_teardown_files_follow_ups_recorded_after_none(a record written after--noneis still filed).--noneescape is recorded in the task's meta and lets teardown proceed.Proof:
test_teardown_none_escape_recorded_in_meta.Test runs
Red, before the implementation (new tests only):
The retry test was added after the implementation; disabling its skip check turns it red (
not ok - a retried teardown filed the first follow-up again).Green, after:
Other suites that scaffold briefs or run teardown, run locally, all exit 0 with no
not ok: fm-ask-user-authority, fm-tangle-guard, fm-fleet-ledger, fm-secondmate-safety, fm-subagent-pretool-check, fm-task-delivery, fm-control-relaunch, fm-arm-pretool-check, fm-afk-return, fm-backlog-handoff, fm-backlog-atomicity, fm-backend-orca, fm-backend-zellij, fm-branch-supervision, fm-busy-state, fm-captain-hold-lifecycle, fm-gotmp, fm-model-scorecard, fm-pr-merge, fm-public-followup, fm-pr-check-security, fm-remote-secondmate-parent-binding, fm-spawn-pool-base-freshen, fm-teardown-endpoint-safety, fm-backend, fm-grok-harness, fm-kimi-harness, fm-muse-harness, fm-backend-autodetect-smoke, fm-secondmate-lifecycle-e2e, fm-live-lab, fm-spawn-dispatch-profile.bin/fm-lint.shandbin/fm-doc-audience-check.shpass.GitHub CI on the final head 36f18f2: all 19 checks pass, including
Behavior portable serial 9andPR must be raised via no-mistakesafter firstmate re-ran those two jobs.Not caused by this branch, measured locally:
tests/fm-remote-secondmate-lifecycle-e2e.test.shexits 1 after 22 passing cases witherror: remote code root did not complete a safe origin update; the same run onorigin/main(e4fe17a) fails the same way.tests/fm-gate-refuse.test.shstops atnot ok - tmux is required for the lab socket behavioral testbecause tmux is not installed on this machine.Follow-ups
bin/fm-promote.shtakes no--done-when, so a promoted scout's ship contract carries no runnable Done when line; its Task section still holds the scout's question. The promotion parity tests now ignore only that line.bin/fm-followups.sh <id> --none.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-teardown.sh:1766- Thefollowups=noneescape beats any recorded titles. teardown_file_follow_ups returns 0 as soon as the meta saysnone, before it reads data/<id>/follow-ups.md. Example: a worker runsfm-followups.sh <id> --none, later finds a gap and writes it to follow-ups.md. Teardown then files nothing and says nothing, so the follow-up is lost. That is the 'wired later' drop this change is meant to stop. A smaller fix: when state isnoneand the record has titles, either file them or refuse with a clear message.🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Test** - 1 issue found → no changes applied ✅
🔧 No changes applied.
✅ Re-checked - no issues remain.
bash tests/fm-brief.test.sh(exit 0, 56 ok, 0 not ok)bash tests/fm-dod-lib.test.sh(exit 0, 20 ok)bash tests/fm-teardown.test.sh(exit 0, 117 ok, 0 not ok)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Built by: claude/opus at high