fix(stage-router): warn when capable-first cannot offload via scorer - #711
ting-hong-shieh wants to merge 2 commits into
Conversation
Signed-off-by: Ting-Hong Shieh <32212900+ting-hong-shieh@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughChangesStage threshold behavior
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The warning and documentation changes are ready to merge; no concrete regressions remain identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. (1 skipped: 1 unsupported.)
A rabbit reads each line, Comment |
Signed-off-by: Ting-Hong Shieh <32212900+ting-hong-shieh@users.noreply.github.com>
|
++ @sabhatinas for review |
What
Warn when a
capable_firststage router uses a confidence threshold that prevents the scorer from selecting the efficient tier. For example,0.5exceeds the efficient confidence ceiling of approximately0.462117.The warning runs when
StageClassifieris constructed, covering the runner and Python bindings without logging on each request. It computes the ceiling through the existing scorer and uses the picker's closed probability band, including the exact boundary. Routing behavior is unchanged: hard de-escalation and an optional LLM classifier can still select efficient.The documentation explains this limit and scopes the
0.5recommendation toefficient_first.Why
Closes #264.
The current TOML schema requires an explicit threshold, but
capable_firstwith0.5still silently disables scorer-driven offloading. This implements the issue's warning option without changing scoring weights or introducing new public APIs.Notes for reviewers
Start with
StageClassifier::newincrates/libsy/src/algorithms/util/stage.rs. One regression test checks warning output and picker behavior at0.45, the exact ceiling, and0.5, plus the hard de-escalation escape path.Validation:
cargo test --workspace: 757 passed, 1 ignored before the test-only mutex cleanup;cargo test -p switchyard-libsy: 289 passed after it.cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --all --check: passed.uv run ruff check .: passed;uv run pytest tests/: 116 passed, 2 skipped.Validation used the project's Python 3.14 interpreter for PyO3 and allowed local ports for mock HTTP servers. No live model benchmark was run;
0.45is documented as below the ceiling, not as a calibrated recommendation.Summary by CodeRabbit
New Features
capable_firstmode when production scoring cannot reach the configured confidence threshold for efficient selection.Documentation
0.5threshold applies toefficient_first.