fix(libsy): count routing-time model calls that stop the run - #830
Conversation
When a routing-time model call failed, `serve` in `libsy-llm-client` returned the error from `drive`. That cancelled the algorithm task before `Driver::call_model` could record the call. So `switchyard.llm_calls` and `switchyard.llm_call_duration_ms` missed these failed calls. The host now records call metrics when it finishes a `CallModel`. - `CallModel::respond` records the call, then sends the result to the algorithm. - New `CallModel::fail` records a failed call and returns the error to stop `drive`. `serve` uses it when a model call fails. - `Drop` for `CallModel` records a call that was never answered as an error. This covers hosts that drop the call without calling `respond` or `fail`. - `Driver::call_model` still records the outcome and token counts on its `libsy.llm_call` span. Fixes: https://linear.app/nvidia/issue/SWITCH-1544 Assisted-by: Pi:GPT 6 Astra medium Assisted-by: Claude:Opus 5.5 medium Signed-off-by: Graham King <grahamk@nvidia.com>
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: NVIDIA-NeMo/Switchyard/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review. WalkthroughThe change separates recoverable model-call failures from routing-stopping failures. ChangesCall Failure Observability
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The failure paths preserve routing behavior and record the intended call metrics; no merge-blocking risk is established. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
A rabbit checks each call with care Comment |
When a routing-time model call failed,
serveinlibsy-llm-clientreturned the error fromdrive. That cancelled the algorithm task beforeDriver::call_modelcould record the call. Soswitchyard.llm_callsandswitchyard.llm_call_duration_msmissed these failed calls.The host now records call metrics when it finishes a
CallModel.CallModel::respondrecords the call, then sends the result to the algorithm.CallModel::failrecords a failed call and returns the error to stopdrive.serveuses it when a model call fails.DropforCallModelrecords a call that was never answered as an error. This covers hosts that drop the call without callingrespondorfail.Driver::call_modelstill records the outcome and token counts on itslibsy.llm_callspan.Fixes: https://linear.app/nvidia/issue/SWITCH-1544
Assisted-by: Pi:GPT 6 Astra medium
Assisted-by: Claude:Opus 5.5 medium
Signed-off-by: Graham King grahamk@nvidia.com
Summary by CodeRabbit
Bug Fixes
Observability