Skip to content

feat: productize model routing with operator docs, config validation, and formal spec#452

Merged
yacosta738 merged 6 commits into
mainfrom
feature/dallay-173-productize-model-routing
Apr 7, 2026
Merged

feat: productize model routing with operator docs, config validation, and formal spec#452
yacosta738 merged 6 commits into
mainfrom
feature/dallay-173-productize-model-routing

Conversation

@yacosta738
Copy link
Copy Markdown
Contributor

Summary

Productize the existing model routing and query classification system with
operator-facing documentation, config validation hardening, improved warning
logs, and a formal behavioral specification.
The routing engine itself is unchanged — all changes are additive.

What's included

Operator documentation

  • EN guide: guides/model-routing.md
  • ES guide: es/guides/model-routing.md
  • Sidebar entry in astro.config.mjs
  • Lightweight docs content tests

Config validation (doctor checks)

  • Orphaned classification hints (rule references non-existent route)
  • Classification enabled with zero rules
  • Classification enabled with zero model routes
  • Never-matching rules (empty keywords AND empty patterns)
  • All checks emit warnings only, never errors

Warning log improvements

  • Unknown hint fallback now logs hint name and raw fallback model
  • Failed provider init now logs provider name and affected route hints

Formal specification

  • openspec/specs/model-routing/spec.md with Given/When/Then scenarios
  • Covers route resolution, classification, fallback behavior, image routing gating

SDD artifacts

  • Full SDD cycle archived: explore → propose → spec → design → tasks → apply → verify → archive
  • Next-stage routing exploration (DALLAY-174) with documented decisions

Testing

  • 7 new doctor check tests (TDD: RED → GREEN)
  • 2 new warning log tests with tracing capture
  • 2 new default-model fallback tests
  • All 3472 existing Rust tests pass
  • Docs astro check: 0 errors

Issues

Closes #269
Refs: DALLAY-173, DALLAY-174, DALLAY-175

- Add formal routing behavior spec at openspec/specs/model-routing/spec.md
- Archive completed productize-model-routing SDD change
- Add next-stage-routing-capabilities exploration (DALLAY-174)

Refs: DALLAY-173, DALLAY-174, DALLAY-175
- Add EN guide at guides/model-routing.md
- Add ES guide at es/guides/model-routing.md
- Add guide to docs sidebar in astro.config.mjs
- Add lightweight docs content tests

Closes #269
…ements

- Add check_classification_integrity doctor checks:
  orphaned hints, zero rules, zero routes, never-matching rules
- Improve unknown-hint fallback warning with hint name and model
- Improve failed-provider warning with affected route hints
- Add targeted tests for all new checks and warning paths
- Add default-model fallback tests for disabled/no-match classification

Refs: DALLAY-173
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 7, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds operator-facing model-routing and query-classification docs (EN/ES), warning-only doctor validation for classification↔route integrity, enhanced structured tracing warnings in router/provider init, test helpers for capturing tracing events, and multiple unit/integration tests; all changes are additive and focused on docs/tests/diagnostics.

Changes

Cohort / File(s) Summary
Runtime Agent Tests
clients/agent-runtime/src/agent/agent.rs
Added build_classification_test_agent(...) test helper and two unit tests validating Agent::classify_model falls back to the default model when classification is disabled or no rule matches.
Doctor Validation
clients/agent-runtime/src/doctor/mod.rs
Added check_classification_integrity called from check_config_semantics; emits Warn diagnostics for empty rules/routes, orphaned/empty rule hints, and rules with neither keywords nor patterns. Added unit tests covering warnings and valid config silence.
Provider Initialization & Router
clients/agent-runtime/src/providers/mod.rs, clients/agent-runtime/src/providers/router.rs
When a non-primary routed provider fails init, tracing::warn! now includes structured affected_routes (hints); router unknown-hint warning now includes fallback_model structured field and updated message text. Tests added to assert structured fields and absence of warnings on success.
Tracing Test Support
clients/agent-runtime/src/test_support.rs, clients/agent-runtime/src/lib.rs
Added test-only tracing_capture module with capture_tracing_events and CapturedTracingEvent to capture structured tracing events during tests; moved test_support module declaration location in lib.rs.
Docs Site & Tests
clients/web/apps/docs/astro.config.mjs, clients/web/apps/docs/src/content/docs/guides/model-routing.md, clients/web/apps/docs/src/content/docs/es/guides/model-routing.md, scripts/model-routing-docs.test.mjs, .github/workflows/docs-quality.yml
Added canonical EN/ES model-routing guide and sidebar entry; Node test to validate doc content added and integrated into docs-quality workflow to run on CI.
OpenSpec / Design / Tasks / Verify
openspec/specs/model-routing/spec.md, openspec/changes/archive/2026-04-07-productize-model-routing/*, openspec/changes/next-stage-routing-capabilities/...
Added formal spec, design, proposal, exploration, tasks, state, and verification report files describing Phase 1 productization, acceptance criteria, and test/coverage evidence.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • Issue #271: Implements the operator docs, doctor validation checks, and runtime warning/observability improvements requested by this issue.

Suggested labels

area:rust, area:docs, area:web, risk:high

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning PR title exceeds the 72-character maximum limit (85 characters) specified in the requirements. Shorten the title to 72 characters or less while preserving the key message, e.g.: 'feat: productize model routing with docs, validation, and spec'
Docstring Coverage ⚠️ Warning Docstring coverage is 72.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed PR description covers all key sections: summary, what's included, testing, and issue references. All template sections are addressed.
Linked Issues check ✅ Passed All objectives from issue #269 are met: operator documentation (EN/ES guides), config validation (orphaned hints, empty rules/routes, never-match rules), warning log improvements, formal specification, and SDD artifacts with next-stage exploration.
Out of Scope Changes check ✅ Passed All changes align with issue #269 objectives: operator docs, doctor validation checks, warning logging, specification, and SDD artifacts. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/dallay-173-productize-model-routing

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

✅ Contributor Report

User: @yacosta738
Status: Passed (12/13 metrics passed)

Metric Description Value Threshold Status
PR Merge Rate PRs merged vs closed 89% >= 30%
Repo Quality Repos with ≥100 stars 0 >= 0
Positive Reactions Positive reactions received 10 >= 1
Negative Reactions Negative reactions received 0 <= 5
Account Age GitHub account age 3084 days >= 30 days
Activity Consistency Regular activity over time 108% >= 0%
Issue Engagement Issues with community engagement 0 >= 0
Code Reviews Code reviews given to others 529 >= 0
Merger Diversity Unique maintainers who merged PRs 2 >= 0
Repo History Merge Rate Merge rate in this repo 91% >= 0%
Repo History Min PRs Previous PRs in this repo 206 >= 0
Profile Completeness Profile richness (bio, followers) 90 >= 0
Suspicious Patterns Spam-like activity detection 1 N/A

Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-04-07 to 2026-04-07

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/agent-runtime/src/doctor/mod.rs`:
- Around line 289-297: The integrity check currently skips rules with empty
hints; change the condition so an empty hint is reported as a diagnostic:
replace the guard "if !rule.hint.is_empty() &&
!route_hints.contains(&rule.hint.as_str())" with logic that triggers when the
hint is empty or when it doesn't match route_hints (e.g., "if
rule.hint.is_empty() || !route_hints.contains(&rule.hint.as_str())"), and adjust
the DiagItem::warn message (in the same block) to handle the empty-hint case so
it clearly reports an empty or orphaned classification hint.

In `@clients/agent-runtime/src/providers/mod.rs`:
- Around line 993-1074: The tracing-capture harness (CaptureLayer,
CapturedTracingEvent, TracingFieldRecorder, capture_tracing_events and related
impls) is duplicated and should be extracted to a shared test support module:
create a new test-only module (e.g., tests/support/tracing_capture or a
crate::test_utils::tracing_capture) containing those types and functions, make
them pub (or pub(crate) for test use), remove the duplicate definitions from
providers/mod.rs and clients/agent-runtime/src/providers/router.rs, and update
both places to import and call the shared symbols (CaptureLayer,
CapturedTracingEvent, TracingFieldRecorder, capture_tracing_events). After
moving, run cargo test and fix any visibility or path imports.

In `@clients/web/apps/docs/src/content/docs/es/guides/model-routing.md`:
- Around line 211-214: Update the invalid Anthropic model ID in the
[[model_routes]] block by replacing model = "claude-sonnet-4-20250514" with the
correct model name model = "claude-sonnet-4-6" (update this in both the English
and Spanish docs where the [[model_routes]] section appears).

In `@openspec/changes/archive/2026-04-07-productize-model-routing/design.md`:
- Around line 103-104: Replace brittle line-number references with
function/method names: change the first entry to reference the tracing::warn!
inside RouterProvider::resolve (so it reads "Enhance existing tracing::warn! in
RouterProvider::resolve to include the fallback model name") and change the
second entry to reference the provider initialization routine (e.g.,
ProviderManager::initialize or init_provider) so it reads "Add route-impact
warning in ProviderManager::initialize when a non-primary routed provider fails
init" — this makes the design note resilient to line shifts while still pointing
to RouterProvider::resolve and the provider init function.
- Around line 66-89: The fenced diagram block in design.md lacks a language
identifier which can cause inconsistent rendering; update the triple-backtick
fence that wraps the ASCII data flow diagram (the block starting with "User
Message" and containing classify(config, message) and
RouterProvider.resolve(model)) to include a language tag (e.g., ```text) so the
diagram renders consistently across markdown processors.

In `@openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md`:
- Line 1: The first line uses a second-level heading "## Exploration: Productize
Model Routing and Query Classification" but should be a top-level heading to
satisfy MD041; update that exact heading string to use a single leading "#"
(i.e., change "## Exploration: ..." to "# Exploration: ...") so the document
starts with a top-level heading and maintains consistent archive structure.

In
`@openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md`:
- Line 1: Change the top-level heading from H2 to H1 by replacing "##
Verification Report" with "# Verification Report"; ensure fenced code blocks at
the locations corresponding to lines 23, 28, 33, and 42 are each surrounded by a
blank line before and after the ``` fences (add or remove adjacent content so
there's an empty line above the opening ``` and below the closing ```); and add
a final trailing newline at the end of the file so the file ends with a newline.

In `@openspec/specs/model-routing/spec.md`:
- Around line 369-374: Update the "Unknown hint falls back with warning"
scenario to explicitly state that the router will use the default provider and
model but will preserve and pass the raw selector (e.g., "hint:unknown") to
downstream components; also require a warning log that names the unknown hint.
Reference the scenario title "Unknown hint falls back with warning" and the raw
selector example "hint:unknown" so the spec aligns with the routing contract
described around the raw selector behavior (lines referencing the raw selector).

In `@scripts/model-routing-docs.test.mjs`:
- Around line 1-54: The CI is missing a step to execute the model-routing docs
tests (script model-routing-docs.test.mjs) so regressions won't be caught;
update the docs-quality.yml workflow to add a job step that runs the test script
(e.g., a step named "Validate model routing docs content" that runs the Node
script via node model-routing-docs.test.mjs) so the test suite defined by the
readText function and the tests/assert.match blocks in
model-routing-docs.test.mjs are executed in CI.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 620094d9-fb6f-43bd-a7a9-2ca7d64785b6

📥 Commits

Reviewing files that changed from the base of the PR and between 668c9b9 and 8afaee0.

📒 Files selected for processing (17)
  • clients/agent-runtime/src/agent/agent.rs
  • clients/agent-runtime/src/doctor/mod.rs
  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/providers/router.rs
  • clients/web/apps/docs/astro.config.mjs
  • clients/web/apps/docs/src/content/docs/es/guides/model-routing.md
  • clients/web/apps/docs/src/content/docs/guides/model-routing.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/design.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/proposal.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/specs/model-routing/spec.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/state.yaml
  • openspec/changes/archive/2026-04-07-productize-model-routing/tasks.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md
  • openspec/changes/next-stage-routing-capabilities/exploration.md
  • openspec/specs/model-routing/spec.md
  • scripts/model-routing-docs.test.mjs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: sonar
  • GitHub Check: pr-checks
  • GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (6)
**/*

⚙️ CodeRabbit configuration file

**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.

Files:

  • clients/web/apps/docs/astro.config.mjs
  • clients/agent-runtime/src/providers/mod.rs
  • openspec/changes/archive/2026-04-07-productize-model-routing/state.yaml
  • clients/web/apps/docs/src/content/docs/guides/model-routing.md
  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/agent/agent.rs
  • openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md
  • scripts/model-routing-docs.test.mjs
  • openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md
  • clients/agent-runtime/src/doctor/mod.rs
  • openspec/changes/archive/2026-04-07-productize-model-routing/design.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/tasks.md
  • openspec/changes/next-stage-routing-capabilities/exploration.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/proposal.md
  • clients/web/apps/docs/src/content/docs/es/guides/model-routing.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/specs/model-routing/spec.md
  • openspec/specs/model-routing/spec.md
clients/agent-runtime/src/providers/**/*.rs

📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)

Implement Provider trait in src/providers/ and register in src/providers/mod.rs factory when adding a new provider

Files:

  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/providers/router.rs
clients/agent-runtime/src/**/*.rs

📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)

clients/agent-runtime/src/**/*.rs: Never log secrets, tokens, raw credentials, or sensitive payloads in any logging statements
Avoid unnecessary allocations, clones, and blocking operations to maintain performance and efficiency

Files:

  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/agent/agent.rs
  • clients/agent-runtime/src/doctor/mod.rs
clients/agent-runtime/**/*.rs

📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)

Run cargo fmt --all -- --check, cargo clippy --all-targets -- -D warnings, and cargo test for code validation, or document which checks were skipped and why

Files:

  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/agent/agent.rs
  • clients/agent-runtime/src/doctor/mod.rs
**/*.rs

⚙️ CodeRabbit configuration file

**/*.rs: Focus on Rust idioms, memory safety, and ownership/borrowing correctness.
Flag unnecessary clones, unchecked panics in production paths, and weak error context.
Prioritize unsafe blocks, FFI boundaries, concurrency races, and secret handling.

Files:

  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/agent/agent.rs
  • clients/agent-runtime/src/doctor/mod.rs
**/*.{md,mdx}

⚙️ CodeRabbit configuration file

**/*.{md,mdx}: Verify technical accuracy and that docs stay aligned with code changes.
For user-facing docs, check EN/ES parity or explicitly note pending translation gaps.

Files:

  • clients/web/apps/docs/src/content/docs/guides/model-routing.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/design.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/tasks.md
  • openspec/changes/next-stage-routing-capabilities/exploration.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/proposal.md
  • clients/web/apps/docs/src/content/docs/es/guides/model-routing.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/specs/model-routing/spec.md
  • openspec/specs/model-routing/spec.md
🧠 Learnings (5)
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider

Applied to files:

  • clients/agent-runtime/src/providers/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Preserve CLI contract unless change is intentional and documented; prefer explicit errors over silent fallback for unsupported critical paths

Applied to files:

  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/agent/agent.rs
  • clients/agent-runtime/src/doctor/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/*.rs : Run `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test` for code validation, or document which checks were skipped and why

Applied to files:

  • clients/agent-runtime/src/agent/agent.rs
  • openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md
  • clients/agent-runtime/src/doctor/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/{security,gateway,tools,config}/**/*.rs : Do not silently weaken security policy or access constraints; keep default behavior secure-by-default with deny-by-default where applicable

Applied to files:

  • clients/agent-runtime/src/doctor/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Include threat/risk notes and rollback strategy for security, runtime, and gateway changes; add or update tests for boundary checks and failure modes

Applied to files:

  • openspec/changes/archive/2026-04-07-productize-model-routing/design.md
🪛 LanguageTool
clients/web/apps/docs/src/content/docs/guides/model-routing.md

[style] ~41-~41: To elevate your writing, try using more formal phrasing here.
Context: ...ck to the default provider. The runtime keeps working, but it logs a warning so you can fix t...

(CONTINUE_TO_VB)

openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md

[style] ~169-~169: Consider an alternative to strengthen your wording.
Context: ...y discoverable - Cons: Larger scope, more changes across modules - Effort: High 3. **...

(CHANGES_ADJUSTMENTS)

clients/web/apps/docs/src/content/docs/es/guides/model-routing.md

[grammar] ~13-~13: Elimina la puntuación
Context: ...nte clasificas mensajes hacia esos hints, y validas la configuración con `corvus ...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_PUNCTUATION)


[grammar] ~17-~17: Corrige la minúscula.
Context: ...tor`. Usa esta guía cuando quieras: - enviar prompts rápidos a un modelo más barato,...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~20-~20: Agrega un signo de puntuación.
Context: ...tas que acepten imágenes explícitamente. ## Qué hace el enrutamiento de modelos `[[mod...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~22-~22: Agrega un signo de puntuación.
Context: ...amente. ## Qué hace el enrutamiento de modelos [[model_routes]] mapea un hint a un provider y a un mode...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~24-~24: Corrige la minúscula.
Context: ...utamiento de modelos [[model_routes]] mapea un hint a un provider y a un modelo. ``...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~38-~38: Agrega un signo de puntuación.
Context: ... model = "o1-preview" ``` En tiempo de solicitud Corvus puede recibir un selector como `...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~41-~41: Corrige el error ortográfico.
Context: ...Si ninguna ruta coincide, Corvus cae al provider por defecto. El runtime sigue funcionan...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPELLING)


[grammar] ~42-~42: Agrega un signo de puntuación.
Context: ...ra que puedas corregir la configuración. ## Qué hace la clasificación de consultas `[q...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~44-~44: Agrega un signo de puntuación.
Context: ...ación. ## Qué hace la clasificación de consultas [query_classification] es opcional. Cuando está habilitada, ex...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~46-~46: Corrige la minúscula.
Context: ...n de consultas [query_classification] es opcional. Cuando está habilitada, examin...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~102-~102: Corrige la minúscula.
Context: ...soning, codeovision. - provider` debe coincidir con un provider que Corvus pue...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~103-~103: Corrige la minúscula.
Context: ...pueda inicializar. - allow_image_input es opt-in. Si lo omites, la ruta se trata c...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~116-~116: Elimina la puntuación
Context: ...de coincidir por keyword, patrón literal, o ambos. | Campo | Tipo | Requerido | ...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_PUNCTUATION)


[grammar] ~131-~131: Corrige la minúscula.
Context: ...alquier** pattern coincide. - keywords no distingue mayúsculas/minúsculas. - `patt...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~132-~132: Corrige la minúscula.
Context: ...ngue mayúsculas/minúsculas. - patterns sí distingue mayúsculas/minúsculas. - La pr...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~195-~195: Cambia la palabra o signo.
Context: ...nput = true`. ## Ejemplo: enrutamiento multi-provider con clasificación ```toml default_prov...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_OTHER)


[grammar] ~246-~246: Corrige la minúscula.
Context: ...n, Phase 1 añade estas advertencias: - clasificación habilitada pero sin reglas configuradas...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~258-~258: Agrega un signo de puntuación.
Context: ... nunca cambia el modelo seleccionado. | enabled = true pero rules está vacío. | Advertencia:...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~258-~258: Corrige la minúscula.
Context: ...pero rules está vacío. | Advertencia: la clasificación está habilitada pero no h...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~258-~258: Agrega un signo de puntuación.
Context: ...o. | Advertencia: la clasificación está habilitada pero no hay reglas configuradas. | Añad...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~258-~258: Aquí puede haber un error.
Context: ...na regla o desactiva la clasificación. | | La clasificación devuelve hints pero el...

(QB_NEW_ES)


[grammar] ~259-~259: Agrega un signo de puntuación.
Context: ...ficación. | | La clasificación devuelve hints pero el routing igual cae al provider p...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~259-~259: Aquí puede haber un error.
Context: ...na ruta real o añade la ruta faltante. | | Una regla nunca se dispara aunque la cl...

(QB_NEW_ES)


[grammar] ~260-~260: Aquí puede haber un error.
Context: ...keywords, patterns o elimina la regla. | | Los turnos con imágenes son rechazados....

(QB_NEW_ES)


[grammar] ~261-~261: Aquí puede haber un error.
Context: ...a ruta con allow_image_input = true. | | Un selector directo como hint:code no...

(QB_NEW_ES)


[grammar] ~262-~262: Aquí puede haber un error.
Context: ...re del hint o añade la ruta que falta. | | Una ruta parece válida en config pero f...

(QB_NEW_ES)


[grammar] ~263-~263: Agrega un signo de puntuación.
Context: ...ue falta. | | Una ruta parece válida en config pero falla en tiempo de solicitud. | Un...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~263-~263: Corrige el error ortográfico.
Context: ...pero falla en tiempo de solicitud. | Un provider no primario falló durante la inicializa...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPELLING)


[grammar] ~274-~274: Elimina la puntuación
Context: ...easoning, valídalas con corvus doctor`, y añade reglas de clasificación después...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_PUNCTUATION)

🪛 markdownlint-cli2 (0.22.0)
openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md

[warning] 1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)


[warning] 120-120: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 128-128: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 134-134: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 140-140: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 146-146: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 151-151: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 156-156: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md

[warning] 1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)


[warning] 23-23: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 28-28: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 33-33: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 42-42: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 149-149: Files should end with a single newline character

(MD047, single-trailing-newline)

openspec/changes/archive/2026-04-07-productize-model-routing/design.md

[warning] 66-66: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (24)
clients/web/apps/docs/astro.config.mjs (1)

173-179: Sidebar entry is correctly wired and localized.

The new guide link and Spanish translation follow the existing sidebar structure cleanly.

openspec/changes/archive/2026-04-07-productize-model-routing/state.yaml (1)

1-13: Archive state record is consistent and complete.

Phase progression and terminal next: none state are coherent.

clients/agent-runtime/src/providers/router.rs (1)

83-87: Warning enrichment and coverage look solid.

fallback_model is now captured in logs, and tests validate both emission and no-emission paths.

Also applies to: 503-552

clients/agent-runtime/src/providers/mod.rs (1)

752-760: Affected-route warning context is a good addition and is well tested.

The new affected_routes field materially improves operator diagnosis for partial provider init failures.

Also applies to: 1727-1818

clients/agent-runtime/src/agent/agent.rs (1)

3070-3130: Classification fallback tests are targeted and valuable.

These cases lock in the default-model contract for disabled and non-matching classification states.

clients/web/apps/docs/src/content/docs/guides/model-routing.md (1)

1-274: Guide is comprehensive and aligned with runtime behavior.

The routing/classification contract, fallback semantics, doctor warnings, and operator troubleshooting are clearly documented.

scripts/model-routing-docs.test.mjs (2)

9-12: Synchronous reads at module load time will throw on missing files.

This is actually fine for a test script—fast failure is desirable. Just noting that if file paths change, the test will error before any assertions run, giving clear feedback.


41-46: Spanish regex patterns match actual ES doc content correctly.

Verification confirms the Spanish documentation consistently uses "provider por defecto" (not "proveedor por defecto"), so the test regex /default provider|provider por defecto/i will match the actual content at lines 41, 82, 259, and 262 of the ES guide.

openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md (1)

100-117: Test coverage inventory is useful for tracking gaps.

The "Missing test coverage" section (lines 112-116) explicitly documents untested paths. This is valuable for follow-up work and aligns with the incremental productization approach.

openspec/changes/archive/2026-04-07-productize-model-routing/design.md (1)

235-244: Rollback strategy is well-documented.

Each deliverable can be reverted independently with no migration or data changes. This aligns with the learning about including rollback strategies for runtime changes. Based on learnings: "Include threat/risk notes and rollback strategy for security, runtime, and gateway changes."

openspec/changes/next-stage-routing-capabilities/exploration.md (2)

9-32: DALLAY-175 coverage verdict is well-evidenced.

The evidence table maps each acceptance criterion to specific delivered artifacts (docs, doctor checks, spec). This provides clear traceability for issue closure.


98-122: Sound security rationale for deferring managed route updates.

The analysis correctly identifies that a managed update API introduces new attack surface (who can change routes, approval flow, rollback). Keeping config-file-driven routing for v1.0.0 is the safer choice.

openspec/changes/archive/2026-04-07-productize-model-routing/tasks.md (1)

1-29: Task list is complete and well-structured.

All Phase 1 tasks are marked complete. The TDD approach (RED/GREEN/REFACTOR in 3.1-3.4) and targeted test strategy (4.1-4.2) are solid practices.

openspec/changes/archive/2026-04-07-productize-model-routing/proposal.md (2)

55-61: Risk assessment is pragmatic.

The risk table correctly identifies that doctor warnings on existing configs with orphaned hints are medium likelihood but mitigated by being warnings-only. No breaking changes means safe rollout.


63-72: Rollback plan enables independent reversion.

Each of the four deliverables (docs, doctor checks, warning logs, spec) can be reverted independently. This is good practice for additive changes.

clients/web/apps/docs/src/content/docs/es/guides/model-routing.md (3)

1-9: Frontmatter is correct and complete.

Standard metadata fields are present: title, description, owner, status, lastReviewed, appliesTo, docType. The lastReviewed date matches the PR date.


63-83: Hint flow diagram is clear and operator-friendly.

The text-based flow diagram explains the classification → routing → fallback path without exposing Rust internals. This aligns with the spec requirement that docs "MUST NOT expose internal implementation details."


254-263: Troubleshooting table covers all Phase 1 doctor warnings.

The table maps symptoms to causes, doctor output, and resolutions for:

  • Enabled without rules
  • Orphaned hints
  • Never-matching rules
  • Image rejection
  • Unknown hint fallback
  • Failed provider init

This aligns with the formal spec requirements.

openspec/changes/archive/2026-04-07-productize-model-routing/specs/model-routing/spec.md (4)

1-8: Spec header is well-structured.

Cross-reference to provider-vision-gating spec (REQ-6) establishes traceability for image routing gating requirements.


257-289: Route resolution contract is precise.

The four-point contract (lines 262-269) clearly defines:

  1. hint: prefix parsing
  2. Matched route dispatch
  3. Unknown hint fallback (with raw selector)
  4. Non-hint passthrough

Scenarios cover all paths with testable assertions.


392-426: Image routing gating aligns with provider-vision-gating spec.

The requirement correctly specifies:

  • allow_image_input defaults to false (opt-in)
  • Rejection with RouteNotImageCapable for non-image routes
  • Resolution via vision_model_hint

This complements REQ-6 from the cross-referenced spec.


101-108: Implementation correctly gates checks on classification.enabled.

The check_classification_integrity() function in doctor/mod.rs returns early when classification.enabled = false, skipping all integrity checks and warnings. This satisfies the spec requirement.

openspec/specs/model-routing/spec.md (2)

76-186: Doctor-check requirements are well aligned with runtime behavior.

The warning-only integrity checks and scenarios map cleanly to implementation behavior (zero rules, zero routes, orphaned hints, never-match rules).


189-247: Logging and image-gating contracts are precise and implementation-consistent.

These sections correctly capture warning-field intent and RouteNotImageCapable gating behavior without overexposing internals.

Also applies to: 392-426

Comment thread clients/agent-runtime/src/doctor/mod.rs Outdated
Comment thread clients/agent-runtime/src/providers/mod.rs Outdated
Comment thread clients/web/apps/docs/src/content/docs/es/guides/model-routing.md Outdated
Comment thread openspec/changes/archive/2026-04-07-productize-model-routing/design.md Outdated
Comment on lines +103 to +104
| `clients/agent-runtime/src/providers/router.rs` | Modify | Enhance existing `tracing::warn!` on line 83 to include the fallback model name |
| `clients/agent-runtime/src/providers/mod.rs` | Modify | Add route-impact warning when non-primary routed provider fails init (~line 752) |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Fragile line number references.

Lines 103-104 reference specific line numbers in source files (line 83, ~line 752). These will become stale as code evolves. Consider referencing function/method names instead:

"Enhance existing tracing::warn! in RouterProvider::resolve method..."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@openspec/changes/archive/2026-04-07-productize-model-routing/design.md`
around lines 103 - 104, Replace brittle line-number references with
function/method names: change the first entry to reference the tracing::warn!
inside RouterProvider::resolve (so it reads "Enhance existing tracing::warn! in
RouterProvider::resolve to include the fallback model name") and change the
second entry to reference the provider initialization routine (e.g.,
ProviderManager::initialize or init_provider) so it reads "Add route-impact
warning in ProviderManager::initialize when a non-primary routed provider fails
init" — this makes the design note resilient to line shifts while still pointing
to RouterProvider::resolve and the provider init function.

Comment thread openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md Outdated
Comment thread openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md Outdated
Comment thread openspec/specs/model-routing/spec.md Outdated
Comment thread scripts/model-routing-docs.test.mjs
- Fix doctor empty-hint guard to also warn on empty classification hints
- Extract tracing capture harness to shared test_support module
- Fix Anthropic model ID (claude-sonnet-4-6) in EN/ES docs
- Replace brittle line-number refs with function names in design.md
- Add language tag to diagram fenced block in design.md
- Fix heading levels in exploration.md and verify-report.md
- Clarify raw selector preservation in spec unknown-hint scenario
- Add CI step for model-routing docs content tests

Refs: DALLAY-173
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 7, 2026

Deploying corvus with  Cloudflare Pages  Cloudflare Pages

Latest commit: b29f79e
Status: ✅  Deploy successful!
Preview URL: https://c17c33c5.corvus-42x.pages.dev
Branch Preview URL: https://feature-dallay-173-productiz.corvus-42x.pages.dev

View logs

@coderabbitai coderabbitai Bot added area:ci and removed area:rust labels Apr 7, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/web/apps/docs/src/content/docs/guides/model-routing.md`:
- Line 30: Replace the incorrect model identifier "qwen-qwq-32b" with the
correct Groq model name "qwen/qwen3-32b" where it's referenced (the string value
assigned to model on line containing "qwen-qwq-32b"); keep other model
references such as "llama-3.3-70b-versatile" unchanged.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1e579af4-124a-41c7-91ea-a4edcb20a098

📥 Commits

Reviewing files that changed from the base of the PR and between 8afaee0 and e157bd7.

📒 Files selected for processing (12)
  • .github/workflows/docs-quality.yml
  • clients/agent-runtime/src/doctor/mod.rs
  • clients/agent-runtime/src/lib.rs
  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/test_support.rs
  • clients/web/apps/docs/src/content/docs/es/guides/model-routing.md
  • clients/web/apps/docs/src/content/docs/guides/model-routing.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/design.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md
  • openspec/specs/model-routing/spec.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: sonar
  • GitHub Check: pr-checks
  • GitHub Check: submit-gradle
  • GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (6)
clients/agent-runtime/src/providers/**/*.rs

📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)

Implement Provider trait in src/providers/ and register in src/providers/mod.rs factory when adding a new provider

Files:

  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/providers/mod.rs
clients/agent-runtime/src/**/*.rs

📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)

clients/agent-runtime/src/**/*.rs: Never log secrets, tokens, raw credentials, or sensitive payloads in any logging statements
Avoid unnecessary allocations, clones, and blocking operations to maintain performance and efficiency

Files:

  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/lib.rs
  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/doctor/mod.rs
  • clients/agent-runtime/src/test_support.rs
clients/agent-runtime/**/*.rs

📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)

Run cargo fmt --all -- --check, cargo clippy --all-targets -- -D warnings, and cargo test for code validation, or document which checks were skipped and why

Files:

  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/lib.rs
  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/doctor/mod.rs
  • clients/agent-runtime/src/test_support.rs
**/*.rs

⚙️ CodeRabbit configuration file

**/*.rs: Focus on Rust idioms, memory safety, and ownership/borrowing correctness.
Flag unnecessary clones, unchecked panics in production paths, and weak error context.
Prioritize unsafe blocks, FFI boundaries, concurrency races, and secret handling.

Files:

  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/lib.rs
  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/doctor/mod.rs
  • clients/agent-runtime/src/test_support.rs
**/*

⚙️ CodeRabbit configuration file

**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.

Files:

  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/lib.rs
  • clients/agent-runtime/src/providers/mod.rs
  • openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/design.md
  • clients/web/apps/docs/src/content/docs/guides/model-routing.md
  • clients/agent-runtime/src/doctor/mod.rs
  • clients/agent-runtime/src/test_support.rs
  • openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md
  • clients/web/apps/docs/src/content/docs/es/guides/model-routing.md
  • openspec/specs/model-routing/spec.md
**/*.{md,mdx}

⚙️ CodeRabbit configuration file

**/*.{md,mdx}: Verify technical accuracy and that docs stay aligned with code changes.
For user-facing docs, check EN/ES parity or explicitly note pending translation gaps.

Files:

  • openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/design.md
  • clients/web/apps/docs/src/content/docs/guides/model-routing.md
  • openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md
  • clients/web/apps/docs/src/content/docs/es/guides/model-routing.md
  • openspec/specs/model-routing/spec.md
🧠 Learnings (10)
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/.github/**/*.{yml,yaml} : For workflow/template-only changes, ensure YAML/template syntax validity

Applied to files:

  • .github/workflows/docs-quality.yml
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Preserve CLI contract unless change is intentional and documented; prefer explicit errors over silent fallback for unsupported critical paths

Applied to files:

  • clients/agent-runtime/src/providers/router.rs
  • clients/agent-runtime/src/lib.rs
  • clients/agent-runtime/src/providers/mod.rs
  • openspec/changes/archive/2026-04-07-productize-model-routing/design.md
  • clients/agent-runtime/src/doctor/mod.rs
  • clients/agent-runtime/src/test_support.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/*.rs : Run `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test` for code validation, or document which checks were skipped and why

Applied to files:

  • clients/agent-runtime/src/lib.rs
  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/doctor/mod.rs
  • clients/agent-runtime/src/test_support.rs
  • openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Do not add heavy dependencies for minor convenience; justify new crate additions

Applied to files:

  • clients/agent-runtime/src/lib.rs
  • clients/agent-runtime/src/test_support.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Preserve release-size profile assumptions in `Cargo.toml` and avoid adding heavy dependencies unless clearly justified

Applied to files:

  • clients/agent-runtime/src/lib.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/**/*.rs : Avoid unnecessary allocations, clones, and blocking operations to maintain performance and efficiency

Applied to files:

  • clients/agent-runtime/src/lib.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/{security,gateway,tools,config}/**/*.rs : Do not silently weaken security policy or access constraints; keep default behavior secure-by-default with deny-by-default where applicable

Applied to files:

  • clients/agent-runtime/src/lib.rs
  • clients/agent-runtime/src/doctor/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider

Applied to files:

  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/test_support.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/channels/**/*.rs : Implement `Channel` trait in `src/channels/` with consistent `send`, `listen`, and `health_check` semantics and cover auth/allowlist/health behavior with tests

Applied to files:

  • clients/agent-runtime/src/providers/mod.rs
  • clients/agent-runtime/src/test_support.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Include threat/risk notes and rollback strategy for security, runtime, and gateway changes; add or update tests for boundary checks and failure modes

Applied to files:

  • openspec/changes/archive/2026-04-07-productize-model-routing/design.md
🪛 GitHub Actions: Docs Quality
clients/web/apps/docs/src/content/docs/guides/model-routing.md

[error] 1-1: File read failed in scripts/model-routing-docs.test.mjs: ENOENT no such file or directory. Error: ENOENT: no such file or directory, open 'clients/web/apps/docs/src/content/docs/guides/model-routing.md'.

🪛 LanguageTool
openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md

[style] ~169-~169: Consider an alternative to strengthen your wording.
Context: ...y discoverable - Cons: Larger scope, more changes across modules - Effort: High 3. **...

(CHANGES_ADJUSTMENTS)

clients/web/apps/docs/src/content/docs/guides/model-routing.md

[style] ~41-~41: To elevate your writing, try using more formal phrasing here.
Context: ...ck to the default provider. The runtime keeps working, but it logs a warning so you can fix t...

(CONTINUE_TO_VB)

clients/web/apps/docs/src/content/docs/es/guides/model-routing.md

[grammar] ~13-~13: Elimina la puntuación
Context: ...nte clasificas mensajes hacia esos hints, y validas la configuración con `corvus ...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_PUNCTUATION)


[grammar] ~17-~17: Corrige la minúscula.
Context: ...tor`. Usa esta guía cuando quieras: - enviar prompts rápidos a un modelo más barato,...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~20-~20: Agrega un signo de puntuación.
Context: ...tas que acepten imágenes explícitamente. ## Qué hace el enrutamiento de modelos `[[mod...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~22-~22: Agrega un signo de puntuación.
Context: ...amente. ## Qué hace el enrutamiento de modelos [[model_routes]] mapea un hint a un provider y a un mode...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~24-~24: Corrige la minúscula.
Context: ...utamiento de modelos [[model_routes]] mapea un hint a un provider y a un modelo. ``...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~38-~38: Agrega un signo de puntuación.
Context: ... model = "o1-preview" ``` En tiempo de solicitud Corvus puede recibir un selector como `...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~41-~41: Corrige el error ortográfico.
Context: ...Si ninguna ruta coincide, Corvus cae al provider por defecto. El runtime sigue funcionan...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPELLING)


[grammar] ~42-~42: Agrega un signo de puntuación.
Context: ...ra que puedas corregir la configuración. ## Qué hace la clasificación de consultas `[q...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~44-~44: Agrega un signo de puntuación.
Context: ...ación. ## Qué hace la clasificación de consultas [query_classification] es opcional. Cuando está habilitada, ex...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~46-~46: Corrige la minúscula.
Context: ...n de consultas [query_classification] es opcional. Cuando está habilitada, examin...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~102-~102: Corrige la minúscula.
Context: ...soning, codeovision. - provider` debe coincidir con un provider que Corvus pue...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~103-~103: Corrige la minúscula.
Context: ...pueda inicializar. - allow_image_input es opt-in. Si lo omites, la ruta se trata c...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~116-~116: Elimina la puntuación
Context: ...de coincidir por keyword, patrón literal, o ambos. | Campo | Tipo | Requerido | ...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_PUNCTUATION)


[grammar] ~131-~131: Corrige la minúscula.
Context: ...alquier** pattern coincide. - keywords no distingue mayúsculas/minúsculas. - `patt...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~132-~132: Corrige la minúscula.
Context: ...ngue mayúsculas/minúsculas. - patterns sí distingue mayúsculas/minúsculas. - La pr...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~195-~195: Cambia la palabra o signo.
Context: ...nput = true`. ## Ejemplo: enrutamiento multi-provider con clasificación ```toml default_prov...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_OTHER)


[grammar] ~246-~246: Corrige la minúscula.
Context: ...n, Phase 1 añade estas advertencias: - clasificación habilitada pero sin reglas configuradas...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~258-~258: Agrega un signo de puntuación.
Context: ... nunca cambia el modelo seleccionado. | enabled = true pero rules está vacío. | Advertencia:...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~258-~258: Corrige la minúscula.
Context: ...pero rules está vacío. | Advertencia: la clasificación está habilitada pero no h...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_LOWERCASE)


[grammar] ~258-~258: Agrega un signo de puntuación.
Context: ...o. | Advertencia: la clasificación está habilitada pero no hay reglas configuradas. | Añad...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~258-~258: Aquí puede haber un error.
Context: ...na regla o desactiva la clasificación. | | La clasificación devuelve hints pero el...

(QB_NEW_ES)


[grammar] ~259-~259: Agrega un signo de puntuación.
Context: ...ficación. | | La clasificación devuelve hints pero el routing igual cae al provider p...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~259-~259: Aquí puede haber un error.
Context: ...na ruta real o añade la ruta faltante. | | Una regla nunca se dispara aunque la cl...

(QB_NEW_ES)


[grammar] ~260-~260: Aquí puede haber un error.
Context: ...keywords, patterns o elimina la regla. | | Los turnos con imágenes son rechazados....

(QB_NEW_ES)


[grammar] ~261-~261: Aquí puede haber un error.
Context: ...a ruta con allow_image_input = true. | | Un selector directo como hint:code no...

(QB_NEW_ES)


[grammar] ~262-~262: Aquí puede haber un error.
Context: ...re del hint o añade la ruta que falta. | | Una ruta parece válida en config pero f...

(QB_NEW_ES)


[grammar] ~263-~263: Agrega un signo de puntuación.
Context: ...ue falta. | | Una ruta parece válida en config pero falla en tiempo de solicitud. | Un...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_PUNCTUATION)


[grammar] ~263-~263: Corrige el error ortográfico.
Context: ...pero falla en tiempo de solicitud. | Un provider no primario falló durante la inicializa...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPELLING)


[grammar] ~274-~274: Elimina la puntuación
Context: ...easoning, valídalas con corvus doctor`, y añade reglas de clasificación después...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_PUNCTUATION)

🪛 markdownlint-cli2 (0.22.0)
openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md

[warning] 8-8: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

openspec/changes/archive/2026-04-07-productize-model-routing/design.md

[warning] 8-8: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🔇 Additional comments (24)
clients/agent-runtime/src/lib.rs (1)

77-78: LGTM!

Test-only module declaration is correctly gated with #[cfg(test)] and the reordering is purely organizational.

clients/agent-runtime/src/test_support.rs (1)

96-185: LGTM!

Well-designed test harness. Key observations:

  • Thread-local set_default works correctly since consuming tests are synchronous #[test] (not #[tokio::test])
  • parking_lot::Mutex is appropriate for the capture layer
  • Visit trait implementation covers all field types correctly

This addresses the prior review feedback about extracting duplicated tracing-capture utilities into a shared module.

openspec/changes/archive/2026-04-07-productize-model-routing/design.md (1)

1-7: LGTM!

Design document is well-structured with clear decision rationale. The data flow diagram now correctly uses the text language identifier (addressing prior feedback), and line-number references have been replaced with function/method names for resilience.

.github/workflows/docs-quality.yml (1)

68-69: LGTM!

CI step correctly validates model routing docs before the main docs build. Path traversal matches the working directory context.

clients/agent-runtime/src/providers/router.rs (2)

83-87: LGTM!

Enhanced warning now includes the raw fallback_model field, which aids debugging when operators misconfigure hints. The message text clarifies the fallback behavior.


423-472: LGTM!

Comprehensive test coverage for warning behavior:

  • Verifies structured fields (hint, fallback_model) are captured correctly
  • Confirms no spurious warnings for valid hints and non-hint selectors
  • Uses synchronous tests which correctly pair with thread-local set_default semantics
clients/agent-runtime/src/providers/mod.rs (2)

752-761: LGTM!

Enhanced warning now surfaces which route hints are impacted when a provider fails initialization. The affected_routes field provides actionable diagnostic information for operators. Computation only occurs on the error path, avoiding overhead in the happy case.


1646-1737: LGTM!

Tests thoroughly validate both positive and negative cases:

  • failed_routed_provider_warns_about_affected_routes: Verifies warning includes provider name and affected hint list
  • routed_provider_init_stays_quiet_when_all_providers_succeed: Confirms no false-positive warnings
clients/agent-runtime/src/doctor/mod.rs (2)

256-316: LGTM!

Comprehensive classification integrity validation covering:

  • Empty rules with classification enabled
  • Missing model_routes with classification enabled
  • Empty hint (addresses prior review feedback)
  • Orphaned hints with helpful "available" list
  • Never-matching rules (empty keywords AND patterns)

All checks emit warnings (not errors) preserving backward compatibility with existing configs.


920-1137: LGTM!

Thorough test coverage for all classification integrity warning scenarios, including the edge case where patterns are present without keywords (should not warn about never-matching).

openspec/changes/archive/2026-04-07-productize-model-routing/exploration.md (1)

1-6: LGTM!

Exploration document now correctly uses a top-level heading (addressing prior feedback). The document provides comprehensive inventory of the existing routing system and clearly identifies the product gaps being addressed by this PR.

clients/web/apps/docs/src/content/docs/guides/model-routing.md (3)

1-1: Pipeline failure resolved by file creation.

The docs quality check failed because it attempted to read this file before it was committed. Now that the file exists, the test should pass on the next run.


214-214: Anthropic model name is correct.

The model ID claude-sonnet-4-6 aligns with Anthropic's current naming convention as verified in the previous review.


236-272: Doctor validation and troubleshooting sections are comprehensive.

The guide correctly documents the Phase 1 warning-only checks and maps troubleshooting symptoms to resolutions. This aligns with the spec requirements and the doctor/mod.rs implementation.

openspec/changes/archive/2026-04-07-productize-model-routing/verify-report.md (3)

1-1: Markdown linting issues resolved.

The H1 heading fix from the previous review has been applied. The report now follows proper markdown structure.


22-58: Build and test evidence is well-structured.

The verification report documents formatter, clippy, test runs, and targeted behavioral tests. The format is clear and includes both baseline and targeted test coverage.


64-103: Spec compliance matrix provides comprehensive traceability.

All 35 scenarios map to specific test evidence in doctor/mod.rs, providers/router.rs, providers/mod.rs, agent/classifier.rs, channels/mod.rs, and scripts/model-routing-docs.test.mjs. This enables verification of the formal contract.

clients/web/apps/docs/src/content/docs/es/guides/model-routing.md (2)

214-214: Anthropic model name correction applied.

The invalid claude-sonnet-4-20250514 has been corrected to claude-sonnet-4-6 as recommended in the previous review.


1-274: EN/ES parity verified.

The Spanish guide maintains structural parity with the English version:

  • Same frontmatter metadata (lines 1-9)
  • Matching section structure (config reference, examples, troubleshooting)
  • Equivalent TOML examples with identical model/provider configurations
  • Parallel troubleshooting table covering the same diagnostic scenarios

Technical terminology is consistently translated (e.g., "enrutamiento" for routing, "clasificación" for classification, "hints" preserved as technical term).

As per coding guidelines, EN/ES parity is required for user-facing docs.

openspec/specs/model-routing/spec.md (5)

369-376: Unknown-hint fallback contract clarified.

The scenario now explicitly specifies that the raw selector (e.g., "hint:code") must be preserved and passed downstream as the model string (line 374). This resolves the ambiguity flagged in the previous review.


12-73: Operator documentation requirements are comprehensive.

The spec mandates:

  • Complete TOML config reference for all fields
  • Multiple example configurations (fast/reasoning, code, vision, multi-provider)
  • End-to-end hint flow explanation
  • Troubleshooting section covering common misconfigurations

These requirements map directly to the documentation guide content and are validated by scripts/model-routing-docs.test.mjs.


76-186: Config validation requirements align with doctor implementation.

The spec defines four warning-only checks:

  1. Classification rule hint integrity (orphaned hints)
  2. Classification enabled with zero rules
  3. Classification enabled with zero model routes
  4. Never-matching rules (empty keywords AND patterns)

Each requirement includes multiple scenarios with Given/When/Then structure, enabling verification through the test evidence in verify-report.md.


189-254: Silent failure fixes add observability without behavior change.

The unknown-hint fallback logging (lines 189-223) and failed provider init logging (lines 226-254) requirements correctly specify warning-level logs with structured fields (hint, fallback_model, provider, affected_routes) while preserving existing fallback behavior.


257-427: Formal contracts cover routing, classification, fallback, and image gating.

The specification formalizes:

  • Route resolution (hint prefix parsing, lookup, fallback)
  • Classification (priority ordering, length gating, keyword/pattern matching, case sensitivity)
  • Fallback behavior (unknown hint warns, no-match is silent, disabled uses default)
  • Image routing gating (vision_model_hint resolution, allow_image_input opt-in)

All contracts include testable scenarios that map to the compliance matrix in the verification report.

Comment thread clients/web/apps/docs/src/content/docs/guides/model-routing.md
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 7, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • clients/web/apps/docs/src/content/docs/guides/model-routing.md

Commit: b29f79e8bfb4e17c05c5529fa822a34cfc73c017

The changes have been pushed to the feature/dallay-173-productize-model-routing branch.

Time taken: 3m 1s

@coderabbitai coderabbitai Bot added area:rust and removed area:ci labels Apr 7, 2026
Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@yacosta738 yacosta738 enabled auto-merge (squash) April 7, 2026 16:40
@yacosta738 yacosta738 merged commit 8eb2b19 into main Apr 7, 2026
14 checks passed
@yacosta738 yacosta738 deleted the feature/dallay-173-productize-model-routing branch April 7, 2026 16:41
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 7, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Productize model routing and query classification for Corvus

2 participants