fix(core): preserve routing rejection explanations - #1
Open
robinbraemer wants to merge 2 commits into
Open
Conversation
robinbraemer
force-pushed
the
fix/selection-explanations
branch
from
July 30, 2026 15:43
a1d0206 to
b6edce3
Compare
robinbraemer
force-pushed
the
fix/selection-explanations
branch
from
July 30, 2026 19:43
b6edce3 to
3c26867
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Make codex-router the reusable routing source of truth for AgentOS without losing observability. Preserve the router's already-computed per-account ineligibility explanations in its typed NoEligibleAccountsError so AgentOS can report exact quota, health, block, and reauthentication rejection reasons without duplicating selection policy. Keep the change bounded to the Effect-based core contract and tests, preserve current routing behavior, and deliver it as a merge-ready reviewed PR with full repository checks and CI.
What Changed
CandidateExplanationarray inNoEligibleAccountsErrorfor both no-eligible selection paths.Risk Assessment
✅ Low: The change is narrowly scoped and correctly carries the computed candidate explanations through the typed core error without altering successful routing behavior.
Testing
The missing local dependency was restored, focused selection and routing tests were exercised, the typed-error test was expanded to cover all relevant rejection categories, and a reviewer-visible JSON artifact was captured. No actionable findings remain.
Evidence: Selection explanation payload
NoEligibleAccountsError preserved 7 exact per-account rejection reasons across reauthentication, block, usage, and quota cases.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bun install --frozen-lockfilebun test packages/core/test/selection.test.tsbun test packages/core/test/selection.test.ts packages/core/test/routing.test.tsManual core API invocation producingNoEligibleAccountsErrorJSON✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.