docs(stage-router): correct the decision flow and rewrite threshold tuning - #288
docs(stage-router): correct the decision flow and rewrite threshold tuning#288sabhatinas wants to merge 3 commits into
Conversation
|
WalkthroughThe routing documentation now defines signed confidence scoring, capable and efficient routing bands, hard overrides, replay-based calibration, provider-specific configuration, handoff behavior, and startup logging requirements. ChangesStage router routing
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/stage_router_routing.md`:
- Around line 68-76: Update the Mermaid flowchart’s de-escalation decision to
require tests_passed, a recent write or edit, and severity <= 0.0 before
selecting the efficient tier. Update the classifier path so an invalid or absent
classifier tier falls through to the picker’s default fall_open tier, matching
the runtime behavior in the stage-router picker.
- Around line 200-204: Update the “Caveat on efficient outcomes” section to
remove the claim that stage-router efficient performance is always at least as
good as standalone efficient performance or constitutes a conservative lower
bound. State that inherited conversation history may help or hurt, and treat the
two runs as non-equivalent baselines unless matched benchmark results establish
a lower bound.
- Around line 258-263: Update the routing-log example in the documentation to
use a path writable by the server user, or explicitly document the required
ownership and permissions for /var/lib/switchyard. In the request example, set
the model value to "switchyard" so it matches routes.stage.id and selects the
intended route.
🪄 Autofix
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: e43c89fd-971a-4c60-ae0e-1ece77160281
📒 Files selected for processing (1)
docs/routing_algorithms/stage_router_routing.md
3cf71a1 to
29f03b1
Compare
…uning Signed-off-by: sabhatinas <sabhatinas@nvidia.com> Signed-off-by: Sabhatina Selvam <sabhatinas@nvidia.com>
… the log path Three corrections from review: The flowchart's de-escalation branch showed only `tests passed + recent write`. The runtime also accepts a recent edit and requires no windowed error (`crates/libsy/src/algorithms/util/stage.rs:285-287`). The classifier branch showed no fall-open path, though the picker falls open to the default tier when the classifier returns no valid tier. The "conservative lower bound" claim was unsupported. Inherited history can help or hurt the efficient model, so a standalone efficient run is a different condition rather than a bound in either direction. `--routing-log-file` pointed at `/var/lib/switchyard/`, which the server user may not be able to write. The server creates parent directories but does not change ownership, so the example now uses a relative path and says what a system location needs. Also states the model alias a request must send to select the route. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Sabhatina Selvam <sabhatinas@nvidia.com>
29f03b1 to
e721211
Compare
capable_first is implemented and the server accepts it, but it has not been benchmarked, so the docs no longer present it as a configuration option — including the threshold number line and the TOML schema table, which both described its band layout. A short note says it is coming once there are numbers behind it, so readers who find it in the code or the enum know where it stands. Signed-off-by: Sabhatina Selvam <sabhatinas@nvidia.com>
Docs only. No code change.
Decision flow was wrong
confidence >= thresholdand jumped straight to "signals pick capable/efficient", which hid both hard rules and the sign check. It also implied the score is the confidence.Show where the score comes from
Added the actual formula and what it implies, rather than asserting "~0.46":
with a table of what 1 / 1.5 / 2 / 3 corroborating signals actually score.
Threshold tuning rewritten
0.0 / 0.5 / 0.7 / 1.0recommendation table — it read as a menu of portable settings, which they are not.efficient_firstsends[-1, t)to efficient and[t, +1]to capable;capable_firstsends[-1, -t]to efficient and(-t, +1]to capable.tinto "maxed signals needed to leave the default tier".0.3and said plainly that swapping either model changes the trajectories, so the score distribution moves and the sametbuys a different split. Recalibrate per tier pair.Calibration rewritten
switchyard-stage-router-scorerskill, histogram the scores, put the cut line where the mass tells you to, sweep, and check escalations land where the efficient tier actually fails.recent_turn_window— short windows react fast and flap, long windows need sustained trouble and react late — and noted it is not independent oft.Route configuration
Replaced the single-provider OpenRouter gpt-4o/4o-mini example with the two-provider shape we actually benchmark: Anthropic Messages capable tier, OpenAI Chat efficient tier, per-target
extra_body, handoff notes, and the--routing-log-fileflag.Verified with
mkdocs build --strict.Summary by CodeRabbit