Fix/7220 preserve eval case order - #7221
Open
boopathi-376 wants to merge 4 commits into
Open
boopathi-376 wants to merge 4 commits into
boopathi-376 wants to merge 4 commits into
Conversation
…ble return cast(bool, ...) is a static-only type hint and has no effect at runtime, so a require_confirmation callable that returns None was silently treated as falsy, letting the tool run without confirmation. Replace the cast with an isinstance(result, bool) runtime check that fails closed on any non-bool return. Fixes google#7010
- Detect un-awaited awaitables returned by require_confirmation predicates and treat them as requiring confirmation, with a logger.warning explaining why. - Log a warning whenever a non-bool return is coerced to True, so a silent behavior change (e.g. numpy.bool_ failing isinstance(bool)) is diagnosable instead of invisible. - Add regression tests asserting 0 and empty string (falsy non-bool) also fail closed, making the full scope of the behavior change explicit. Addresses feedback from mahirhir and tonydzi on PR 7012.
Update require_confirmation docstrings in FunctionTool, McpTool, and McpToolset to state that a non-bool return (including None) is treated as requiring confirmation, matching the runtime behavior fixed in the prior commits.
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.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
Updating an existing eval case moves it to the end of
EvalSet.eval_casesinLocalEvalSetsManager.Solution:
Replace the existing eval case in place instead of removing and appending it, preserving its original position.
Added a regression test to verify that updating a case does not change the order of eval cases.
Testing Plan
Unit Tests:
pytest tests/unittests/evaluation/— 874 passedManual End-to-End (E2E) Tests:
Not applicable. The change is covered by unit tests.
Checklist
Additional context
Small, focused bug fix. The change is limited to the eval-set update helper and its regression test.