Skip to content

Fix TypeError: NavigateToAppTask/DeleteToDoTask/RemoveLandmarkTask reject the current_url kwarg the env passes#44

Open
jiayuww wants to merge 1 commit into
facebookresearch:mainfrom
jiayuww:fix-checker-current-url-kwarg
Open

Fix TypeError: NavigateToAppTask/DeleteToDoTask/RemoveLandmarkTask reject the current_url kwarg the env passes#44
jiayuww wants to merge 1 commit into
facebookresearch:mainfrom
jiayuww:fix-checker-current-url-kwarg

Conversation

@jiayuww

@jiayuww jiayuww commented Jul 1, 2026

Copy link
Copy Markdown

Problem

Three task classes reject the current_url keyword 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:

self.task.check_if_task_is_complete(self.initial_state, current_state, current_url=current_url)

The base Task and most subclasses accept current_url, but NavigateToAppTask, DeleteToDoTask, and RemoveLandmarkTask were left at the 2-arg signature (self, initial_state, current_state).

Reproduce (dummy agent, no model / API key needed)

On current main:

uv run launch_agent.py agent=dummy task_name=navigate_from_todo_to_calendar

The run aborts on step 1 (n_steps: 1, cum_reward: 0, err_msg set):

TypeError: NavigateToAppTask.check_if_task_is_complete() got an unexpected keyword argument 'current_url'
  ...
  File ".../browsergym/core/env.py", line 497, in _task_validate
    reward, done, user_message, info = self.task.validate(self.page, self.chat.messages)
  File ".../open_apps/tasks/add_tasks_to_browsergym.py", line 116, in reward
    if self.task.check_if_task_is_complete(
TypeError: NavigateToAppTask.check_if_task_is_complete() got an unexpected keyword argument 'current_url'

Same failure for the other two affected classes:

uv run launch_agent.py agent=dummy task_name=delete_call_aunt_lisa              # DeleteToDoTask
uv run launch_agent.py agent=dummy task_name=remove_times_square_from_favorites  # RemoveLandmarkTask

Fix

Accept current_url in all three checkers so their signature matches the base class and the env call site:

  • NavigateToAppTask now uses the env-provided current_url to decide completion (falling back to current_state["_url"] for older callers), keeping the URL-prefix reward logic unchanged.
  • DeleteToDoTask / RemoveLandmarkTask are click-only, app-state checks — they accept current_url and ignore it.

No reward semantics change.

Verification

After the fix, the exact repro above runs to completion instead of crashing (err_msg: None, full max_steps run, reward computed normally). An AST audit confirms every check_if_task_is_complete in tasks.py now accepts current_url.

…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.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant