Repository navigation
fix(classify): refuse to close a task on an unbacked done: - #1802
Closed
Nikita-Guzenko wants to merge 6 commits into
Closed
Nikita-Guzenko wants to merge 6 commits into
Nikita-Guzenko wants to merge 6 commits into
Conversation
Six sessions closed a task on a `done:` line that had no PR behind it:
hero-studio-restore, ci-merge-group-trigger and a third on 2026-07-31,
then call-sales-script, tg-pricelist-capture and call-sales-script again
on 2026-08-06. Each time firstmate read the line, closed the task, and
reported it to the captain. The costliest left branch
fm/call-sales-prepayment unpushed to origin - the change existed only in
the worker's worktree, and was found by a chance check.
Wording was never the missing piece. bin/fm-brief.sh already stated the
correct order before all six, and the no-mistakes brief hands the worker
the same word `done` for its INTERMEDIATE implementation-committed report
as for the final shipped one. From the line alone no reader can tell
"landed" from "committed locally", so a reminder cannot separate them and
six repetitions proved it.
So this adds a machine test instead. bin/fm-classify-lib.sh gains one
condition - a `done:` in a PR-delivering mode (state/<id>.meta mode=)
that carries no https://.../pull/<N> or .../merge_requests/<N> URL is not
a completion - plus the single refusal text every surface reuses:
- bin/fm-crew-state.sh, the authoritative current-state reader, reports
`blocked` with the refusal instead of `done`, so nothing derived from
it (fleet snapshot, bearings, heartbeat review) can read completion.
- bin/fm-wake-drain.sh prints a REJECTED DONE section on every drain,
including the empty-queue path session start relies on, naming the
task and carrying the ready-to-send steer - so the crew is corrected
within one wake, and the rejection keeps re-surfacing until the PR
actually exists rather than being seen once and forgotten.
- scan_captain_relevant_statuses still SURFACES the line (it is work
firstmate must act on) but renders it with the refusal attached, so
no supervision surface presents it as a clean completion.
Modes differ by design and are respected: `local-only` lands on a branch
and has no PR, scouts deliver a report, and a charter has no delivery
contract - none is constrained. An unrecognized or missing mode is
deliberately left alone too, because a false refusal on a scout report
would be worse than the failure this closes.
Nothing else changed: no verb was added or removed, the absorb rules are
untouched, and paused/blocked/needs-decision behave exactly as before.
Tests: tests/fm-done-requires-pr.test.sh covers the predicate over every
mode and near-miss claim (bare "kunchenguid#123", branch name, "PR to follow"), the
captain-relevant rendering, and the drain section including that it
persists across drains and clears once the PR is reported.
tests/fm-crew-state.test.sh gains the reader half. Both were confirmed
RED against the pre-change scripts: an unbacked done: reported
`state: done`.
The supervision surfaces now refuse to render an unbacked `done:` as a completion, but teardown is the step that actually closes the task, so the same rule belongs at the irreversible end too. Without it a branch that was merely pushed - no PR ever opened, nothing merged - still passes the landed-work check (its commits are reachable from a remote) and the task closes on a claim nobody can verify. The gate refuses only when all three hold: the task is kind=ship, its last status line is a `done:` in a PR-delivering mode with no PR URL, and no `pr=` was recorded for it by bin/fm-pr-check.sh. A recorded PR is equally good proof, so a genuinely shipped task is never refused, and local-only, scouts, and secondmates are outside the rule by construction. `--force` bypasses it exactly like the other teardown gates and still requires explicit discard authority. fm-classify-lib.sh remains the one owner of the test and the refusal text; this adds no second definition.
The terminal-child-state case wrote `done: complete` for a fixture whose meta says mode=no-mistakes. Under the new rule that line is not a completion at all, so the child rendered `blocked` and the case stopped exercising what it asserts. The fixture now reports a real shipped completion with its PR URL. Caught by comparing against a clean clone of the pre-change tree: this file passed there and failed here, unlike the tasks-axi-version failures on this box, which fail identically on both.
bin/fm-teardown.sh now sources bin/fm-classify-lib.sh for the done-requires-a-PR gate. Both fake roots in this suite link every sibling teardown needs, so they need this one too; without it teardown could not source it and exited non-zero, which the fixtures read as a tasktmp cleanup failure.
The crew that implemented this refusal finished the work and reported `done:` on its own commit, with no PR and nothing pushed, on the same day it had read all six earlier cases and written the refusal text itself. That is the strongest evidence in the whole set, so it belongs next to the rule rather than in a chat log. It rules out the two explanations that would have kept this a wording problem: not knowing the rule, and not having thought about it recently. Neither applied. The word `done` attaches to whatever the worker just finished, and no amount of having just written the opposite prevents it - which is exactly why the check has to be mechanical and enforced at every surface that can close a task.
Owner
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#1802 at |
This was referenced Aug 11, 2026
Owner
|
Speaking as Kun's firstmate: closing this as stale. It has been waiting on a contributor update for 14+ days with no author push or comment. Reopen if you want to pick it back up. |
Verification (author run, before pipeline)
|
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 it MECHANICALLY IMPOSSIBLE for a crewmate to close a task with a bare
done:on a local commit that has no PR behind it. Seven sessions had already failed that way: hero-studio-restore, ci-merge-group-trigger and a third on 2026-07-31, then call-sales-script, tg-pricelist-capture and call-sales-script again on 2026-08-06, and finally the crew that implemented this very rule, which reporteddone:on its own unpushed commit hours after writing the refusal. Each time firstmate read the line, closed the task, and told the owner it had shipped; the costliest left branch fm/call-sales-prepayment never pushed to origin at all.The user explicitly ruled out a wording fix. bin/fm-brief.sh already stated the correct order in prose before every one of those cases, and the no-mistakes brief hands the worker the SAME word
donefor its intermediate "implemented and committed" gate as for the final shipped one, so no reader can tell the two apart from the line alone. The seventh case proves memory cannot carry it: the rules author broke the rule the same day. The user named bin/fm-classify-lib.sh as the anchor point, required exactly one added condition rather than a rewrite of event classification, and set three acceptance conditions: (1) a fake done must not close the task, (2) the worker must learn immediately rather than be silently reclassified, (3) delivery modes must differ because local-only has no PR by design. They also forbade bloating AGENTS.md beyond a one-line pointer and forbade touching paused/blocked/needs-decision.Design decisions I made and why, so they do not read as mistakes in the diff:
blockedinstead ofdoneso everything derived from it (fleet snapshot, bearings) is covered; fm-wake-drain.sh prints a REJECTED DONE section on EVERY drain including the empty-queue path, carrying a ready-to-send steer so the worker is corrected within one wake and the rejection cannot be seen once and forgotten; scan_captain_relevant_statuses still surfaces the line but renders the refusal with it.Evidence: both new test files were confirmed RED against the pre-change scripts (an unbacked done: reported state: done) and are green now. bin/fm-lint.sh exits 0, --check-coverage is ok at 124 scripts, and the doc audience check passes. The full behavior suite was run twice; every remaining failure was compared against a clean clone of the pre-change tree and traced to this box (tasks-axi 0.2.3 vs the 0.2.4 floor, and a tangle banner that fires for any checkout on a feature branch), not to this change. Two regressions this change did cause were found that way and fixed in their own commits: the fm-bearings-snapshot fixture used an unbacked
done: completefor a mode=no-mistakes child, and tests/fm-gotmp.test.sh did not link fm-classify-lib.sh into its fake teardown roots.What Changed
status_done_is_unbackedcondition (plus its refusal text) tobin/fm-classify-lib.sh, scoped by the task's recorded delivery mode fromstate/<id>.meta:no-mistakesanddirect-PRrequire a realpull/<N>/merge_requests/<N>URL, whilelocal-only,scout,secondmateand unknown modes are deliberately not constrained; theno-mistakesrefusal names a different next action (/no-mistakes) thandirect-PR(push and open the PR).fm-crew-state.shnow reportsblockedinstead ofstate: donefor an unbacked done (covering fleet snapshot and bearings),fm-wake-drain.shemits aREJECTED DONEsection with a ready-to-send steer on every drain including the empty-queue path, andfm-teardown.shrefuses to tear down akind=shiptask whose last line is an unbacked done with no recordedpr=(genuinely landed work still tears down;--forcestill bypasses).tests/fm-done-requires-pr.test.shandtests/fm-crew-state.test.sh, fixed two regressions this change caused (thefm-bearings-snapshotterminal-child fixture and linkingfm-classify-lib.shintofm-gotmpfake teardown roots), and updatedAGENTS.md/docs with a one-line pointer.Risk Assessment
✅ Low: Additive, well-bounded change adding a single classifier condition wired into four consumers exactly as the intent specifies, with verified sourcing, no reachable false-refusal path, stable dedup signatures, and RED→GREEN tests; no source-verifiable defects found.
Testing
Exercised the classifier, drain, crew-state reader and teardown paths that implement the rule. The decisive product-level evidence is a CLI transcript driving the real bin/fm-classify-lib.sh: a fake
done:on the never-pushed fm/call-sales-prepayment branch is refused under mode=no-mistakes ("instruct the crew to run /no-mistakes") and mode=direct-PR ("steer the crew to push and open the PR"), and accepted only for local-only/scout/unrecorded modes and for a done: line carrying a real pull/1800 URL — satisfying all three author acceptance conditions (fake done doesn't close, worker learns immediately, delivery modes differ). The teardown test confirms the same refusal at the point that actually closes a task. No UI surface is involved (shell classifier/CLI change), so evidence is CLI transcripts and test output rather than screenshots. All targeted tests pass; the full suite was intentionally not run per the targeted-validation boundary.Evidence: Classifier e2e: fake done: refused across delivery modes, PR-backed done: accepted
### Fake done: on unpushed local commit (target commit) mode=no-mistakes -> REJECTED: not a completion - ... instruct the crew to run /no-mistakes and expect "done: PR <url> checks green". mode=direct-PR -> REJECTED: not a completion - mode=direct-PR delivers through a PR and this line carries none ... steer the crew to push and open the PR. mode=local-only -> ACCEPTED (closes task) mode=scout -> ACCEPTED (closes task) mode= -> ACCEPTED (closes task) ### done: carrying the PR URL is NOT refused mode=no-mistakes -> ACCEPTED mode=direct-PR -> ACCEPTED/tmp/no-mistakes-evidence/01KZBAND6Y2PQBR0ZVBZF24XQK/fm-done-requires-pr.log)Evidence: fm-teardown test log (ship-refuse path)
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.
bash tests/fm-done-requires-pr.test.sh— all pass (predicate across all modes, drain REJECTED DONE section, re-surface-until-PR)bash tests/fm-crew-state.test.sh— all pass (unbacked done reported as blocked, never state: done)bash tests/fm-teardown.test.sh— all pass (ship task with unbacked done + no PR is refused; genuinely landed work still tears down)bash tests/fm-bearings-snapshot.test.sh— all pass (terminal-child fixture regression fix)bash tests/fm-gotmp.test.sh— all pass (classify lib linked into fake teardown roots)Manual e2e probe sourcing bin/fm-classify-lib.sh: ran status_done_is_unbacked + fm_unbacked_done_reason over the full delivery-mode matrix for a fake unpusheddone:and a PR-backeddone:; confirmed baseline commit 2cf0283 has no predicate (a done: line was a clean completion)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.