Skip to content

review: mark a blocking verdict on the PR, not only in firstmate's chat - #46

Merged
webjema merged 3 commits into
mainfrom
fm/review-block-signal-r7
Jul 30, 2026
Merged

webjema merged 3 commits into
mainfrom
fm/review-block-signal-r7

Conversation

@ignovak

@ignovak ignovak commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

The incident

On 2026-07-30, PR #44 in this repo merged carrying seven confirmed defects, while its crew was actively fixing them.

An independent review had found all seven, and firstmate had told the user not to merge. The verdict existed only in that firstmate session's chat, so the person clicking merge acted without it. One of the seven bricks a worktree pool slot on every warm - on Linux as well as macOS, so not a platform edge case.

The review was neither late nor wrong. What failed is that a review verdict living only in chat does not reach the person who merges - including a collaborator who never sees that session at all. Firstmate's normal review sits before the PR exists, which keeps this rare, but once a PR is open the chat is no longer where the merge decision happens.

That is what makes this a rule rather than a habit, and it is why firstmate is now allowed to draft a PR it authored.

The change

AGENTS.md section 6, step 3 gains four lines: when firstmate's review of an already-open PR finds a merge-stopping defect, the verdict is marked on the PR, and cleared when the defect is fixed. Two mechanisms, and the distinction is the substance:

  • firstmate-authored PRs - gh pr ready --undo converts the PR to draft, which mechanically blocks merging ("No one can merge the pull request until you mark the pull request as ready for review again"), plus a PR comment carrying the verdict so the reason travels with the PR. gh pr ready restores it once the fix lands.
  • Bot-authored PRs (Dependabot and similar) - never drafted, because a bot acts on its own PR's state. Comment plus a do-not-merge label instead.

A title prefix or a comment on its own is advisory - it informs a reader who looks, and leaves the merge button live for one who does not. That is exactly what already failed, so the blocking mechanism is preferred wherever the goal is to prevent a merge.

docs/pr-block-signal.md owns the commands, the per-repo label setup, and the verification record, behind a one-line pointer. AGENTS.md is injected into every session and every brief, so the four lines carry the rule and nothing else.

What this does NOT change

Merge authority is untouched. Firstmate still never merges without the user's explicit word; the pre-PR review gate, the review sequence, and bin/fm-pr-check.sh / bin/fm-pr-merge.sh are all unchanged. This change only makes a blocking verdict visible where the decision actually happens. The one interaction worth naming: a drafted PR also makes bin/fm-pr-merge.sh fail closed, because GitHub refuses to merge a draft. That is defense in depth - mark the PR ready first, then merge on the user's word.

These are GitHub mutations, so they run on plain gh, per section 6's existing read/mutate split.

Verifications

Written only after checking, because a wrong instruction in AGENTS.md is worse than none - every future firstmate follows it. Full record with commands and output in docs/pr-block-signal.md.

1. gh pr ready --undo is plan-dependent - what happens when it is not supported?

gh's own help says "If supported by your plan". This repo is public, convertPullRequestToDraft is present in the GraphQL schema, the token has push, and GitHub's current stage-change documentation states no plan or visibility restriction on drafts at all - so the caveat reads as conservative rather than a live constraint here.

More importantly, the failure is loud, verified: gh pr ready --undo 99999 prints a GraphQL error and exits 1. It cannot silently do nothing. The instruction therefore keys its fallback to the comment-plus-label path on the non-zero exit, not on an assumption about the plan, which makes it correct on either plan instead of correct-on-mine.

Not exercised live: the draft conversion itself. That needs an open PR, and a crewmate may not open one before firstmate approves its branch. The doc records the gap and the two commands that close it on any open firstmate PR.

2. Does drafting suppress this repo's PR CI? No - and this was the check with the power to kill the design.

If drafting stopped CI, the fix loop would lose its gate and this change would do net harm. Our .github/workflows/ci.yml triggers on a bare pull_request: with no types: filter and no draft conditional - but GitHub's event reference is silent on draft behavior, so grepping our own workflow is only half an answer.

The other half, on a live draft PR in a public repo with the same trigger shape: cli/cli's go.yml uses a bare pull_request: trigger, and draft PR cli/cli#14013 (isDraft: true) carries 15 completed check runs, build (ubuntu-latest) among them. So Lint shell scripts, Behavior tests, and Repo invariants all keep running on every fix push while a PR sits drafted.

One nuance: converted_to_draft and ready_for_review are not default activity types, so neither drafting nor un-drafting spawns a run by itself. CI runs on the fix push, which is when the gate matters.

3. Does a do-not-merge label exist? No - it must be created.

gh label list returns only the nine stock labels. An instruction that silently assumed the label would have failed on first use, in the exact moment someone is trying to stop a bad merge. It is created once per repo, on first use:

gh label create do-not-merge --color B60205 --description "Blocking review defect - do not merge" --force

--force updates an existing label instead of failing, so the command is safe to re-run. Not pre-created in this repo - that is a mutation to make at first use.

4. Does the bot-versus-firstmate discriminator hold on real data? Yes: #44 -> is_bot=false -> draft+comment; home-assistant/core#177523 (app/dependabot) -> is_bot=true -> comment+label. Authorship and draft state are already visible in the gh-axi pr view firstmate reads.

Shape

No new bin/ script. This is two gh invocations plus a judgment about PR authorship; a helper would add a contract to maintain for logic that fits in prose, and the fallback is a single exit-status check.

tests/fm-pr-block-signal.test.sh follows the prose-contract pattern of tests/fm-stow-contract.test.sh, and adds a guard that ci.yml never gains a pull_request.draft conditional or a ready_for_review types filter - either would silently invalidate the rule this PR adds.

Test run

bin/fm-lint.sh clean. Full suite run once: 119 ok, 7 not, none caused by this diff - no failing test reads any file it touches (grep-verified), and the diff is Markdown plus one new test file.

This machine has no coreutils timeout, which bin/fm-test.sh requires, so the suite ran under a scratch GNU-semantics shim. fm-wake-queue, fm-watch-checkpoint, fm-watcher-lock and fm-pool-warm all pass standalone (shim/runner artifacts; fm-pool-warm just exceeds the runner's 300s cap on this box). fm-graph and fm-fleet-sync fail on an absent codebase-memory CLI, taking fm-graph-reindex.sh's documented skip path.

Separately surfaced, not fixed here: bin/fm-mission.sh set-criteria is broken on macOS - BSD awk rejects the multiline body (awk: newline in string) and it errors with failed to rewrite .../missions/<id>.md. Ubuntu CI does not catch it.

ignovak added 3 commits July 30, 2026 16:07
PR #44 merged carrying seven confirmed defects while its crew was still
fixing them. The review had found all seven and firstmate had said not to
merge, but that verdict existed only in the firstmate session's chat, so
whoever clicked merge never saw it.

AGENTS.md section 6 step 3 now requires the verdict to land on the PR when
one is already open: draft a firstmate-authored PR with `gh pr ready --undo`,
which blocks the merge button mechanically instead of merely advising, plus a
comment carrying the reason; never draft a bot's PR, where a comment and a
`do-not-merge` label are used instead. docs/pr-block-signal.md owns the
commands, the per-repo label setup, and the verification record - including
the check that drafting does NOT suppress this repo's PR CI, which is what
makes the draft path safe for the fix loop.
…evidence

The event reference does not document whether workflows run on draft PRs, so
the claim now rests on a live draft PR in a public repo whose workflow has the
same bare `pull_request:` trigger shape as ours (cli/cli#14013, 15 completed
check runs while isDraft). Also records that GitHub's current stage-change docs
carry no plan or visibility restriction on drafts at all, which makes gh's
"If supported by your plan" caveat conservative rather than a live constraint.
…check

Verified on live PRs of both kinds that .author.is_bot separates the two
mechanisms, and stated the two commands that close the one gap left in the
record - the live draft conversion - on any open firstmate PR.
@webjema
webjema merged commit 4ccf0ef into main Jul 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants