Skip to content

fix(libsy): fall back on efficient stream transport errors - #390

Merged
ayushag-nv merged 1 commit into
NVIDIA-NeMo:mainfrom
ting-hong-shieh:fix/escalation-stream-fallback
Aug 12, 2026
Merged

fix(libsy): fall back on efficient stream transport errors#390
ayushag-nv merged 1 commit into
NVIDIA-NeMo:mainfrom
ting-hong-shieh:fix/escalation-stream-fallback

Conversation

@ting-hong-shieh

@ting-hong-shieh ting-hong-shieh commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What

  • Fall back to the capable target when the efficient response stream raises a transport error during aggregation.
  • Preserve other aggregation failures as typed client-call errors.
  • Add regression tests for the transport fallback and the non-transport error boundary.

Why

The efficient client call completes as soon as it returns a stream handle. A transport error can surface later, while into_agg() consumes that stream for the escalation judge. That error was converted to AlgorithmError, so the route returned HTTP 500 without calling the capable target.

This change treats only a mid-stream transport failure as recoverable. Other aggregation errors keep their original client error type instead of silently changing targets.

Closes #388

How tested

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test -p switchyard-libsy
  • cargo test --workspace

Checklist

  • Unit tests cover the bug fix and its non-transport boundary.
  • No public API or customer-facing documentation changed.
  • Commit includes the required DCO sign-off.

Notes for reviewers

The fallback is intentionally limited to LlmClientError::Transport; invalid or malformed responses remain structured client-call failures.

Summary by CodeRabbit

  • Bug Fixes
    • Improved escalation routing reliability by falling back to a capable target when streamed responses encounter transport failures.
    • Preserved specific client errors for other response aggregation failures.

Signed-off-by: Ting-Hong Shieh <32212900+ting-hong-shieh@users.noreply.github.com>
@ting-hong-shieh
ting-hong-shieh marked this pull request as ready for review August 12, 2026 20:10
@ting-hong-shieh
ting-hong-shieh requested a review from a team as a code owner August 12, 2026 20:10
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

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: 7cdd54d7-c9b5-4c43-83da-e066792121ce

📥 Commits

Reviewing files that changed from the base of the PR and between 48b3b71 and bab53cb.

📒 Files selected for processing (1)
  • crates/libsy/src/algorithms/llm_class.rs

Walkthrough

The escalation classifier now falls back to the capable target after efficient-stream transport failures. Other aggregation failures remain typed ClientCall errors. Tests cover both streamed failure paths.

Changes

Escalation stream fallback

Layer / File(s) Summary
Aggregation error routing
crates/libsy/src/algorithms/llm_class.rs
Efficient response aggregation now routes transport failures to the capable target and converts other aggregation failures into typed client-call errors.
Stream error regression coverage
crates/libsy/src/algorithms/llm_class.rs
Tests cover partial streamed responses followed by transport or non-transport client errors. They verify capable-target fallback and efficient-model error preservation.

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

Poem

I’m a rabbit with a stream in my ear,
Transport thumps no longer cause fear.
The capable target hops into place,
Typed errors keep their proper trace.
Tests cheer, “The route is clear!” 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the transport-error fallback fix in the escalation routing changes.
Linked Issues check ✅ Passed The changes address transport-error fallback and preserve non-transport aggregation errors, with regression tests covering issue #388.
Out of Scope Changes check ✅ Passed The changes are limited to escalation aggregation error handling and related regression tests described in issue #388.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@ayushag-nv ayushag-nv left a comment

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.

Nice Catch. Thanks for the contribution. Approving

@ayushag-nv
ayushag-nv enabled auto-merge (squash) August 12, 2026 23:54
@ayushag-nv
ayushag-nv merged commit b851cda into NVIDIA-NeMo:main Aug 12, 2026
20 checks passed
@ting-hong-shieh
ting-hong-shieh deleted the fix/escalation-stream-fallback branch August 13, 2026 02:14
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.

[bug] Escalation router returns HTTP 500 instead of falling through on efficient stream transport error

2 participants