Skip to content

feat(libsy): let stage algorithms fall_open tier be set at runtime - #518

Open
ryan-lempka wants to merge 1 commit into
mainfrom
affinity-in-stage
Open

feat(libsy): let stage algorithms fall_open tier be set at runtime#518
ryan-lempka wants to merge 1 commit into
mainfrom
affinity-in-stage

Conversation

@ryan-lempka

@ryan-lempka ryan-lempka commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Background: Today the stage algorithm has a fallback tier that comes from a config setting called picker. When stage algorithm is uncertain of the right model to route to it falls back to the picker. This is currently set inside of the config and fixed for the life of the process.

What: This PR adds in the ability to change the fallback tier at runtime. Introduces two new functions set_fall_open and clear_fall_open so the fallback tier is now read from session state, falling back to picker when nothing is set. Nothing calls these functions yet, so stage behavior is unchanged.

Why: A first step towards hierarchical algorithms. This will allow another algorithm (such as LLM Classifier) to set which tier the stage algorithm falls back to at some point during the session. Given a large number of stage algorithm turns will default to the picker we can use LLM Classifier to adjust it based on difficulty. Follow-on PRs will look enable doing this at the start of the session, and also at the start of a user-turn.

Summary by CodeRabbit

  • New Features
    • Added persistent fall-open routing overrides for selecting the strong or weak tier.
    • Added support for clearing an override and returning to the configured default.
    • Overrides remain active without suppressing normal signal routing.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://NVIDIA-NeMo.github.io/Switchyard/pr-preview/pr-518/

Built to branch gh-pages at 2026-08-21 22:27 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@ryan-lempka ryan-lempka self-assigned this Aug 21, 2026
@ryan-lempka ryan-lempka changed the title feat(libsy): hold a settled stage tier across turns feat(libsy): let stage's fall-open tier be set at runtime Aug 21, 2026
@ryan-lempka
ryan-lempka force-pushed the affinity-in-stage branch 5 times, most recently from be1763e to 071aa53 Compare August 21, 2026 21:26
@ryan-lempka ryan-lempka changed the title feat(libsy): let stage's fall-open tier be set at runtime feat(libsy): let stage algorithms fall-open tier be set at runtime Aug 21, 2026
@ryan-lempka ryan-lempka changed the title feat(libsy): let stage algorithms fall-open tier be set at runtime feat(libsy): let stage algorithms fall_open tier be set at runtime Aug 21, 2026
@ryan-lempka
ryan-lempka marked this pull request as ready for review August 21, 2026 21:59
@ryan-lempka
ryan-lempka requested a review from a team as a code owner August 21, 2026 21:59
@ryan-lempka

Copy link
Copy Markdown
Collaborator Author

@coberabbitai review

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3ed8bf70-b9b2-42c9-aa60-8517e58a27ce

📥 Commits

Reviewing files that changed from the base of the PR and between 053a61e and 9a9fe04.

📒 Files selected for processing (3)
  • crates/libsy/src/algorithms/stage.rs
  • crates/libsy/src/algorithms/util/stage.rs
  • crates/libsy/src/lib.rs

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

The router now supports persistent fall-open tier overrides. It uses the override at zero confidence, preserves decisive signal routing, and restores the picker default after the override is cleared.

Changes

Fall-open tier routing

Layer / File(s) Summary
Tier override state and API
crates/libsy/src/algorithms/util/stage.rs, crates/libsy/src/lib.rs
Tier supports stable "strong" and "weak" labels. Public helpers set and clear the persisted fall-open tier in State.extra.
Fall-open classifier integration
crates/libsy/src/algorithms/stage.rs
FallOpen selects the persisted override or picker default at zero confidence. The router uses it as its terminal classifier.
Override behavior coverage
crates/libsy/src/algorithms/stage.rs
Integration coverage verifies persistence across turns, decisive signal routing, and default restoration after clearing.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 9a9fe

The change is localized to runtime fallback-tier state handling, and no actionable merge-blocking risk remains after normal checks and review.

Poem

I’m a rabbit with tiers in my tray,
Strong or weak labels guide the way.
Overrides persist through each turn,
Clear them, and defaults return.
Decisive signals still hop through—
A tidy route for me and you!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 61.54% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: runtime configuration of the stage algorithm's fall-open tier.

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

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Signed-off-by: Ryan Lempka <rlempka@nvidia.com>
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.

1 participant