feat(router): add escalation_router profile with judge-latched strong/weak routing - #62
Conversation
|
WalkthroughAdds an escalation-router profile that starts requests on a weak tier, uses a trajectory judge for one-way escalation to a strong tier, persists decisions with session affinity, integrates YAML route bundles, exports configuration types, documents the behavior, and updates model pricing aliases. ChangesEscalation Router
Estimated code review effort: 4 (Complex) | ~60 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
4a16e3c to
c3ee920
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/test_escalation_router_profile.py (1)
105-124: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCoverage gap:
judge_timeout_snot asserted.This test threads several
judge_*settings but omitsjudge_timeout_s. Adding an override + assertion (e.g._config(judge_timeout_s=12.0)→judge._config.timeout_s == 12.0) would have surfaced the wiring gap flagged inescalation_router_profile_config.py.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_escalation_router_profile.py` around lines 105 - 124, Extend test_build_threads_judge_settings to pass a non-default judge_timeout_s value through _config, then assert the resulting judge._config.timeout_s matches it. Keep the existing judge settings and assertions unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/routing_algorithms/escalation_router_routing.md`:
- Line 73: Update the session_key_depth link and the corresponding heading
reference in the routing documentation so the link target matches the generated
Markdown slug for “Repeated-trial benchmarking (k>1)”. Ensure all references use
the same valid anchor and satisfy markdownlint MD051.
In `@docs/routing_algorithms/overview.md`:
- Around line 156-160: Update the escalation-router description to clarify that
the judge runs on every turn from EscalationJudgeConfig.min_judge_turn onward
until the latch fires, while earlier turns route weak without a judge call.
Preserve the existing affinity and strong-tier pinning behavior.
---
Nitpick comments:
In `@tests/test_escalation_router_profile.py`:
- Around line 105-124: Extend test_build_threads_judge_settings to pass a
non-default judge_timeout_s value through _config, then assert the resulting
judge._config.timeout_s matches it. Keep the existing judge settings and
assertions unchanged.
🪄 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: CHILL
Plan: Enterprise
Run ID: ae4d07e2-3bd2-4af8-b27e-66c159c6b73a
📒 Files selected for processing (15)
.agents/skills/switchyard-lib-core/SKILL.mdcrates/switchyard-components/src/stats/cost.rsdocs/routing_algorithms/escalation_router_routing.mddocs/routing_algorithms/overview.mdmkdocs.ymlswitchyard/__init__.pyswitchyard/cli/route_bundle.pyswitchyard/lib/cost_estimator.pyswitchyard/lib/processors/escalation_judge_request_processor.pyswitchyard/lib/profiles/__init__.pyswitchyard/lib/profiles/escalation_router_config.pyswitchyard/lib/profiles/escalation_router_profile_config.pytests/test_escalation_judge_request_processor.pytests/test_escalation_router_profile.pytests/test_route_bundle.py
9417102 to
5831550
Compare
ayushag-nv
left a comment
There was a problem hiding this comment.
This looks like a extension of LLM classifier or existing stage router. I suggest we should consider this as a design to extend our existing routers to accomodate this like we did for Session Pinning in the existing routers.
…/weak routing Signed-off-by: Lin Jia <linj@nvidia.com>
…neralization audit Signed-off-by: Lin Jia <linj@nvidia.com>
Signed-off-by: Lin Jia <linj@nvidia.com>
5831550 to
454bf19
Compare
Signed-off-by: Lin Jia <linj@nvidia.com>
…pt_path knob Signed-off-by: Lin Jia <linj@nvidia.com>
…eak bookkeeping Signed-off-by: Lin Jia <linj@nvidia.com>
…e routing guide Signed-off-by: Lin Jia <linj@nvidia.com>
…d; hoist deferred imports Signed-off-by: Lin Jia <linj@nvidia.com>
Signed-off-by: Lin Jia <linj@nvidia.com>
454bf19 to
7bc9a09
Compare
…ey_from_body via a depth param Signed-off-by: Lin Jia <linj@nvidia.com>
…ier, judge, and planner Signed-off-by: Lin Jia <linj@nvidia.com>
…rflow reroute lands on a registered tier Signed-off-by: Lin Jia <linj@nvidia.com>
…t accept it Signed-off-by: Lin Jia <linj@nvidia.com>
…ripts and deep-key hashing Signed-off-by: Lin Jia <linj@nvidia.com>
…bs; support a shared Redis latch store Signed-off-by: Lin Jia <linj@nvidia.com>
…g model owns every default Signed-off-by: Lin Jia <linj@nvidia.com>
…ween the deterministic and escalation routers Signed-off-by: Lin Jia <linj@nvidia.com>
…overflow reroute lands on a registered tier Signed-off-by: Lin Jia <linj@nvidia.com>
… escalation affinity store in the lib-core skill Signed-off-by: Lin Jia <linj@nvidia.com>
…ostics; single-source the judge timeout default Signed-off-by: Lin Jia <linj@nvidia.com>
Summary
Ports the escalation-router work from the private fork (branch
linj_router_exp) to the public repo.escalation_routerprofile with judge-latched strong/weak routing, including the escalation-judge request processor, profile configs, androute_bundleCLI support.switchyard/lib/cost_estimator.py,crates/switchyard-components/src/stats/cost.rs), and expanded tests.docs/routing_algorithms/escalation_router_routing.md) and registers them inmkdocs.yml.Note: changes under the
benchmark/folder from the original branch are intentionally excluded from this PR.Test plan
tests/test_escalation_judge_request_processor.pytests/test_escalation_router_profile.pytests/test_route_bundle.py🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation