Repository navigation
feat(bin): add shared_quota opt-out from quota-based dispatch ranking - #7894
Conversation
|
Speaking as Kun's firstmate: thank you @Dematom1, this is a tidy change. I read the full diff against main Before this can merge, it needs two things from you (it's waiting on you, not on Kun):
Once that's in, CI is green and the attestation matches, I can merge it as an opt-in on a later pass. Thanks also for noting the |
[Medium impact] No blocking code issues were found; the PR appears review-ready, subject to the stated instruction not to merge it. Reviews (4) · Last reviewed commit: "no-mistakes(document): Document shared_q..." · Reviewed by Greptile |
9e4da12 to
ad67be9
Compare
A home whose Claude and other provider usage draws on one combined AI budget has no meaningful per-provider quota rows, so spendPriority ranking and runway gates pick the wrong candidate. An optional top-level "shared_quota": true in config/crew-dispatch.json now opts the home out: the typed resolver makes no quota-axi call, applies no quota floor or runway gate, ranks nothing by spendPriority, and resolves the matched rule's use profiles in declared order, printing every candidate line with quota ranking off by home declaration. Firstmate's quota-array-dispatch intake honors the same declaration. Without the setting, behavior is unchanged. Non-boolean values are actionable configuration errors in both the resolver and bootstrap.
…loors The shared_quota opt-out test picked a rule with no quota floor, so the separate rule-floor and profile-floor bypass paths stayed untested. Two cases now run against the same fixture: a rule whose model:fable floor (20%) exceeds the snapshot's 15%, and a profile whose all_models floor (50%) exceeds codex's 31%, each asserting the declared-order pick still wins with no quota-axi invocation.
…pt-out and test it
…rification inventory
35739e6 to
ab251e7
Compare
|
Speaking as Kun's firstmate: thank you @Dematom1. This covers both asks from my last note, and the extra floor-bypass tests are a nice touch. What I checked (head
No-mistakes binds this head and Greptile is 5/5. Live validation is go: 5 of 6 scenarios, against a real resolver and a pass-through Contract-class (my own read): opt-in. Nothing changes unless a home declares Status: waiting on the quick CI checks I just approved, which is on our side, not yours. After that, we run the full suite (the "Full suite" check needs a maintainer label for outside PRs, so a failure there now isn't on you). If it's green, this can merge as an opt-in on a later pass. |
|
Speaking as Kun's firstmate: thanks @Dematom1. I re-checked every gate on head This is waiting on our full-suite run, not on you. If it passes, and it's still clean, it can merge (opt-in). I approved the fork CI run that the label started. |
Intent
"yes I want it removed, upstream could take a while" - the upstream pull request #7894 (issue #7893, head branch
Dematom1:fm/fm-shared-quota-optout) moved from the main home to this home. Never merge it; report review-ready changes with the PR URL.The PR adds an optional top-level
"shared_quota": trueinconfig/crew-dispatch.jsonthat opts a home out of quota-based ranking: the typed resolver (bin/fm-dispatch-resolve.sh) makes noquota-axicall, applies no quota floor or runway gate, resolves the matched rule'suseprofiles in declared order, and states on every candidate line that quota ranking is off;falseor absent keeps behavior unchanged; a non-boolean value is refused by the resolver and bootstrap.Open review asks on the current head:
"shared_quota": trueshowing noquota-axicall and the declared-order pick with the "quota ranking off" line on every candidate (a no-mistakes run that records this live also works).tests/fm-dispatch-resolve.test.shline 1096): the newshared_quota: truetest selects a rule with no quota floor, so the separate rule-floor and profile-floor bypasses are untested; add cases with unmet rule and profile quota floors and assert the declared profiles still win without callingquota-axi.What Changed
bin/fm-dispatch-resolve.shnow accepts an optional top-level"shared_quota": trueinconfig/crew-dispatch.json. When it is set, the resolver makes noquota-axicall, skips quota floors (rule and profile), runway gates, andspendPriorityranking, and picks the matched rule'suseprofiles in declared order.preferred_providerstill narrows the pool first. Every candidate line readseligible (quota ranking off: home declares a single shared quota). When the field isfalseor absent, the quota-ranked path is unchanged.bin/fm-bootstrap.shboth reject a non-booleanshared_quotawithshared_quota must be true or false when present.docs/configuration.md(schema example, field table, a new "Shared-quota opt-out" section, typed-resolution notes), thequota-array-dispatchskill,AGENTS.md, and the verification inventory. New tests cover: the declared-order pick with noquota-axicall, bypass of unmet rule and profile floors,preferred_providernarrowing, the candidate line,falsekeeping quota ranking, and non-boolean rejection in both the resolver and bootstrap.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The opt-out stays behind a boolean that both the resolver and bootstrap validate. With it absent or false, every code path is unchanged. The fix round only adds the decided preferred_provider wording and a behavioral test. That test runs the resolver and matches the code: under shared_quota every candidate is eligible, so the preferred family becomes the pool and the first one declared wins. It would fail if preferred_provider were ignored, because claude would then be picked.
Testing
I drove the real resolver five times against the live typesafe.ai provider in a disposable lab FM_HOME (bin/fm-lab-home.sh create). A shim logged every quota-axi invocation and passed each call through to the real binary. The opt-out runs made no quota-axi call, ignored the unmet floors, picked in declared order, and printed the quota-ranking-off line on every candidate. With preferred_provider set, codex won, as review round 3 decided. The false and absent controls called quota-axi exactly once. The real quota-axi exits 1 here because of a keychain-access state in its own output, so those control runs ended in status error rather than a ranked pick; this did not come from the change. The non-boolean value was refused with exit 2. I also ran the branch's own shared-quota test cases in isolation, and they all passed. The bootstrap validation run was too slow (bootstrap runs once per validation row) and was still running when results were due, so I killed it; the bootstrap refusal is untested live. The lab was removed afterwards and the worktree is clean. This change has no UI.
Evidence: Live intake with shared_quota true and unmet rule/profile floors: no quota-axi call, declared-order pick, opt-out line on every candidate
Source: Live intake with shared_quota true and unmet rule/profile floors: no quota-axi call, declared-order pick, opt-out line on every candidate
Evidence: Live intake with shared_quota true plus preferred_provider codex
Source: Live intake with shared_quota true plus preferred_provider codex
Evidence: Control: shared_quota false still calls quota-axi
Source: Control: shared_quota false still calls quota-axi
Evidence: Control: shared_quota absent still calls quota-axi
Source: Control: shared_quota absent still calls quota-axi
Evidence: Non-boolean shared_quota refused by the resolver
Source: Non-boolean shared_quota refused by the resolver
Evidence: Shared-quota test cases run in isolation
Source: Shared-quota test cases run in isolation
Evidence: Live opt-out output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 1 issue found → auto-fixed ✅
docs/configuration.md- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-dispatch-resolve.sh:41- In review round 3 the user chose to fix the shared_quota + preferred_provider interaction by documenting it, with no behavior change. That fix is not on this head. Possibly it was lost in the rebase. The code still appliespreferred_providerbefore$sqpicks$elig | first(bin/fm-dispatch-resolve.sh:548-566). Concrete case:shared_quota: truewithpreferred_provider: "codex"and a matched rule declaring[claude…, codex…]. The resolver picks codex. Every opt-out description still says "declared order" only, so each one is inaccurate for that case. Add the decided sentence ("preferred_provider still narrows the pool; declared order then picks within it") at each of these places:Also add the decided test to tests/fm-dispatch-resolve.test.sh. Set shared_quota true plus preferred_provider and assert three things: the preferred family wins within the pool in declared order, quota-axi.calls is absent, and the "quota ranking off" line appears on every candidate. No current test covers this combination.
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
FM_HOME=$LAB PATH=$SHIM:$PATH bin/fm-dispatch-resolve.sh brief.md --project pagerwith shared_quota true, a rule floor and a profile floor set above available quota (real typesafe.ai, real quota-axi behind a logging shim)Same resolver run with shared_quota true plus preferred_provider "codex"Same resolver run with shared_quota false, and again with shared_quota absent (control)Same resolver run with shared_quota "yes" (adversarial non-boolean)tests/fm-dispatch-resolve.test.sh trimmed to its setup plus the shared-quota cases (opt-out, unmet rule floor, unmet profile floor, preferred_provider, false path), run from a lab copytests/fm-bootstrap.test.sh trimmed to test_crew_dispatch_validation (killed before it finished)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.