Fix dead code and validation guard in deception_bench.py - #2
Open
msarg44 wants to merge 1 commit into
Open
Conversation
- Remove dead duplicate reasoning_match in _parse_reasoning_and_output else block (identical regex would never match) - Remove dead elif branch in _parse_reasoning_and_output (same condition as preceding if) - Fix ineffective validation guard: require_precomputed_predictions was checking has_mesa_and_action instead of has_all_precomputed
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
Three fixes in
uni_eval/evaluators/deception_bench.py:1. Dead code: duplicate regex in else block (lines 105-108)
The
_parse_reasoning_and_outputfunction runs a regex to extract reasoning, and the else block runs the identical regex — it will never match. Replaced the dead block withpass.2. Dead code: duplicate elif condition (lines 119-121)
Both the
ifandelifbranches check" response" in response— the elif can never execute. Consolidated to a simple if/else.3. Ineffective validation guard (line 548)
The
evaluatemethod checksrequire_precomputed_predictionsbut validates againsthas_mesa_and_action, which is guaranteed to be True at that point (the outerifalready ensures it). Changed tohas_all_precomputedso the guard actually catches missing precomputed reasoning fields when prediction data is strictly required.