Repository navigation
fix: surface green no-mistakes PRs awaiting merge - #5327
Merged
Merged
Conversation
A green PR could sit unreported because neither the worker nor the supervisor could observe checks-green while the ci step kept monitoring for the merge. Supervisor read: fm_nm_select_run's capped-overview inventory reader looked the repository up by the task worktree path, but no-mistakes registers a repository once by its main clone path and resolves every linked worktree to it, so on every task copy of a busy repo the lookup matched no row and each read reported "complete same-branch run inventory unreadable". Key the lookup on the overview's own top-level `repo:` line, which every axi release emits as the resolved working_path. Even with a readable run, the ci-log classifier treated "base branch advanced ..., re-arming CI monitor timeout" as not-ready. The monitor logs a checks state only when it changes and a base advance does not clear readiness, so a green PR read as still validating for as long as main kept advancing. Stop treating that line as a marker, matching no-mistakes' own ci-log parser, and name the run's PR URL in the held-for-merge reading so the existing inactive-outcome path can act on it without a worker report. Worker contract: `axi status` never reports checks-passed while the ci step monitors for merge, so the definition of done no longer makes a status poll the wait for the next gate or outcome; the drive call's own return is the green signal, reattached with `no-mistakes axi run` after a bounded return.
BohnBawerick
added a commit
to BohnBawerick/firstmate
that referenced
this pull request
Sep 23, 2026
Intent
A green no-mistakes ship PR can sit fully green with nobody told, so the captain is never asked to merge it. On task fm-afk-landed-teardown-gap-r1 (firstmate repo, no-mistakes v1.79.0, run 01M351FDMW4618QZPN0N9NYHYV, PR #5317), all pipeline steps completed through pr and every GitHub check went green, yet the PR sat green about fifty minutes with no report to the captain. Two independent failures combined:
The worker never appended its green-PR done line. The no-mistakes ci step stays status=running while it monitors the merge and re-arms its own timeout each time the base branch advances, so it never transitions to a terminal state or the next gate even after every check is green. The worker's background wait for the run to reach "the next gate or outcome" therefore never fires, so the worker never learns checks went green and never reports, despite its instructions to report when CI first goes green.
The supervisor-side fallback also could not see it. bin/fm-crew-state.sh returned "state: unknown - source: run-step - complete same-branch run inventory unreadable" for both of that day's no-mistakes ships on every read, so heartbeat review never observed checks-green and the idle worker was never flagged as waiting for a merge.
The required outcome: a green no-mistakes PR always reaches the captain for merge, without depending on the worker remembering to append a report line. Both the worker-side green detection and the supervisor-side crew-state read must be able to observe a checks-green PR that is still in ci merge-monitoring.
What Changed
checks-passedresult instead of waiting for status polling to expose a green PR.Risk Assessment
✅ Low: The change is well-bounded, addresses both worker and supervisor observability paths, and includes behavior-focused regression coverage for linked worktrees, re-arm lines, and log-tail eviction.
Testing
The generated worker brief established the live scaffolding scenario. The targeted scripts and isolated reproductions produced supporting non-live observations for supervisor and CI-state behavior, but the historical production run was unavailable from this repository context, so those scenarios could not be validated against the live product.
Evidence: Green PR supervisor transcript
Source: Green PR supervisor transcript
Evidence: Generated no-mistakes worker brief
Source: Generated no-mistakes worker brief
Evidence: Adversarial CI-state boundary transcript
Source: Adversarial CI-state boundary transcript
Evidence: Targeted brief tests
Source: Targeted brief tests
Evidence: Targeted crew-state tests
Source: Targeted crew-state tests
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (2) ✅
bin/fm-crew-state.sh:801- The required guarantee that a green monitoring PR is always observable remains breakable becauseaxi logsis still called without--full, so it returns only a tail. Concrete sequence: checks become green once, then enough base-advance/re-arm lines accumulate to evict that sole green marker; because re-arm lines are now intentionally ignored,markeris empty,nm_ci_checks_statereturnsunknown, and the active path at bin/fm-crew-state.sh:1068 continues reportingworking. The same truncated helper also affects terminal held-green reclassification at bin/fm-crew-state.sh:692. This contradicts the required outcome that the supervisor read “must be able to observe a checks-green PR that is still in ci merge-monitoring.” Scan the complete CI log (the CLI exposes--full) or otherwise preserve the latest recognized checks state. Because this is an explicit intent-conformance gap, the remedy needs user approval.🔧 Fix applied.
2 issues (1 error, 1 info) still open:
bin/fm-crew-state.sh:801- The required guarantee that a green monitoring PR is always observable remains breakable becauseaxi logsis still called without--full, so it returns only a tail. Concrete sequence: checks become green once, then enough base-advance/re-arm lines accumulate to evict that sole green marker; because re-arm lines are now intentionally ignored,markeris empty,nm_ci_checks_statereturnsunknown, and the active path at bin/fm-crew-state.sh:1068 continues reportingworking. The same truncated helper also affects terminal held-green reclassification at bin/fm-crew-state.sh:692. This contradicts the required outcome that the supervisor read “must be able to observe a checks-green PR that is still in ci merge-monitoring.” Scan the complete CI log (the CLI exposes--full) or otherwise preserve the latest recognized checks state. Because this is an explicit intent-conformance gap, the remedy needs user approval.bin/fm-crew-state.sh:103- Round 1 correctly switched checks-state detection to the full CI log, but documentation still describes a tail-only scan. Update this reference and the sibling descriptions at docs/architecture.md:118 and tests/fm-crew-state.test.sh:1269 so the documented invariant matches the durable fix.🔧 Fix applied.
✅ Re-checked - no issues remain.
tests/fm-brief.test.shtests/fm-crew-state.test.shGenerated a real no-mistakes ship brief withFM_HOME=<isolated-home> bin/fm-brief.sh green-pr-demo firstmate --mode no-mistakesRanbin/fm-crew-state.sh green-pragainst an isolated linked-worktree, capped-inventory reproduction with a green marker followed by 60 timeout re-arm linesRanbin/fm-crew-state.sh ci-boundaryfor checks-not-registered and green-then-new-issue adversarial statesAttemptedno-mistakes axi status/logs --run 01M351FDMW4618QZPN0N9NYHYV; the historical run was unavailable in this worktree's repo-scoped no-mistakes context✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.