Repository navigation
Conversation
Add bin/check-pool-ordering.mjs: per tier, resolve the effective pool order from the tracked config (reusing inspectRouteRules) and check the OpenAI-final-reserve rule over ordered chains — an OpenAI-backed pool must come last in every ordered chain, with fallback targets checked as separate passes. Weighted/round-robin mixing is reported as a note (no reserve encoding visible), never a finding. Wire the fixtures and the canonical-config check into opencode-config-guard. After this PR, 'node bin/check-pool-ordering.mjs .opencode/opencode.jsonc' reports each tier's pool order with the reserve verdict (pass on the canonical config).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 47 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f9affa2ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…g args (#1173) parseArgs only rejected '--'-prefixed tokens, so '-j' fell through to the config-path positional and the checker audited whatever file it named instead of reporting a usage error. Reject any dash-prefixed token that is not a declared flag, before the config is read (operator script argument contract #3352). Adds a parseArgs test covering '-j', '-h', bare '-', '--bogus', duplicate --json and a second positional.
…#1173) leafPool identified every direct leaf by provider alone, so two direct leaves from one provider (e.g. _muse Spark then _muse Wonder) collapsed to one pool and a trailing non-OpenAI seat after an OpenAI-backed pool disappeared from the check. Identify a direct door by provider/model instead. Adds an example test for the Spark -> sol-plan -> Wonder chain (now a violation) and the Wonder seat to the fixture catalog. Real config still passes: summit now reports direct:_muse/muse-wonder-1.0-contributor ahead of sol-plan.
) Passes were grouped only by the tier route's own fallback tail, so when a fallback target's chain ended in its own declared fallback (e.g. scout -> background -> workhorse), the fallback's chain and its fallback's chain collapsed into one ordered sequence and a valid configuration was reported as a reserve violation. Group leaves by the sequence of fallback hops on their trace instead, so every class-fallback edge — at any depth — starts a new pass; passes with no leaves are no longer reported. Adds an example test for the scout/background/workhorse shape plus a no-boundary control. Real config still passes, now reporting the transitive passes (scout fallback via background -> workhorse -> specialist, and the same under workhorse fallback via scout).
Example fixtures alone do not cover the reserve-order invariant, so add a seeded deterministic generator (mulberry32, no new dependency): 32 fixed seeds build route configs — pool permutations, selection modes, direct leaves including same-provider distinct models and direct OpenAI leaves, and transitive scout -> background -> workhorse fallback boundaries — and check them against an independent model computed from the generated spec (expected passes + reserve verdicts + exact violation texts). Negative control: the generated test and the transitive-boundary example test both fail against the pre-fix checker (9/11 pass), and all 11 pass with the fix. Generator stats: 17/32 seeds yield violations (22 total), 12/32 hit the transitive boundary, 27/32 have unordered passes, 134 passes checked in ~50ms.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ce87d87d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ordered[leaf.pool] = leaf.ordered && (ordered[leaf.pool] ?? true); | ||
| backed[leaf.pool] = openaiBacked[leaf.pool] ?? false; | ||
| } | ||
| const orderedSeq = pools.filter((pool) => ordered[pool]); |
There was a problem hiding this comment.
Preserve outer ordering around unordered subroutes
For an ordered tier with targets [sol-plan, relief], where relief is a weighted route containing non-OpenAI pool routes such as spark-plan and haiku-plan, this filter removes both relief pools and reports reserve: pass. Their internal order is unknown, but their position after Sol is guaranteed: resolveRoute in bin/opencode-route-proxy.mjs:826–838 reorders each route's own targets and recursively expands them before advancing to the next parent target. Thus OpenAI is deterministically consumed before non-OpenAI capacity in this configuration, yet the guard silently approves it. Preserve the ordered relationship between sibling subtrees while treating only the ordering within the weighted subtree as unknown.
Useful? React with 👍 / 👎.
Summary
Closes nothing yet — this is the next slice of #1173 (daily model + route audit). It automates the one pool-ordering rule that is decidable from the tracked config alone: OpenAI as final reserve. New checker
bin/check-pool-ordering.mjsresolves each tier's effective pool order (reusinginspectRouteRules) and verifies that, in every ordered chain, an OpenAI-backed pool comes last, with fallback targets checked as separate passes (a tier's regular chain runs first and completely; each fallback is a second pass). Weighted/round-robin mixing is reported as a note (no reserve encoding is visible there), never a finding. Fixtures + the canonical-config check are wired intoopencode-config-guard.Rule reading decided in this slice (decision record on #1173): "final reserve" applies to ordered chains; in weighted/round-robin routes list position is not burn order, so mixing there is unknown, not a violation. Burn-by-expiry and cheapest-sufficient are NOT checked here — the tracked config carries no machine-readable expiry/cost fields, and the decided source for them (the #1270 plan store, per the 2026-11-16 triage) is not in this repo. That wiring is the named next slice.
Evidence
Before (on
origin/main, no checker exists):node bin/check-pool-ordering.mjs .opencode/opencode.jsonc— file does not exist; pool ordering was a by-hand step in the audit block.After (this branch, commit
8f9affa2c, local run, no Rust involved):node --test bin/check-pool-ordering.test.mjs— 6 pass, 0 fail. The violation fixture (ordered chain with the OpenAI-backed pool before a non-OpenAI pool) fires; the fallback-pass and weighted-mixing fixtures prove the pass split and the note-not-finding treatment.node --test bin/*.test.mjs— 336 pass, 0 fail (full bin suite, incl. the route-rules, catalog-sync/snapshot, and metered-provider fixtures).node bin/check-pool-ordering.mjs .opencode/opencode.jsonc— exit 0, 0 issues. Reserve verdicts: specialist pass (sol-plan last), summit pass (sol-plan last in the main chain), scout/workhorse n/a-or-pass per pass. Two notes, both the same underlying fact:luna-effort-rrsharesworkhorse-weighted(weighted) with non-OpenAI pools at equal/default weight — no reserve encoding is visible; needs the feat(quota-plane): plan-store / tracker / measured reconciliation diff (daily) #1270 plan store.bash .github/scripts/check-suite-registry.sh— no entry needed; the new test file is covered by the existingbin/*.test.mjsglob.python3 -c yaml.safe_load).Evidence level: ran locally in the sandbox at
8f9affa2c(pure Node, no compile). The guard workflow runs nightly + on dispatch, not on PRs, so CI on this PR does not execute the new steps; the first nightly after merge is the CI run.Merge Danger
Low. Additive only: two new files under
bin/plus two steps inopencode-config-guard.yml. No config change (the canonical config passes as-is), no routing behavior change, no dependency on the #1270 store yet. Revert is deleting the two files and the two workflow steps.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.