Skip to content

fix: support quota-axi schema 6 snapshots - #4904

Merged
kunchenguid merged 7 commits into
kunchenguid:mainfrom
pedromuller-del:fm/quota-axi-schema6
Sep 21, 2026
Merged

kunchenguid merged 7 commits into
kunchenguid:mainfrom
pedromuller-del:fm/quota-axi-schema6

Conversation

@pedromuller-del

@pedromuller-del pedromuller-del commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4926

Intent

Create a PR in the firstmate repo that fixes the quota snapshot incompatibility, following the repo's own contribution rules, because the problem is certain.

Context. quota-axi 0.1.47 emits schemaVersion: 6 whenever a provider expands to more than one account; in this home Codex has two Pi lanes, openai-codex and openai-codex-work, so every provider row now carries an accountKey and the provider id codex appears on two rows. fm_quota_json_valid in bin/fm-quota-axi-lib.sh (lines 50-52) accepts only schema 5 with unique provider ids, and bin/fm-quota-choose.sh (lines 116-121) dies with "unsupported quota-axi schema version: 6". As a result bin/fm-dispatch-resolve.sh reports "quota-axi --json returned an invalid snapshot" on every brief, and bin/fm-quota-choose.sh and bin/fm-procevent-quota.sh fail the same way, so quota-informed dispatch is dead against the current tool. Proven on 2026-09-19: the live snapshot fails the validator (exit 1); the identical snapshot with schemaVersion rewritten to 5 and providers deduplicated by provider passes (exit 0); schemaVersion alone rewritten still fails on the duplicate provider rule.

The quota-axi README section "Account keys and compatibility" defines the version 6 contract: every provider record has an accountKey (default for a provider still using one selected account); the quota join becomes provider + accountKey + scope; a Codex Pi lane's key is its auth.json provider id such as openai-codex, and the native Codex lane's key is codex-home; declaration order is non-preferential; quotas are never combined across accounts; consumers must honor the schema version and must never infer a key from row position. When no provider expands, the output stays schema 5 with no account column.

Make sure the fix is retrocompatible so people in older versions do not break.

Do not add any personal account key name or anything about the captain in the code; use the quota-axi README's own neutral example lane names instead.

What Changed

  • Added schema 6 validation and JSON/TOON parsing while preserving schema 5 compatibility.
  • Bound dispatch and quota watchers to account-specific rows without combining accounts.
  • Added schema 6, malformed-input, and backward-compatibility coverage and documentation.

Risk Assessment

✅ Low: The change is bounded, preserves schema 5 behavior, and consistently applies schema 6 account-key matching across affected consumers.

Testing

Exercised all three targeted behavioral suites plus the installed quota-axi 0.1.47 schema-6 snapshot against the real chooser and provider watch; legacy schema-5 transformation also worked, but the live API resolver could not be authenticated.

  • Live validation: ⚠️ inconclusive - 3 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Run a live schema-6 snapshot through quota selection and select an eligible candidate without rejecting duplicate provider rows ✅ pass live live-quota-compatibility.log: schemaVersion 6 accepted; chooser returned cursor default
Watch an expanded Codex provider and report each account independently with account evidence preserved ✅ pass live live-quota-compatibility.log: provider watch reported exhausted with two sanitized account rows
Attempt native Codex dispatch against expanded live data without a codex-home row and avoid borrowing a positional Pi account ✅ pass live live-quota-compatibility.log: native Codex candidate did not displace the eligible cursor candidate
Use a real older schema-5 quota-axi producer and retain provider-only compatibility ⏸️ untested no No older quota-axi binary was available; provide a schema-5-producing quota-axi installation to drive this producer path live.
Resolve a brief through the real Typesafe API and select native Codex, Pi, or Pi-native using account and floor rules ⏸️ untested no The isolated phase had no TYPESAFE_API_KEY and no worktree .env credential; provide a valid Typesafe API credential and network access to drive the real POST.
Evidence: Live quota compatibility evidence

Source: Live quota compatibility evidence

$ quota-axi --json | jq schema/account-key summary
{"schemaVersion":6,"providerRows":12,"providers":[{"provider":"claude","hasAccountKey":true},{"provider":"codex","hasAccountKey":true},{"provider":"codex","hasAccountKey":true},{"provider":"cursor","hasAccountKey":true},{"provider":"copilot","hasAccountKey":true},{"provider":"grok","hasAccountKey":true},{"provider":"kimi","hasAccountKey":true},{"provider":"zai","hasAccountKey":true},{"provider":"agy","hasAccountKey":true},{"provider":"alibaba","hasAccountKey":true},{"provider":"opencode-go","hasAccountKey":true},{"provider":"commandcode","hasAccountKey":true}]}
$ quota-axi --json | bin/fm-quota-choose.sh --candidate codex:default --candidate cursor:default
cursor default
exit=0
$ bin/fm-procevent-quota.sh poll --interval 0.01 --threshold 100 --provider codex --timeout 5
quota: quota-codex
status: exhausted
condition_polls: 1
detail: {"provider":"codex","summary":[{"provider":"codex","accountKey":"account-1","best":{"scope":"all_models","status":"known","effectivePercentRemaining":3,"boundedBy":["weekly"],"limitingWindowIds":["weekly"],"pace":{"status":"ahead","aheadWindowIds":["weekly"],"worstReservePercentPoints":-24.9752,"worstReserveWindowId":"weekly"},"runway":{"status":"projected_exhaustion","usableRunwaySeconds":13472,"projectedExhaustedAt":"2026-09-20T01:21:49.509Z","limitingWindowId":"weekly","projectionConfidence":"established"},"selection":{"status":"known","spendPriority":-1.2396}}},{"provider":"codex","accountKey":"account-2","best":{"scope":"all_models","status":"known","effectivePercentRemaining":0,"boundedBy":["weekly"],"limitingWindowIds":["weekly"],"pace":{"status":"ahead","aheadWindowIds":["weekly"],"worstReservePercentPoints":-74.9089,"worstReserveWindowId":"weekly"},"runway":{"status":"exhausted_now","usableRunwaySeconds":0,"limitingWindowId":"weekly","projectedExhaustedAt":"2026-09-19T21:37:17.154Z"},"selection":{"status":"known","spendPriority":-3.9855}}}]}
$ quota-axi --json | jq schemaVersion=5, one row/provider, remove accountKey | bin/fm-quota-choose.sh --candidate cursor:default
cursor default
exit=0
- Outcome: ⚠️ 2 warnings across 1 run (5m21s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 2 warnings
  • ⚠️ The real API-backed dispatch resolver could not be exercised because no Typesafe API credential was available; rerun with a valid TYPESAFE_API_KEY.
  • ⚠️ live validation verdict: inconclusive (3 of 5 scenarios were driven live against the product); untested: Use a real older schema-5 quota-axi producer and retain provider-only compatibility, Resolve a brief through the real Typesafe API and select native Codex, Pi, or Pi-native using account and floor rules
  • Live validation: ⚠️ inconclusive - 3 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Run a live schema-6 snapshot through quota selection and select an eligible candidate without rejecting duplicate provider rows ✅ pass live live-quota-compatibility.log: schemaVersion 6 accepted; chooser returned cursor default
Watch an expanded Codex provider and report each account independently with account evidence preserved ✅ pass live live-quota-compatibility.log: provider watch reported exhausted with two sanitized account rows
Attempt native Codex dispatch against expanded live data without a codex-home row and avoid borrowing a positional Pi account ✅ pass live live-quota-compatibility.log: native Codex candidate did not displace the eligible cursor candidate
Use a real older schema-5 quota-axi producer and retain provider-only compatibility ⏸️ untested no No older quota-axi binary was available; provide a schema-5-producing quota-axi installation to drive this producer path live.
Resolve a brief through the real Typesafe API and select native Codex, Pi, or Pi-native using account and floor rules ⏸️ untested no The isolated phase had no TYPESAFE_API_KEY and no worktree .env credential; provide a valid Typesafe API credential and network access to drive the real POST.
  • bash tests/fm-quota-choose.test.sh
  • bash tests/fm-procevent-quota.test.sh
  • bash tests/fm-dispatch-resolve.test.sh
  • Live quota-axi --json through bin/fm-quota-choose.sh
  • Live bin/fm-procevent-quota.sh poll --provider codex
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@tiago-peixoto tiago-peixoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this head (b62bf4b43) against current main (2bcb88c3) and live quota-axi 0.1.47 for the refuse-on-6 break tracked by #4926.

The compatibility break is real, and this PR actually fixes it.

  • Main fm_quota_json_valid rejects a synthetic schema 6 snapshot (exit 1). This PR's validator accepts the same bytes (exit 0).
  • Main fm-quota-choose.sh dies with unsupported quota-axi schema version: 6. This PR's choose accepts schema 6 JSON.
  • Live quota-axi 0.1.47 on the machine I used still emits schema 5 (no provider expanded to multiple accounts). Both main and this PR accept that live schema 5 snapshot, so schema 5 compatibility holds.

On a synthetic schema 6 snapshot with codex rows openai-codex and openai-codex-work plus cursor/grok default rows:

  • cursor:default and grok:default select.
  • native codex:gpt-6-astra returns none (does not borrow a Pi Codex account).
  • codex:… then cursor:default selects cursor.

That matches the intended join: schema 6 binds provider + accountKey, falls back to default, never by row position, never by summing accounts.

Tests add real schema-6 shaped fixtures (two Codex keys plus default rows), a TOON accountKey column, and refusals for a keyless row and a duplicate provider+accountKey. That is the right regression shape. Rewriting a live snapshot down to schema 5 would have kept hiding this.

Residual notes, not a request to rewrite the PR:

  • quota_lane is Codex-specific (native codex-home, Pi model prefix). Other expanded providers still fall back to accountKey=default. That is enough to stop the refuse-on-6 dispatch break. Broader per-account dispatch across every provider remains #4379.
  • GitHub currently reports no CI checks on this head (mergeStateStatus: UNSTABLE). Worth confirming workflow approval so attestation can land on this SHA before asking for another look.
  • The PR body does not reference #4926. A Fixes #4926 (or a mention) would attach the tracker.

I am not requesting changes. Happy to re-check a later head.

@tiago-peixoto tiago-peixoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this head (b62bf4b43) against current main (2bcb88c3) and live quota-axi 0.1.47 for the refuse-on-6 break tracked by #4926.

The compatibility break is real, and this PR actually fixes it.

  • Main fm_quota_json_valid rejects a synthetic schema 6 snapshot (exit 1). This PR's validator accepts the same bytes (exit 0).
  • Main fm-quota-choose.sh dies with unsupported quota-axi schema version: 6. This PR's choose accepts schema 6 JSON.
  • Live quota-axi 0.1.47 on the machine I used still emits schema 5 (no provider expanded to multiple accounts). Both main and this PR accept that live schema 5 snapshot, so schema 5 compatibility holds.

On a synthetic schema 6 snapshot with codex rows openai-codex and openai-codex-work plus cursor/grok default rows:

  • cursor:default and grok:default select.
  • native codex:gpt-6-astra returns none (does not borrow a Pi Codex account).
  • codex:… then cursor:default selects cursor.

That matches the intended join: schema 6 binds provider + accountKey, falls back to default, never by row position, never by summing accounts.

Tests add real schema-6 shaped fixtures (two Codex keys plus default rows), a TOON accountKey column, and refusals for a keyless row and a duplicate provider+accountKey. That is the right regression shape. Rewriting a live snapshot down to schema 5 would have kept hiding this.

Residual notes, not a request to rewrite the PR:

  • quota_lane is Codex-specific (native codex-home, Pi model prefix). Other expanded providers still fall back to accountKey=default. That is enough to stop the refuse-on-6 dispatch break. Broader per-account dispatch across every provider remains #4379.
  • GitHub currently reports no CI checks on this head (mergeStateStatus: UNSTABLE). Worth confirming workflow approval so attestation can land on this SHA before asking for another look.
  • The PR body does not reference #4926. A Fixes #4926 (or a mention) would attach the tracker.

I am not requesting changes. Happy to re-check a later head.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Tip b62bf4b43a3702b97da1cd9a1dba388259f2b160 — attestation MATCH. Contract-class restore (unconfigured quota path already promised schema-aware quota-axi consumption; main refuses schema 6 / duplicate provider rows, breaking dispatch against current quota-axi — tip accepts schema 6 with provider+accountKey, keeps schema 5, never sums accounts or picks by row position).

Independent review on this tip (tiago-peixoto) confirms the refuse-on-6 break vs main and schema-5 compatibility. Tracks #4926 (body does not yet say Fixes #4926 — optional mention welcome).

Fork workflows approved this pass (CI 35426960765, NM 35426960761). MERGEABLE/UNSTABLE until green. We will re-watch after CI + no-mistakes SUCCESS. Waiting on CI, not on the author.

Security FYI (not a merge gate while CI pending): schema-6 accountKey / quota_lane binding selects which credential store's quota row is consulted — Codex-specific lanes only in this tip; broader per-account dispatch remains #4379.

@tiago-peixoto

Copy link
Copy Markdown
Contributor

Lint 2 on tip b62bf4b43 failed shellcheck SC2034: FM_QUOTA_ROW_JQ in bin/fm-quota-axi-lib.sh is flagged unused. Consumers source that file and pass the jq program into choose/dispatch, so this looks like a false unused rather than a missing join. A targeted disable (or an assignment shellcheck can see) should clear the lane. Other CI jobs were still running when this was noticed; maintainer triage is waiting on green CI, not on a new look at this red head.

…ountKey

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.
- 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.
@pedromuller-del pedromuller-del changed the title fix: handle quota-axi schema 6 account snapshots fix: support quota-axi schema 6 snapshots Sep 19, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Re-triage on newer HEAD c16a1d1bde8ba436d0c3d4edbf6c29e53b490406 (moved since prior stamp on b62bf4b43a3702b97da1cd9a1dba388259f2b160) vs main 1b1b6e051dafc9dcabe3ef0a7d4a64bd40a45567. Whole thread re-read (prior waiting-ci restore; tiago Lint 2 SC2034 note). Attestation MATCH on this tip.

Contract-class: restore (unchanged). Main still refuses schema 6 / duplicate provider rows in fm_quota_json_valid and dies on unsupported schema in fm-quota-choose.sh, breaking the already-promised quota-axi consumption path. Tip accepts schema 5 and 6 with provider+accountKey binding, never sums accounts or picks by row position. SC2034 addressed with an explicit shellcheck disable on FM_QUOTA_ROW_JQ (jq program text consumed by sourcing callers). Tracks #4926 (body still does not say Fixes #4926 — optional).

CI/NM: tip was parked action_required. Fork workflows approved this pass for this HEAD: CI 35471278695, Require no-mistakes 35471309161 (+ twin 35471278694). Now queued/in progress. MERGEABLE/UNSTABLE until green.

VISION.md (each rule)

  • One captain, one interface: aligns — dispatch keeps working against current quota-axi.
  • Authority is explicit: aligns — no new autonomy; schema compatibility floor only.
  • Scripts own the mechanics: aligns.
  • A restart is a non-event: aligns.
  • Delegation with a spine: aligns.
  • The fleet outlives any vendor: aligns (tracks quota-axi schema evolution).
  • Scope: aligns.

Decision: waiting-ci. Auto-merge candidate when CI + NM SUCCESS on this HEAD (restore + MATCH + safe). Security FYI (not a merge gate while CI pending): schema-6 accountKey / quota_lane selects which credential store's quota row is consulted. No Firstmate flag.

@pedromuller-del

Copy link
Copy Markdown
Contributor Author

@kunchenguid CI and Require no-mistakes are green on c16a1d1b (20/20 checks success), and the body now carries Fixes #4926. Ready for the re-watch / auto-merge pass whenever convenient. Thanks for approving the fork workflows.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Re-triage after author nudge (CI green notice) and main move. Tip c16a1d1bde8ba436d0c3d4edbf6c29e53b490406 vs main dbc0bc4b8035d4db0007cd24f77ee9911279e8e9. Attestation MATCH. CI 35471278695 + Require no-mistakes SUCCESS (20/20). MERGEABLE/CLEAN. Pending fork NM re-run 35482308032 approved this pass. Tracks #4926 (body Fixes #4926; issue matches).

Contract-class: restore (re-inspected tip vs main; prior stamps unchanged). Main fm_quota_json_valid / fm-quota-choose.sh still refuse schema 6 / duplicate provider rows, breaking already-promised quota-axi consumption against current quota-axi 0.1.47. Tip accepts schema 5 and 6 with provider+accountKey join, keeps schema 5 rules, never sums accounts or picks by row position. Independent review (tiago-peixoto) confirmed the break and fix earlier.

VISION: aligns (delegation/scripts; restores quota-informed dispatch without new default surface). Auto-merge eligible.

Squash-merging now.

@kunchenguid
kunchenguid merged commit 259a669 into kunchenguid:main Sep 21, 2026
21 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

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

dscott98 pushed a commit to Simplifying-Cloud/firstmate that referenced this pull request Sep 21, 2026
* 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
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]>
JuanJoseGonGi pushed a commit to JuanJoseGonGi/firstmate that referenced this pull request Sep 22, 2026
* 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
BohnBawerick added a commit to BohnBawerick/firstmate that referenced this pull request Sep 23, 2026