Skip to content

fix(bin): fit pull observation within the contribution poll budget - #5107

Merged
kunchenguid merged 2 commits into
kunchenguid:mainfrom
sdivanl:fm/fm-contrib-poll-budget
Sep 21, 2026
Merged

kunchenguid merged 2 commits into
kunchenguid:mainfrom
sdivanl:fm/fm-contrib-poll-budget

Conversation

@sdivanl

@sdivanl sdivanl commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Intent

The contributions poll cannot complete a pull-request observation when forge reads are slow, so monitoring of the tracked upstream pull requests silently stops doing its job. Measured in this home on 2026-09-21: a single authenticated forge read took 1.4 to 5.0 seconds while an unauthenticated read of the same host took 1.7 seconds, so the latency is the path to the forge rather than the client. One pull-request observation performs about eight sequential reads (pull core, issue comments, reviews, inline comments, check runs, commit statuses, repository, and a closing head and review-decision read), which needs roughly 20 to 28 seconds at that latency, while the poll's forge-read budget defaults to 20 seconds, is capped at 25, and caps each read at 5 seconds. The poll therefore abandons an observation mid-sequence and records "forge observation unavailable or changed during read", then repeats its once-per-episode check wake on every flap; issues, which need about three reads, still complete. Nothing is unsafe today: the failure is recorded, the wake fires once per failure episode, and merge detection for those tasks runs through the separate validated pull-request poll. But the contribution signals this lane exists for - comments, reviews and ready-for-review - are effectively unobserved while the forge is slow. Make one observation fit the budget again.

What Changed

  • Parallelize the independent forge reads in a contribution observation: pull requests run comments, reviews, inline comments, check runs, statuses, and repository in one wave after the core read, and issues run comments and events together.
  • Reserve up to 15 seconds before starting each URL so every normal-budget observation gets its three dependent waves, deferring later URLs to the next oldest-first poll instead of abandoning an in-progress read.
  • Track budget exhaustion separately from a genuine forge failure via budget-exhausted/forge-unavailable markers, and add regression tests for the reservation, 3-second reads completing fresh, and outage wake-once behavior.

Risk Assessment

✅ Low: The change is a bounded parallelism/refactor of an existing poll with equivalent error classification, no auth or data-disclosure surface, and the previously weak regression test now fails pre-fix and passes post-fix.

Testing

Ran the full targeted fm-contributions test module on the fixed commit (all pass) and a focused probe of the budget/parallelization paths. Reproducing the regression, the pre-fix script fails the reservation and 3-second PR-observation tests, while the fixed script passes them and keeps the outage/budget-exhaustion semantics. I also drove the real script against the live GitHub API for a real open PR and confirmed a fresh, error-free observation. Forge latency was injected only where deterministic slowness is required; the real CLI executable, persisted contribution records, and wake-queue output are the product surface under test. No regressions or missing evidence found.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
With 3-second forge reads, one 20-second poll records a fresh PR observation (checked_at=now, error=null, no unavailable wake) ✅ pass live probe-target-issue.log / fm-contributions-target-test.log: FM_CONTRIBUTIONS_BUDGET=20 FORGE_LATENCY=3 bin/fm-contributions.sh poll -> ok 'eight 3-second PR reads complete fresh within one 20-second…
The strengthened regression guard fails on the pre-fix script and passes on the fixed one ✅ pass live probe-base.log vs probe-target-issue.log: base -> 'not ok - a 3-second-read PR observation was not fresh within one cycle'; target -> ok
A later URL is deferred and left untouched when fewer than 15 seconds remain for its observation ✅ pass live probe-target-issue.log: ok 'a later URL waits when fewer than fifteen seconds remain for its observation' (later PR not called, record unchanged, no wake)
A genuine forge outage still records the error and emits exactly one unavailable wake per failure episode ✅ pass live probe-target-issue.log: ok 'a genuinely unavailable forge records an error and wakes once per failure episode'; base also passes, proving semantics preserved
Budget exhaustion (refusal between calls or a hung read) keeps the prior record and stays silent rather than mislabeling the URL unavailable ✅ pass live probe-target-issue.log: ok 'budget exhausted mid-observation (exhaust/hang) keeps the prior record and stays silent'
An issue observation (core + comments/events wave) still completes fresh under 3-second reads ✅ pass live probe-target-issue.log: ok 'a 3-second-read issue observation completes fresh within one 20-second poll cycle'
Against the real authenticated GitHub API, one poll of an owned real PR records a fresh observation within the default budget ✅ pass live live-target-realforge.log: real bin/fm-contributions.sh poll on cli/cli#14475 -> checked_at set, error=null, state=open, 6s elapsed, 0 wakes
Evidence: Full target fm-contributions test module (38/38 ok)

Source: Full target fm-contributions test module (38/38 ok)

ok - only required-captain contributions are rows; other actors are counted
ok - replaced-head verdict is stale and cannot create a captain requirement
ok - unchecked ownership is disclosed and cannot prove silence
ok - newest check with no verdict is distinct from passing and pending
ok - new maintainer comment wakes once and stays pending until acknowledged
ok - new maintainer review wakes once and stays pending until acknowledged
ok - new maintainer inline wakes once and stays pending until acknowledged
ok - ready-for-pr on a filed issue becomes a planning wake
ok - a fresh open issue remains measured maintainer triage
ok - an absent check lane remains missing across repeated observations
ok - mixed freshness retains measured captain work and discloses the gap
ok - malformed durable evidence cannot prove silence
ok - a transient ready-for-pr label wakes and its exact acknowledgement survives replay
ok - recorded judgment keeps its exact head and is stale immediately on a published replacement
ok - a current forge observation refreshes a verdict after a replacement
ok - an unavailable current head leaves verdict freshness unknown
ok - away yolo delivery is fleet work without granting merge authority
actionable: PR https://github.com/o/r/pull/8 is registered but its ready line did not reach the parent channel (rc=3)
ok - cross-home away yolo delivery is fleet work
ok - retired ownership persists and unsupported forge remains visibly unmeasured
ok - unsupported forge coverage is disclosed without inventing fleet work
ok - held unsupported forge coverage remains unmeasured
ok - shared contribution signal wakes once while retaining both acknowledgements
ok - watcher keeps observer diagnostics separate from contribution wakes
ok - expired child unsupported-forge coverage remains unmeasured
ok - watcher surfaces one newly durable contribution signal without re-ringing it
ok - parent consumes measured child coverage and refuses expired child silence
ok - unreadable pending signals refuse an empty-inbox claim
ok - budget exhausted mid-observation (exhaust) keeps the prior record and stays silent
ok - budget exhausted mid-observation (hang) keeps the prior record and stays silent
ok - a genuine forge failure inside the budget still records the error and wakes
ok - a URL owned by two tasks is observed once and every owner receives the result
ok - a merged or closed contribution settles once, is not re-read, and never wakes again
ok - a late owner inherits a terminal observation without a forge read or wake
ok - an open PR linked from a done task keeps being observed
ok - a later URL waits when fewer than fifteen seconds remain for its observation
ok - eight 3-second PR reads complete fresh within one 20-second poll cycle
ok - a genuinely unavailable forge records an error and wakes once per failure episode
ok - a late owner does not restart a shared forge failure episode
Evidence: Targeted probe on fixed script (reservation + 3s PR + 3s issue + outage + budget paths)

Source: Targeted probe on fixed script (reservation + 3s PR + 3s issue + outage + budget paths)

ok - a later URL waits when fewer than fifteen seconds remain for its observation
ok - eight 3-second PR reads complete fresh within one 20-second poll cycle
ok - a 3-second-read issue observation completes fresh within one 20-second poll cycle
ok - a genuinely unavailable forge records an error and wakes once per failure episode
ok - budget exhausted mid-observation (exhaust) keeps the prior record and stays silent
ok - budget exhausted mid-observation (hang) keeps the prior record and stays silent
ok - a genuine forge failure inside the budget still records the error and wakes
Evidence: Pre-fix script fails the two new regression guards

Source: Pre-fix script fails the two new regression guards

not ok - a later PR began without the fifteen-second observation reservation
not ok - test_reservation_defers_later_url_when_fifteen_seconds_do_not_remain
not ok - a 3-second-read PR observation was not fresh within one cycle
not ok - test_three_second_pr_reads_complete_fresh_in_one_cycle
ok - a genuinely unavailable forge records an error and wakes once per failure episode
ok - budget exhausted mid-observation (exhaust) keeps the prior record and stays silent
ok - budget exhausted mid-observation (hang) keeps the prior record and stays silent
ok - a genuine forge failure inside the budget still records the error and wakes
Evidence: Live real-forge poll of bin/fm-contributions.sh against cli/cli#14475 (fresh observation, error=null)

Source: Live real-forge poll of bin/fm-contributions.sh against cli/cli#14475 (fresh observation, error=null)

poll_rc=0 elapsed_s=6
=== record ===
{"url":"https://github.com/cli/cli/pull/14475","checked_at":"2026-09-21T05:43:24Z","error":null,"head":"9b6f66363f51a8265f1bb07f8fc3746017859cf1","state":"open","events":0}
=== wake-queue lines ===
0
Evidence: Live pre-fix script against the same real PR (indicates current real latency alone does not trip the budget)

Source: Live pre-fix script against the same real PR (indicates current real latency alone does not trip the budget)

===== base live run 1 =====
poll_rc=0 elapsed_s=11
=== record ===
{"url":"https://github.com/cli/cli/pull/14475","checked_at":"2026-09-21T05:43:47Z","error":null,"head":"9b6f66363f51a8265f1bb07f8fc3746017859cf1","state":"open","events":0}
=== wake-queue lines ===
0
===== base live run 2 =====
poll_rc=0 elapsed_s=13
=== record ===
{"url":"https://github.com/cli/cli/pull/14475","checked_at":"2026-09-21T05:43:58Z","error":null,"head":"9b6f66363f51a8265f1bb07f8fc3746017859cf1","state":"open","events":0}
=== wake-queue lines ===
0
Evidence: Three repeat runs of the targeted probe (no flakiness)

Source: Three repeat runs of the targeted probe (no flakiness)

===== probe iteration 1 =====
ok - a later URL waits when fewer than fifteen seconds remain for its observation
ok - eight 3-second PR reads complete fresh within one 20-second poll cycle
ok - a genuinely unavailable forge records an error and wakes once per failure episode
ok - budget exhausted mid-observation (exhaust) keeps the prior record and stays silent
ok - budget exhausted mid-observation (hang) keeps the prior record and stays silent
ok - a genuine forge failure inside the budget still records the error and wakes
iter_rc=0
===== probe iteration 2 =====
ok - a later URL waits when fewer than fifteen seconds remain for its observation
ok - eight 3-second PR reads complete fresh within one 20-second poll cycle
ok - a genuinely unavailable forge records an error and wakes once per failure episode
ok - budget exhausted mid-observation (exhaust) keeps the prior record and stays silent
ok - budget exhausted mid-observation (hang) keeps the prior record and stays silent
ok - a genuine forge failure inside the budget still records the error and wakes
iter_rc=0
===== probe iteration 3 =====
ok - a later URL waits when fewer than fifteen seconds remain for its observation
ok - eight 3-second PR reads complete fresh within one 20-second poll cycle
ok - a genuinely unavailable forge records an error and wakes once per failure episode
ok - budget exhausted mid-observation (exhaust) keeps the prior record and stays silent
ok - budget exhausted mid-observation (hang) keeps the prior record and stays silent
ok - a genuine forge failure inside the budget still records the error and wakes
iter_rc=0

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ tests/fm-contributions.test.sh:766 - test_two_second_pr_reads_complete_fresh_in_one_cycle runs with FORGE_LATENCY=2, so the eight sequential reads total only ~16s, which already fits the default 20s budget. The test therefore passes against the old sequential implementation and does not exercise the wave parallelization this change introduces: reverting bin/fm-contributions.sh to the sequential reads would still satisfy the assertion, so the core regression this branch fixes is not actually guarded. The latency needs to be raised to a value where the sequential total exceeds the budget (e.g. FORGE_LATENCY=3, where 8 reads ~24s > 20s and the parallelized observation still takes ~9s) so the test fails before the fix and passes after it.

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

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
With 3-second forge reads, one 20-second poll records a fresh PR observation (checked_at=now, error=null, no unavailable wake) ✅ pass live probe-target-issue.log / fm-contributions-target-test.log: FM_CONTRIBUTIONS_BUDGET=20 FORGE_LATENCY=3 bin/fm-contributions.sh poll -> ok 'eight 3-second PR reads complete fresh within one 20-second…
The strengthened regression guard fails on the pre-fix script and passes on the fixed one ✅ pass live probe-base.log vs probe-target-issue.log: base -> 'not ok - a 3-second-read PR observation was not fresh within one cycle'; target -> ok
A later URL is deferred and left untouched when fewer than 15 seconds remain for its observation ✅ pass live probe-target-issue.log: ok 'a later URL waits when fewer than fifteen seconds remain for its observation' (later PR not called, record unchanged, no wake)
A genuine forge outage still records the error and emits exactly one unavailable wake per failure episode ✅ pass live probe-target-issue.log: ok 'a genuinely unavailable forge records an error and wakes once per failure episode'; base also passes, proving semantics preserved
Budget exhaustion (refusal between calls or a hung read) keeps the prior record and stays silent rather than mislabeling the URL unavailable ✅ pass live probe-target-issue.log: ok 'budget exhausted mid-observation (exhaust/hang) keeps the prior record and stays silent'
An issue observation (core + comments/events wave) still completes fresh under 3-second reads ✅ pass live probe-target-issue.log: ok 'a 3-second-read issue observation completes fresh within one 20-second poll cycle'
Against the real authenticated GitHub API, one poll of an owned real PR records a fresh observation within the default budget ✅ pass live live-target-realforge.log: real bin/fm-contributions.sh poll on cli/cli#14475 -> checked_at set, error=null, state=open, 6s elapsed, 0 wakes
  • bash tests/fm-contributions.test.sh on target aac1ee6 (38/38 pass, including the new reservation and three-second regression tests)
  • Targeted probe bash tests/.probe-budget.test.sh (reservation, 3s PR, 3s issue, outage, budget exhaust/hang, genuine failure near deadline) - 7/7 pass
  • Same probe with git show bd65e4a:bin/fm-contributions.sh installed: reservation and 3s PR tests fail before the fix while failure/budget tests still pass
  • Repeated the targeted probe 3x to check for flakiness (all pass)
  • Live: bin/fm-contributions.sh poll against real authenticated GitHub API for Add a skill for chaptered CLI recordings cli/cli#14475 with a throwaway home (fresh observation, error=null, 6s elapsed, no wake)
  • Live baseline comparison: pre-fix script against the same real PR (fresh, 11-13s) showing today's real per-read latency is too fast to trip the 20s budget without latency injection
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid
kunchenguid merged commit b8ab735 into kunchenguid:main Sep 21, 2026
19 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

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

HEAD merged: aac1ee6b90a8f9f5a18baab4d0bf44187804aed9 → squash b8ab73547b556d9b9329b3be4034fb9a7e805b43
Attestation: MATCH · CI+NM: SUCCESS (35565921912 / 35565921807) · contract-class: restore (contribution poll PR observation fitting the forge-read budget again via wave parallelism + 15s reservation — existing always-on poll, not a new surface).

Whole thread read (first stamp; no prior comments/reviews; no linked closing issues; tip vs main was bd65e4aef05376bb50dc371aadb1258da0694241).

VISION (per-rule, tip vs main inspected before merge):

  1. One captain/interface — aligns (comments/reviews/ready signals stop going unobserved under slow forge).
  2. Authority explicit — aligns (no merge authority change; observation only).
  3. Scripts/mechanics — aligns (deterministic parallel forge waves + budget markers in bin/fm-contributions.sh).
  4. Restart non-event — aligns (durable records unchanged; budget-exhaust keeps prior record).
  5. Delegation spine — aligns (contribution monitoring job holds again).
  6. Fleet outlives vendor — aligns (forge latency resilience, not vendor lock-in).
  7. Scope — aligns (command-layer poll mechanics + regression tests).

Security skim: parallel authenticated gh reads only; no new auth/network/workflow surface. Workflow approvals this pass: CI 35565921912 + NM 35565921807.
Closes: none linked.
Firstmate flag: no.

dscott98 pushed a commit to Simplifying-Cloud/firstmate that referenced this pull request Sep 21, 2026
…unchenguid#5107)

* fix(bin): reserve contribution observation budget

* no-mistakes(review): Strengthen slow-read regression test to exceed the poll budget
dscott98 added a commit to Simplifying-Cloud/firstmate that referenced this pull request Sep 21, 2026
…nation (#4)

* feat: route Lavish feedback directly to owning workers (kunchenguid#5099)

* feat(procevent): route worker-owned Lavish rounds

* no-mistakes(review): drop duplicate artifact field from task-owned registration

* no-mistakes(review): post worker reply once, fix ring label, keep re-arm atomic

* no-mistakes(review): keep worker board owned until terminal round acknowledged

* no-mistakes(review): refuse every retirement of an open worker-owned round

* no-mistakes(review): use real lavish reply flag, isolate reply generations

* no-mistakes(review): drop .posted marker for best-effort reply posting

* no-mistakes(review): consume staged reply after listener setup, refuse orphaned captures

* no-mistakes(review): require a reachable owner, redeliver open rounds, roll back failed re-arms

* no-mistakes(review): re-arm only to acknowledge an open round

* no-mistakes(review): conclude only a still-open terminal round

* no-mistakes(review): record the acknowledgement before retiring the board

* no-mistakes(review): retain the registration across a conclude, qualify terminal docs

* no-mistakes(document): Document worker-owned Lavish round lifecycle

* fix(bin): fit pull observation within the contribution poll budget (kunchenguid#5107)

* fix(bin): reserve contribution observation budget

* no-mistakes(review): Strengthen slow-read regression test to exceed the poll budget

* feat(bin): add idempotent inbox capture, replies, receipts, and readiness JSON (kunchenguid#5103)

* feat(bin): add idempotent inbox orders, receipts, replies, and readiness

Let a caller supply a request id when publishing a captain inbox note so a
retry returns the original note instead of creating a second one, including
across the crash window between save and wake announcement. Separate saved
from announced so a failed wake is repairable without enqueueing again.
Add bounded receipts JSON with omission disclosure, a durable primary reply
against a note id, and a read-only readiness projection that can say
unknown instead of inferring liveness from a lock file.

* no-mistakes(review): fix(bin): honest inbox announce, reply cursor, and readiness verdict

* fix(bin): resolve ready from lock-holder ancestry; drop lock status --json

Remove the extra JSON surface from fm-lock.sh so its human status still
always exits zero. Have the readiness projection classify the inspected
home from the lock-holder pid via fm-harness.sh ancestry, with an explicit
FM_SUPERVISION_MODEL still winning and an unknown model when there is no
holder. Prove the yes path when that ancestry names a known harness.

* no-mistakes(review): Harden inbox announce, receipts reads, and reply sequence cursor

* no-mistakes(document): Note read-only lock inspection in scripts inventory

* no-mistakes(lint): Pass missing id argument to malformed-reply test printf

---------

Co-authored-by: cliflacata-svg <[email protected]>

* fix(bin): stop harness footer rows below a composer from reading as pending text (kunchenguid#5118)

* fix(composer): stop a harness footer row from reading as a composer holding text

A harness draws its own furniture below the composer - a user statusLine, a
permission-mode hint - and the cursorless "bottom-most shape wins" rule looks
exactly there. `→` (U+2192) is Cursor's prompt glyph but ordinary text
everywhere else, so a statusLine opening with `→` was selected as a bare
composer, swallowed the hint row beneath it as wrapped input, and answered
`pending` on a visibly empty pane. `fm_task_inbox_ring` defers on exactly that
verdict, and `bin/fm-watch.sh`'s re-ring calls the same function, so the first
doorbell and every retry were skipped and the worker never saw the steer.

Measured live on 2026-09-20: three of five Claude Code 2.1.236 worker panes on
Herdr 0.8.0 had genuinely empty composers and every one of them was refused.

A separator pair that closed over a bare agent-glyph row is a proven composer
container, so the contiguous non-blank rows below its closing rule are that
composer's footer and are no longer composer candidates. The demotion is bounded
by all three of its own preconditions: a blank row ends the zone, a pair that
closed over no glyph row demotes nothing, and a shape with no separator pair at
all (Cursor's half-block rules) is untouched. Real unsubmitted text in that same
composer, including a stray SGR mouse report left by a click in the pane, still
reads `pending`.

Pinned by two portable regressions and by a new cursorless arm on the live
composer-matrix guard, which re-reads each harness's already-proven-idle pane
the way every non-tmux backend reads it and fails naming the harness and
version when that read is `pending`.

* no-mistakes(review): make composer footer-zone demotion shape-independent

* no-mistakes(review): make footer-zone demotion refuse-only and drop rescan

* no-mistakes(lint): quote probe-absent sentinel to clear ShellCheck SC2100

---------

Co-authored-by: Koen Muller <[email protected]>

* feat(bin): append optional home-local include to briefs (kunchenguid#5115)

Co-authored-by: guanchengh-lgtm <[email protected]>

* fix(bin): report a branch with no validation run as absent instead of an unreadable runs table (kunchenguid#5114)

* fix(bin): stop misreading a no-run branch as an unreadable runs table

Defect: when `no-mistakes axi status`'s overview is truncated (a task's
own branch has zero rows among the shown ones), fm_nm_select_run's
Python fallback derived the repo identity for its direct SQLite query
from a `repo: <path>` line it expected in the overview text. The real
CLI never emits that line, truncated or not (see the genuine capture at
tests/captures/no-mistakes-v1.70.1/overview.toon, which has only
`count:`/`runs[...]:`), so the lookup always failed and reported
"unreadable runs table" for a task that simply has no run on its
branch. On a fleet with many concurrent runs, every idle-branch task
hits the truncated-overview path routinely, so this fired every few
minutes and drowned genuine unreadable/blocked verdicts in noise.

Fix: derive the repo identity from the task worktree path instead,
which is exactly the value `no-mistakes` records as a repo's
`working_path` (confirmed against the existing capped-overview test
fixtures, which already register repos by worktree path). A worktree
path that is not absolute cannot be matched and still reads as
unreadable rather than being guessed at. Also raise the reader's
SQLite busy timeout from 1s to 30s so ordinary lock contention on a
busy fleet cannot masquerade as an unreadable database.

Safety: every other verdict byte-for-byte unchanged - the repo lookup
still requires exactly one matching row (a genuinely corrupt or
mismatched repos table still reports unreadable, per the existing
`repo` failure-mode test), the branch query and row validation are
untouched, and a zero-row result for the branch still flows through
the same recursive re-parse that already turns an empty `runs[0]{...}`
table into `absent`. Added a regression test
(test_capped_overview_without_repo_line_and_no_runs_reports_absent)
that reproduces the real overview shape - capped, zero rows for the
task's branch, no `repo: ` line - and asserts the crew state falls
through to the pane/busy verdict instead of reporting unknown or
"unreadable". Full fm-crew-state.test.sh suite passes unchanged
otherwise.

* fix: recovered same-branch inventory awk misreads empty result as unreadable

fm_nm_select_run's deep SQLite reader rebuilds a `count:`/`runs[...]:`
overview and re-runs it through the same awk selection pass. When that
rebuilt inventory has zero rows for the branch, the row-matching loop never
executes, so its counters (`seen`) stay at awk's uninitialized empty string
while `expected` and `shown` are plain strings parsed from the header text.
Comparing an uninitialized value against a non-numeric string uses string
comparison, so "" != "0" is true, and the END block takes the "unreadable
runs table" branch instead of falling through to the correct "absent"
verdict for a branch with genuinely zero runs.

Coerce the affected END comparisons with `+0` so they are always numeric,
matching seen/expected/shown/total regardless of whether awk classified
them as strings or numeric strings. A truncated or genuinely malformed
inventory still differs numerically and still reports unreadable.

* no-mistakes(review): bound capped-overview inventory reader and canonicalize worktree lookup

* no-mistakes(review): match recorded repo path first, tolerate duplicate spellings

* no-mistakes(review): revert repo lookup to exact working_path match

* no-mistakes(document): note state-db inventory read under crew-state nm timeout

* fix(bin): require a non-draft pull request before a PR-based done report (kunchenguid#5141)

* fix(bin): require a non-draft pull request before a PR-based done report

A PR-based ship could report done, and merge monitoring could be armed, while the pull request was still a draft. A draft cannot be merged, so the poll waited for an event that could not occur and nobody was asked to merge.

The PR-based definitions of done now require reading the pull request back from the forge and confirming it is not a draft, and a lane that deliberately holds a draft declares a wait instead of done.
bin/fm-pr-check.sh refuses to arm merge monitoring on a draft, naming the draft state, and treats an unreadable draft state as before.
The draft reading now lives in bin/fm-pr-lib.sh and bin/fm-pr-merge.sh uses it, with its refusal to merge a draft unchanged.

Closes kunchenguid#4757

* fix(review): Skip arm-time draft refusal when fm-pr-merge records metadata

* fix: support quota-axi schema 6 snapshots (kunchenguid#4904)

* fix(bin): accept quota-axi schema 6 snapshots keyed by provider + accountKey

quota-axi 0.1.47 emits schemaVersion 6 once a provider expands to more
than one account: every provider row carries an accountKey and one
provider id may appear on several rows. fm_quota_json_valid accepted
only schema 5 with unique provider ids, so fm-dispatch-resolve.sh,
fm-quota-choose.sh, and fm-procevent-quota.sh all rejected the live
snapshot and quota-informed dispatch was dead against the current tool.

- bin/fm-quota-axi-lib.sh: the validator accepts schema 6 with
  accountKey required on every row and uniqueness on
  provider + accountKey; schema 5 keeps its exact rules. FM_QUOTA_ROW_JQ
  is the one join every consumer uses: schema 5 binds by provider alone,
  schema 6 binds to the row keyed by the candidate's Pi lane, else the
  provider's default row, else no row (unmeasured, never blocked, never
  by position or summed across accounts).
- bin/fm-quota-choose.sh: accepts schema 6 JSON and the TOON accountKey
  column, and joins through the shared function.
- bin/fm-dispatch-resolve.sh and bin/fm-procevent-quota.sh: join through
  the shared function; an expanded provider with no row for the
  candidate's account is reported as such.
- tests: schema 6 fixtures shaped like the real snapshot, each paired
  with a schema 5 case on the same path; every new case fails on the
  previous scripts and passes now.
- docs: the two sentences naming the row join describe the schema 6 key.

* no-mistakes(review): Fix native Codex quota and expanded provider watches

* no-mistakes(review): Align native Codex account matching across dispatch paths

* no-mistakes(document): Align quota documentation with account-aware snapshots

* no-mistakes(document): Align quota dispatch documentation with account matching

* fix(bin): keep CI lint and the quota watch test portable

- bin/fm-quota-axi-lib.sh: FM_QUOTA_ROW_JQ is read only by the scripts
  that source this library, so full-mode ShellCheck reported SC2034 on
  the assignment; mark it alongside the existing SC2016 disable.
- tests/fm-procevent-quota.test.sh: the schema 6 provider-watch
  assertions used rg, which CI runners do not install, so the case
  failed with 'rg: command not found' rather than on behavior; use grep
  like the rest of the file.

* no-mistakes(document): Documented schema-version account-row compatibility

* Add primary-only OpenRouter Sol switch

* no-mistakes(review): Restrict provider switching to primary with quota-plan supervision

* no-mistakes(test): Verify main-only provider switching with real Pi supervision

* no-mistakes(document): Clarify Pi provider switching and correct verification documentation

* no-mistakes(review): Fix inbox concurrency and acknowledgement reporting

* no-mistakes(document): Correct documentation contradictions and consolidate board lifecycle guidance

---------

Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: sdivanl <[email protected]>
Co-authored-by: cliflacata-svg <[email protected]>
Co-authored-by: cliflacata-svg <[email protected]>
Co-authored-by: puntkoen <[email protected]>
Co-authored-by: Koen Muller <[email protected]>
Co-authored-by: guanchengh-lgtm <[email protected]>
Co-authored-by: guanchengh-lgtm <[email protected]>
Co-authored-by: Authentis <[email protected]>
Co-authored-by: Mickaël Rémond <[email protected]>
Co-authored-by: Pedro Müller <[email protected]>
andrewesweet pushed a commit to andrewesweet/firstmate that referenced this pull request Sep 21, 2026
…unchenguid#5107)

* fix(bin): reserve contribution observation budget

* no-mistakes(review): Strengthen slow-read regression test to exceed the poll budget
JuanJoseGonGi pushed a commit to JuanJoseGonGi/firstmate that referenced this pull request Sep 22, 2026
…unchenguid#5107)

* fix(bin): reserve contribution observation budget

* no-mistakes(review): Strengthen slow-read regression test to exceed the poll budget