fix(bin): chain teardown and backlog completion after a PR merge - #2854
Open
pramendra wants to merge 3 commits into
Open
fix(bin): chain teardown and backlog completion after a PR merge#2854pramendra wants to merge 3 commits into
pramendra wants to merge 3 commits into
Conversation
added 2 commits
August 23, 2026 18:39
fm-pr-merge.sh required three separately-remembered commands to fully close out a task; the last two were dropped twice in one session while the merges themselves were real and green. A successful merge now automatically runs fm-teardown.sh and tasks-axi done, surfacing any teardown refusal instead of swallowing it, with --no-teardown for callers that need the old merge-only behavior.
…n chaining; no stale facts found
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the position-independent opt-out parser now covers the previously reported ordering case, and unavailable non-manual tasks-axi backends now fail visibly after teardown. Reviews (2): Last reviewed commit: "no-mistakes: apply CI fixes" | Re-trigger Greptile |
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
bin/fm-pr-merge.sh should automatically tear down and record done after a successful merge, instead of leaving that to three separately-remembered manual steps (fm-pr-merge.sh, fm-teardown.sh, tasks-axi done). Under load, firstmate dropped the last two steps twice in one session even though the merges were real and green, leaving the worktree leased and the backlog showing the task as in-flight until a manual sweep caught it. This is a process gap (a sequence someone has to remember), not a data-format problem.
Acceptance criteria:
Do not build a bigger control plane, sync layer, or new state-tracking mechanism. The fix is mechanical: chain three already-correct, already-tested operations so a human or firstmate cannot forget the last two.
This is firstmate's own shared tracked material (bin/), so firstmate-coding-guidelines' style rules apply (one sentence per line in prose/comments, plain dash, no agent co-author, shellcheck-clean).
The PR body must state plainly: what the three-step sequence used to require, exactly what is now automatic, and the one thing that still correctly stops automation (teardown's unlanded-work refusal) and why that refusal must never be bypassed.
What Changed
bin/fm-pr-merge.shnow chainsbin/fm-teardown.sh <task-id>and thentasks-axi done <task-id> --pr <url>automatically after a successful merge, so one command produces all three effects instead of three separately-remembered steps. Previously it stopped after recording PR metadata and merging.--no-teardownflag (accepted anywhere before the optional--separator) that preserves the old merge-only behavior for callers with their own reason to defer cleanup; existing callers that don't pass it now get the automatic chain.tasks-axi doneever runs — the merge landing does not bypass or silence that refusal.tasks-axi doneitself only runs when a compatible backend is available (viafm-tasks-axi-lib.sh's existing availability check); on a manual backend the operator still gets teardown's own printed reminder, unchanged.AGENTS.md,docs/architecture.md, anddocs/scripts.mdto describe the new atomic teardown-and-completion behavior, and updatedtests/fm-pr-check-security.test.shandtests/fm-pr-merge.test.shto cover the new chaining (including--no-teardownopt-out) and to keep unrelated merge/URL-derivation tests isolated from it.Note: this branch also includes unrelated
.serena/.gitignoreand.serena/project.ymladditions (editor tooling config), which are not part of this behavioral change.Risk Assessment
✅ Low: The change is a well-bounded, additive chain (merge → teardown → tasks-axi done) with a correct opt-out flag, proper non-masking propagation of teardown's refusal exit code, reuse of an existing availability gate to avoid double-invoking tasks-axi, and thorough new tests (success, refusal-surfaces, opt-out) plus updated header/doc comments consistent with every acceptance criterion.
Testing
test
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.
test✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.