Skip to content

fix(webarena): close the login tab in ui_login even when the login fails - #437

Open
JYunth wants to merge 1 commit into
ServiceNow:mainfrom
JYunth:fix/ui-login-close-tab
Open

JYunth wants to merge 1 commit into
ServiceNow:mainfrom
JYunth:fix/ui-login-close-tab

Conversation

@JYunth

@JYunth JYunth commented Nov 29, 2026

Copy link
Copy Markdown

WebArenaInstance.ui_login opens a new tab to log in, but only closes it when the login succeeds. WebArenaVerifiedTask.setup() retries ui_login on timeout, so every failed attempt leaves a half-filled login tab open in the agent's browser context. With a stub server where the first GitLab sign-in times out and the retry works, the agent's first observation has open_pages_urls == [".../gitlab", ".../gitlab/users/sign_in"]. With this change it's just [".../gitlab"].

The fix wraps the login in try/finally: page.close(). Most of the diff is re-indentation; with whitespace hidden it's 3 lines.

Added tests/webarena/test_instance_ui_login.py with mocked pages, checking that the tab is closed both on success and when a step times out. The timeout case fails on main.

ui_login opens a new tab to log in and only closed it on success.
WebArenaVerifiedTask.setup() retries ui_login on timeout, so every failed
attempt left a half-filled login tab open in the agent's browser context,
and the agent started the episode with that extra tab.

Close the tab in a finally block.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant