Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/open_apps/tasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def get_target_state(self, initial_state: dict) -> dict:
return target_state

def check_if_task_is_complete(
self, initial_state: dict, current_state: dict
self, initial_state: dict, current_state: dict, current_url: str | None = None
) -> bool:
target_state = self.get_target_state(initial_state)
app_state_comparison = AppStateComparison(target_state, current_state)
Expand All @@ -435,7 +435,7 @@ def get_target_state(self, initial_state: dict) -> dict:
return target_state

def check_if_task_is_complete(
self, initial_state: dict, current_state: dict
self, initial_state: dict, current_state: dict, current_url: str | None = None
) -> bool:
target_state = self.get_target_state(initial_state)
app_state_comparison = AppStateComparison(target_state, current_state)
Expand Down Expand Up @@ -467,9 +467,14 @@ class NavigateToAppTask(Task):
target_app: str

def check_if_task_is_complete(
self, initial_state: dict, current_state: dict
self, initial_state: dict, current_state: dict, current_url: str | None = None
) -> bool:
url = current_state.get("_url", "") if isinstance(current_state, dict) else ""
# The env passes the live page URL via ``current_url`` (see
# add_tasks_to_browsergym.reward). Older callers injected it as
# ``current_state['_url']`` -- fall back to that for compatibility.
url = current_url or (
current_state.get("_url", "") if isinstance(current_state, dict) else ""
)
if not url:
return False
try:
Expand Down