feat(routing): add validated routing policy profiles - #1011
Draft
Wibias wants to merge 5 commits into
Draft
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This was referenced Aug 4, 2026
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.
Summary
RI-04 of the Router Intelligence / Routing Control Plane programme. Adds the
routing policy profile core: a validated top-level
routingProfilesconfig schema, deterministic normalization + revision digest, collision
validation, a dry-run evaluator, management API, CLI, and documentation.
Policy routing is inert in this PR: no production request uses a profile
yet (that is RI-05). Everything here is configuration, evaluation-on-demand,
and dry-run.
Scope
src/types.ts-OcxRoutingProfileConfig(candidates allowlist, alias,require,optimize,limits,unknownEvidence) +routingProfilesonOcxConfig.src/routing/profile.ts- validation (routingProfileIssues), aliascollision rules (providers, combos, codex account namespaces, sibling
profiles, reserved native families,
policy/+combo/namespaces),normalization (
normalizeRoutingProfile), SHA-256 revision digest(16-hex),
resolvePolicyProfileId/parsePolicyModelId/policyPublicModelId.src/routing/evaluator.ts- deterministic dry-run evaluator: hardcapability requirements (min context window, tools, image input, structured
output, reasoning effort, service tier, local/remote, encrypted Codex
tasks) are evaluated against supplied evidence; unknown-capability handling
follows the profile's
unknownEvidence; scoring is deterministicconfigured priority only (capability/health/quota/cost components arrive
with RI-05..08). Produces a full RI-01 decision trace with
profile.id/profile.revision.src/config.ts-routingProfilesvalidated insidevalidateConfigCandidate(broken profiles fail closed like broken combos).GET /api/routing-profiles,POST /api/routing-profiles/dry-run.ocx route policy list | show <id> | dry-run <id> --model-context <tokens> --tools [--image] [--structured-output].routingProfilesschemaand the combos-vs-profiles distinction (locale sync completes in RI-10).
tests/routing-profile.test.ts- 12 tests.Unknown is not zero
unknownEvidenceper profile controls unknown capability evidence:exclude(default),penalize, orallow. Unknown prices/health/quota stayunknown; nothing converts unknown to zero or free.
No implicit routing
Existing model ids, combos, account namespaces, and default-provider
resolution are byte-for-byte unchanged. Profiles only activate for an
explicitly requested
policy/<id>or alias (RI-05 wires execution).Compatibility
routingProfilesload unchanged./api/logs,/api/request-history,/api/routing-analyticsunchanged.
Privacy / security
bun run privacy:scanpasses.Dependency
feat/ri-03-routing-analyticshead2069e724e.Non-goals
Local verification (exact)
bun x tsc --noEmit-> PASSED (0 errors)bun run test tests/routing-profile.test.ts-> 12/12 passbun run privacy:scan-> passedtests/config.test.ts: 109/115 pass; the 6 symlink failures reproduceidentically on the pristine base (Windows symlink EPERM, environmental)
Notes for reviewers
tests):
optimize: { latency: 1, cost: 3 }merges health 0.25 and quota0.1 before normalizing (sum 4.35).
JSON), so configs that differ only in formatting share a revision.