Skip to content

fix(bin): use gh-axi for the ship DoD draft check - #5519

Merged
kunchenguid merged 2 commits into
kunchenguid:mainfrom
karotkriss:fm/fm-up-5325-dod-raw-gh
Sep 25, 2026
Merged

kunchenguid merged 2 commits into
kunchenguid:mainfrom
karotkriss:fm/fm-up-5325-dod-raw-gh

Conversation

@karotkriss

@karotkriss karotkriss commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Fixes #5325

Ship briefs generated by firstmate tell a worker to confirm a pull request is not a draft with gh pr view <url> --json isDraft, while the same brief's rule 3 and the session-start guidance require gh-axi for every GitHub operation.
Make the generated definition of done use gh-axi for that draft check so raw gh is never the documented path, and keep everything else in the definition of done unchanged.
This closes upstream issue #5325.

What Changed

  • bin/fm-dod-lib.sh now documents the non-draft confirmation in both the direct-PR and no-mistakes definitions of done with gh-axi pr view <number> (expecting draft: no) and gh-axi pr ready <number>, replacing the raw gh pr view <url> --json isDraft path so every GitHub operation in the brief goes through gh-axi.
  • Updated tests/fm-brief.test.sh assertions to match the new gh-axi draft-check and gh-axi pr ready <number> wording.
  • Added test_pr_based_dod_draft_check_uses_gh_axi in tests/fm-dod-lib.test.sh, which asserts the generated DoD for both modes omits gh pr view and reads draft state via gh-axi.

Risk Assessment

✅ Low: A minimal, well-bounded doc-string change that swaps a raw gh draft-check for the correct gh-axi invocation at both DoD sites, verified against the installed gh-axi, with tests exercising the real generator's emitted output.

Testing

Ran both affected shell test suites (all pass), then drove the real DoD generator for the direct-PR and no-mistakes modes and captured the actual worker-facing text: both now instruct gh-axi pr view &lt;number&gt; must print draft: no and gh-axi pr ready &lt;number&gt;, and no raw gh pr view remains. I also confirmed against the live gh-axi tool that gh-axi pr view 5534 really prints draft: no, so the documented instruction is accurate. Evidence is text/CLI transcripts because this change's product surface is generated brief text, not a rendered UI.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Worker generating a direct-PR brief gets a DoD whose draft check uses gh-axi, not raw gh ✅ pass live generated-dod-draft-check.txt: fm_dod_block direct-PR emits gh-axi pr view &lt;number&gt; must print draft: no and gh-axi pr ready &lt;number&gt;
Worker generating a no-mistakes brief gets a DoD whose post-CI draft check uses gh-axi ✅ pass live generated-dod-draft-check.txt tail: fm_dod_block no-mistakes emits the same gh-axi draft check after the CI-green return point
Adversarial: no raw gh pr view survives anywhere in either generated DoD ✅ pass live grep &#39;gh pr view&#39; over both generated DoDs returns no match (exit 1)
The documented gh-axi pr view &lt;number&gt; actually prints draft: no on a real non-draft PR ✅ pass live gh-axi-pr-view-draft-field.txt: gh-axi pr view 5534 prints draft: no
Evidence: Generated worker-facing DoD showing gh-axi draft check (both PR modes)

Source: Generated worker-facing DoD showing gh-axi draft check (both PR modes)

\### Generated worker-facing DoD (mode=direct-PR) ###
# Definition of done
Delivery contract: mode=direct-PR
Ship branch: fm/fm-up-5325
This task ships **direct-PR**: you raise the PR yourself, without the no-mistakes pipeline.
The task is complete only when committed on your branch.
When it is implemented and committed, push your branch and open a PR with `gh-axi` that is ready for review, not a draft.
Before you report done, read the PR back from the forge and confirm it is not a draft (`gh-axi pr view <number>` must print `draft: no`, where <number> is the PR number from your PR URL); if it is a draft, mark it ready with `gh-axi pr ready <number>`.
A draft cannot be merged, so a done report on one leaves the merge unasked.
Then append `done [at=<epoch>]: PR {url}` to the status file and stop.
That `done:` is accepted only when this copy's HEAD - your latest commit - is pushed to your PR branch; the check tests that commit, not merely that a branch moved.
If you deliberately keep the PR a draft, append `paused [at=<epoch>]: {why the draft is held}` instead of done.
Do NOT run /no-mistakes. The configured merge authority decides whether to merge the PR; firstmate relays the outcome.

\### Generated worker-facing DoD (mode=no-mistakes, tail) ###

After /no-mistakes reports CI green (the CI-ready return point - do not wait for it to keep monitoring in the background until merge), read the PR back from the forge and confirm it is not a draft (`gh-axi pr view <number>` must print `draft: no`, where <number> is the PR number from your PR URL); if it is a draft, mark it ready with `gh-axi pr ready <number>`.
A draft cannot be merged, so a done report on one leaves the merge unasked.
Then append `done [at=<epoch>]: PR {url} checks green` and stop. You are finished.
That CI-ready `done:` is accepted only when this copy's HEAD - your latest commit - is one the /no-mistakes run pushed, so commit nothing after the run; the check tests that commit, not merely that a branch moved.
If you deliberately keep the PR a draft, append `paused [at=<epoch>]: {why the draft is held}` instead of done.
Evidence: Live gh-axi pr view prints 'draft: no' (matches documented instruction)

Source: Live gh-axi pr view prints 'draft: no' (matches documented instruction)

# Verifies the DoD's documented command really prints 'draft: no' on a non-draft PR
$ gh-axi pr view 5534
  number: 5534
  title: "fix: refuse merges with unreported required checks"
  state: open
  draft: no

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-dod-lib.sh:369 - The new draft-check command handed to the worker, gh-axi pr view &lt;url&gt;, is not a valid invocation: gh-axi pr view requires a PR number, not a URL. Verified against the installed gh-axi: gh-axi pr view https://github.com/kunchenguid/firstmate/pull/5515 fails with error: Missing PR number (code VALIDATION_ERROR), whereas gh-axi pr view 5515 prints draft: no correctly. The old raw gh pr view &lt;url&gt; accepted a URL, so substituting the same &lt;url&gt; placeholder into gh-axi silently breaks the documented command - defeating the intent of giving the worker a correct gh-axi draft check. Same defect at the no-mistakes site bin/fm-dod-lib.sh:404 (identical gh-axi pr view &lt;url&gt; string). Remedy corrects what the change already does: document gh-axi pr view &lt;number&gt; (the trailing /pull/N number from the PR URL; gh-axi auto-resolves the repo from the worker's checkout, or pass --repo &lt;owner&gt;/&lt;repo&gt;), which still prints draft: no. The two grep tests that enshrine the broken string must move with it: tests/fm-brief.test.sh:343 and tests/fm-dod-lib.test.sh:315 (and the accompanying assert_no_grep 'gh pr view' at tests/fm-dod-lib.test.sh:313 remains valid).

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
A worker generating a direct-PR ship brief is told to check draft state with gh-axi, not raw gh ✅ pass live bash bin/fm-brief.sh issue-5325 firstmate --mode direct-PR -> scaffolded-brief-direct-PR.md: line documents gh-axi pr view &lt;number&gt; must print draft: no and gh-axi pr ready &lt;number&gt;; `grep -c…
A worker generating a no-mistakes ship brief gets the same gh-axi draft check ✅ pass live bash bin/fm-brief.sh issue-5325-nm firstmate --mode no-mistakes -> scaffolded-brief-no-mistakes.md line 114 uses the gh-axi path; grep -c &#39;gh pr view&#39; = 0
The documented gh-axi command actually reports draft state against the real forge (accurate, executable instruction) ✅ pass live Live gh-axi pr view 5517 prints draft: no for a ready PR; gh-axi pr view 5425 prints draft: yes for a draft PR - matches the brief's expected output and distinguishes drafts
Adversarial: no raw gh GitHub operation survives anywhere in the generated brief (rule-3 compliance) ✅ pass live grep over the fully scaffolded brief finds 0 gh pr view and no bare gh pr|api|issue invocation (only gh-axi)
Regression suite for the DoD/brief generators still passes with the new gh-axi assertion ✅ pass live bash tests/fm-dod-lib.test.sh and bash tests/fm-brief.test.sh both report all tests passed, including test_pr_based_dod_draft_check_uses_gh_axi
  • bash tests/fm-dod-lib.test.sh (incl. new test_pr_based_dod_draft_check_uses_gh_axi)
  • bash tests/fm-brief.test.sh (incl. test_pr_based_dod_requires_non_draft)
  • bash bin/fm-brief.sh issue-5325 firstmate --mode direct-PR then inspected scaffolded data/issue-5325/brief.md
  • bash bin/fm-brief.sh issue-5325-nm firstmate --mode no-mistakes then inspected scaffolded brief.md
  • source bin/fm-dod-lib.sh; fm_dod_block direct-PR|no-mistakes ...
  • gh-axi pr view 5517 (ready PR) and gh-axi pr view 5425 (draft PR) against the live forge

✅ No issues found.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Worker generating a direct-PR brief gets a DoD whose draft check uses gh-axi, not raw gh ✅ pass live generated-dod-draft-check.txt: fm_dod_block direct-PR emits gh-axi pr view &lt;number&gt; must print draft: no and gh-axi pr ready &lt;number&gt;
Worker generating a no-mistakes brief gets a DoD whose post-CI draft check uses gh-axi ✅ pass live generated-dod-draft-check.txt tail: fm_dod_block no-mistakes emits the same gh-axi draft check after the CI-green return point
Adversarial: no raw gh pr view survives anywhere in either generated DoD ✅ pass live grep &#39;gh pr view&#39; over both generated DoDs returns no match (exit 1)
The documented gh-axi pr view &lt;number&gt; actually prints draft: no on a real non-draft PR ✅ pass live gh-axi-pr-view-draft-field.txt: gh-axi pr view 5534 prints draft: no
  • bash tests/fm-dod-lib.test.sh (includes new test_pr_based_dod_draft_check_uses_gh_axi)
  • bash tests/fm-brief.test.sh
  • source bin/fm-dod-lib.sh &amp;&amp; fm_dod_block direct-PR fm-up-5325 and fm_dod_block no-mistakes fm-up-5325 - drove the real generator and captured worker-facing DoD text
  • Grepped both generated DoDs: grep &#39;gh pr view&#39; returns no match; grep &#39;gh-axi pr view &lt;number&gt;&#39; present in both modes
  • gh-axi pr view 5534 - confirmed the live tool prints draft: no for a non-draft PR
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

@karotkriss
karotkriss force-pushed the fm/fm-up-5325-dod-raw-gh branch from 1a5cba1 to b7a68fe Compare September 24, 2026 14:54
@karotkriss karotkriss changed the title fix(bin): use gh-axi for the ship brief draft check fix(bin): use gh-axi for the ship DoD draft check Sep 24, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: whole thread read (body; linked #5325 + prior stamps). Diff + green CI reviewed against main tip (pre-merge hole still present in fm-dod-lib.sh).

Verdict: merge · contract-class: restore · Firstmate flag: no · closes #5325: yes

Tip check: both direct-PR and no-mistakes DoD blocks still instruct raw gh pr view <url> --json isDraft while brief rule 3 / AGENTS prefer gh-axi. Diff switches both sites to gh-axi pr view <number> expecting draft: no, plus gh-axi pr ready <number>. Tests updated; new regression asserts no raw gh pr view remains.

VISION.md per-rule:

  • One captain / peace of mind: aligns — worker contract matches axi preference already stated.
  • Authority / Scripts / Fleet: aligns — generated brief text only; axi over raw CLI.
  • Scope: aligns — DoD owner string, not forge policy.

CI CLEAN. Squash-merging.

@kunchenguid
kunchenguid merged commit c4c9d63 into kunchenguid:main Sep 25, 2026
20 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @karotkriss — really appreciate you taking the time on this.

mehulbhagwani pushed a commit to mehulbhagwani/firstmate that referenced this pull request Sep 26, 2026
* fix(bin): use gh-axi for the ship DoD draft check

* no-mistakes(review): use PR number not URL in gh-axi draft check
mehulbhagwani pushed a commit to mehulbhagwani/firstmate that referenced this pull request Sep 26, 2026
* fix(bin): use gh-axi for the ship DoD draft check

* no-mistakes(review): use PR number not URL in gh-axi draft check
ppetermann added a commit to ppetermann/firstmate that referenced this pull request Sep 26, 2026
…om the take-in

This reverts b52d401 (fix: limit project memory edits to factual corrections,
kunchenguid#5636) and c4c9d63 (fix(bin): use gh-axi for the ship DoD draft check, kunchenguid#5519)
on top of upstream 920a7d9, so the P3 take-in merge brings in the rest of
upstream d4f3b78..920a7d9 without them.

- b52d401: skipped on the captain's word (take-in question 4); this fleet
  keeps its AGENTS.md section 6 routing, where a worker may create or update
  a project's AGENTS.md through fm-ensure-agents-md.sh.
- c4c9d63: rewords the non-draft done check this fleet does not carry; the
  direct-PR worker here opens a draft and firstmate owns the flip.
ashkonmousavi added a commit to ashkonmousavi/firstmate that referenced this pull request Sep 26, 2026