Repository navigation
Fix MiniWoB reward parsing: int() crashes on fractional reward strings - #390
Open
aashish254 wants to merge 2 commits into
Open
aashish254 wants to merge 2 commits into
aashish254 wants to merge 2 commits into
Conversation
get_episode_reward wrapped the reward in int(), which raises ValueError for fractional reward strings such as "0.8680475871297262" returned by partial-credit tasks (e.g. MiniWobBisectAngle), aborting the whole task in suite_utils. Parse as float, which the function already declares it returns.
… marker, not just data= - Updated extract_broadcast_data to use .find() on full marker - This prevents truncation when earlier lines contain 'data=uri' - Added test_preamble_with_data_uri_in_intent_not_truncated regression test - Mutation check: new test fails on base (truncates), passes with fix
This branch has not been deployed
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.
What changed
miniwob_base.get_episode_reward()didfloat(int(reward)), but the MiniWoB app reports partial-credit rewards as float strings — e.g.MiniWobBisectAnglereturns"0.8680475871297262".int()raisesValueError: invalid literal for int() with base 10on any decimal string, so the exception propagates throughis_episode_terminated()→episode_runner.run_episode()→suite_utils._run_task(), which logs "SKIPPING MiniWobBisectAngle" and discards the entire episode. The agent had actually earned a reward; the task just crashes on it. Decimal success strings like"1.0"crash identically.The function's signature already declares
-> float, so the fix is to parse asfloat(reward)directly. Downstream behavior is unchanged:is_episode_terminated()compares!= 0.0andis_successful()compares== 1.0, both of which behave exactly as before for integral rewards and now also handle partial credit correctly (terminated but not successful).This is the error reported verbatim in #326.
Tests
Added
test_get_episode_reward_fractional(the exact string from #326) andtest_get_episode_reward_decimal_string("1.0"), alongside the existing integral-reward tests.How verified
mainwithValueError: invalid literal for int() with base 10: '0.8680475871297262'/'1.0'atminiwob_base.py:59; pass with the fix.pytest android_world/task_evals/miniwob/— 9 passed.interface_testtimeout flake,receipt_generator_test) fail identically on a pristine base worktree without this change and are unrelated.git merge-treewith its head is clean.