ToolCallSuccess: move runtime-status short-circuit from prompt into Python#5145
Merged
Conversation
Test Results for assets-test88 tests 88 ✅ 2s ⏱️ Results for commit 89430c0. ♻️ This comment has been updated with latest results. |
aprilk-ms
reviewed
Jun 17, 2026
aprilk-ms
reviewed
Jun 17, 2026
aprilk-ms
reviewed
Jun 17, 2026
aprilk-ms
approved these changes
Jun 19, 2026
…ython Failed/incomplete tool_call or tool_result blocks now return a deterministic fail result without invoking the LLM judge; the prompty rubric is consulted only on the success path. Drops [STATUS] suffix from the formatted LLM input (back-compat with pre-pass-through wire format). Adds _collect_failed_tool_calls helper and _return_short_circuit_failure_result method; removes _format_status_suffix; rewrites tests.
Per PR review: asset.yaml's pytest.tests_dir points at a single file (test_tool_call_success_evaluator_behavior.py), so the standalone test_tool_call_success_status_shortcircuit.py was not being picked up by the asset's CI run. Move both unit-test classes (TestCollectFailedToolCalls, TestGetToolCallsResultsNoStatusForward) plus their helpers into the behavior file alongside the existing TestToolCallSuccessEvaluatorBehavior class, and delete the standalone file. 19 unit tests collected; pytest collects 88 total tests for tool_call_success.
c3d8de6 to
89430c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #5126. Moves the runtime-status short-circuit out of the LLM rubric and into Python, so failed/incomplete tool calls return a deterministic fail result without spending a judge call. The prompty rubric is now consulted only on the success path.
Why
[STATUS] failed/[STATUS] incompleteannotation that we already know deterministically at evaluator time.What changed
_tool_call_success.py(both repos):_do_evalnow calls_collect_failed_tool_calls(eval_input["response"])after preprocessing. If non-empty, returns_return_short_circuit_failure_result(failed_tools)early — no LLM call, no prompty render._collect_failed_tool_callshelper: two-pass scanner over messages, treatsstatus in {"failed", "incomplete"}on either atool_callblock or its correspondingtool_resultas a failure. Handles flat (name,tool_call_id) and nested (tool_call.function.name,tool_call.id) shapes. Falls back to id or name when one is missing, dedupes by (id, name)._return_short_circuit_failure_result: returnsscore=0.0,result="fail",status="completed",properties={"failed_tools": ...}. Assets variant additionally includes top-level token-metadata keys for back-compat with the existing LLM path result shape._get_tool_calls_resultsrewritten — no_format_status_suffixcalls; output is byte-identical to the pre-pass-through format._format_status_suffixremoved.tool_call_success.prompty(both repos):[STATUS] failed/[STATUS] incompletebullet from the rubric.[STATUS]as optional.[STATUS]-flavored examples ("status annotation overrides bland payload", "status completed but payload still indicates an error", "parallel calls in one turn, one annotated failed").Tests:
test_tool_call_success_status_passthrough.py.test_tool_call_success_status_shortcircuit.py: 19 tests covering both helpers — failed-on-call, failed-on-result, incomplete-treated-as-failure, dedupe, parallel calls, nested function shape, missing-id-falls-back-to-name, malformed-blocks-skipped-silently, non-list-input, no-status-forwarded-in-LLM-input, etc.Validation
pytest test_tool_call_success_status_shortcircuit.py— 19/19 passed.pytest test_tool_call_success_evaluator_behavior.py— 69/69 passed (no regression).Related