feat(control-plane): expose route decision explanations - #1016
Draft
Wibias wants to merge 10 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 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-09 of the Router Intelligence / Routing Control Plane programme. Exposes
why-this-route explanations from the durable trace + attempt history:
GET /api/request-history/:requestId/route-decision- requested model,route kind, profile + revision, requirements, candidates with exclusions
and score components, selected candidate + tie-break, actual attempt
sequence, and final outcome.
GET /api/routing-profiles(RI-04) andPOST /api/routing-profiles/dry-runremain the profile inspection surfaces; the dry-run endpoint now also
assembles canonical capability/health/quota/cost evidence when no candidate
evidence is supplied ("evaluate" mode).
ocx logs explain <request-id>andocx route policy evaluate <profile>(an alias of dry-run with auto-evidence).The API returns stable structured codes + display-ready summaries - never
localized prose as the only contract.
Scope
src/server/management/request-history-routes.ts- the/route-decisionsubroute (checked before the generic:requestIdbranch): merges the persisted RI-01 trace, the execution
attempts[], anda summary/outcome block. Pre-trace rows answer with
routeDecision: nulland their attempts/outcome (honest, not fabricated).
src/server/management/routing-profile-routes.ts- dry-run auto-evidence:candidatesomitted -> canonical capability (catalog/registry/native),health (index), quota (caches), cost (price model + profile limit)
evidence per profile candidate.
src/cli/observe.ts-ocx logs explain <id> [--json].src/cli/route-policy.ts-ocx route policy evaluate <id> [--json].tests/route-explainability.test.ts- 4 tests.Privacy / security
usage entry: no prompts, credentials, or raw responses.
bun run privacy:scanpasses.Compatibility
/api/logsand/api/request-historyunchanged.
Dependency
feat(routing): add cost-aware policy scoring and limits #1015). Branch base:
feat/ri-08-cost-aware-routinghead66ae44aca.Non-goals
Local verification (exact)
bun x tsc --noEmit-> PASSED (0 errors)bun run test tests/route-explainability.test.ts-> 4/4 passbun run privacy:scan-> passed