Fix TypeError: NavigateToAppTask/DeleteToDoTask/RemoveLandmarkTask reject the current_url kwarg the env passes#44
Open
jiayuww wants to merge 1 commit into
Conversation
…asses add_tasks_to_browsergym.reward() calls check_if_task_is_complete(initial_state, current_state, current_url=...), and the base Task + most subclasses accept current_url, but NavigateToAppTask, DeleteToDoTask, and RemoveLandmarkTask were left at the 2-arg signature. Every task instance of those classes crashes with 'TypeError: <Class>.check_if_task_is_complete() got an unexpected keyword argument current_url' the moment the env computes reward, so they can never be scored (reward path aborts). Repro (dummy agent, no model needed): uv run launch_agent.py agent=dummy task_name=navigate_from_todo_to_calendar # also: task_name=delete_call_aunt_lisa, remove_times_square_from_favorites Fix: accept current_url in all three. NavigateToAppTask now prefers the env-provided current_url (falling back to current_state['_url'] for older callers); the click-only Delete/Remove checkers accept-and-ignore it (they compare app state). Reward semantics unchanged; after the fix the repro runs to completion and scores instead of crashing.
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.
Problem
Three task classes reject the
current_urlkeyword argument that the env passes when it computes reward, so any task instance of those classes crashes on the first step and can never be scored.add_tasks_to_browsergym.py::reward()calls:The base
Taskand most subclasses acceptcurrent_url, butNavigateToAppTask,DeleteToDoTask, andRemoveLandmarkTaskwere left at the 2-arg signature(self, initial_state, current_state).Reproduce (dummy agent, no model / API key needed)
On current
main:The run aborts on step 1 (
n_steps: 1,cum_reward: 0,err_msgset):Same failure for the other two affected classes:
Fix
Accept
current_urlin all three checkers so their signature matches the base class and the env call site:NavigateToAppTasknow uses the env-providedcurrent_urlto decide completion (falling back tocurrent_state["_url"]for older callers), keeping the URL-prefix reward logic unchanged.DeleteToDoTask/RemoveLandmarkTaskare click-only, app-state checks — they acceptcurrent_urland ignore it.No reward semantics change.
Verification
After the fix, the exact repro above runs to completion instead of crashing (
err_msg: None, fullmax_stepsrun, reward computed normally). An AST audit confirms everycheck_if_task_is_completeintasks.pynow acceptscurrent_url.