Repository navigation
fix: return explicit status from full_reset to prevent silent skips (fixes #406) - #411
Open
Tharun-Varshan-S wants to merge 1 commit into
Open
Tharun-Varshan-S wants to merge 1 commit into
Tharun-Varshan-S wants to merge 1 commit into
Conversation
…ixes ServiceNow#406) Signed-off-by: tharun_varshan_s <tharunvarshan.s087@gmail.com>
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.
Description
Fixes #406
WebArenaInstance.full_reset()previously returnedNonein both scenarios:WA_FULL_RESET(orVWA_FULL_RESET) was unset andskip_if_not_set=True.Because
prepare_backend()calledfull_reset()without arguments, a missing reset endpoint only logged a single warning while returningNone— exactly matching a successful reset. As a result, downstream benchmark runs could silently proceed against un-reset / dirty instances without callers having any programmatic signal to verify reset execution.This PR implements the "fail legibly" approach:
WebArenaInstance.full_reset()now returnsbool:Trueif the automated reset was successfully executed.Falseif the reset was skipped because the reset URL environment variable was unset or empty.skip_if_not_set=False.prepare_backend()at the call sites forwebarena,webarena_verified, andvisualwebarenato consume this return value and prominently log:Environment reset: DONE(whenTrue)Environment reset: SKIPPED (<RESET_URL_VAR> unset)(whenFalse)tests/webarena/test_instance_reset.pycovering all reset scenarios and log outputs.What Changed
browsergym/webarena/src/browsergym/webarena/instance.pyfull_reset()to trackwas_resetstate, returnbool, and updated docstrings.browsergym/experiments/src/browsergym/experiments/benchmark/utils.pyprepare_backend()forwebarena,webarena_verified, andvisualwebarenato checkfull_reset()result and log reset status.tests/webarena/test_instance_reset.pyTrue/False), exception handling on failure, VisualWebArena inheritance ofVWA_FULL_RESET, andprepare_backendlogging.How It Was Tested
Unit Tests:
Ran
uv run pytest -v tests/webarena/test_instance_reset.py— all 12 tests passed:test_full_reset_skipped_when_env_unsettest_full_reset_skipped_when_env_emptytest_full_reset_raises_when_env_unset_and_skip_falsetest_full_reset_raises_when_env_empty_and_skip_falsetest_full_reset_successtest_full_reset_success_already_runningtest_full_reset_raises_on_reset_endpoint_errortest_visualwebarena_uses_vwa_env_vartest_prepare_backend_webarena_logs_donetest_prepare_backend_webarena_logs_skippedtest_prepare_backend_visualwebarena_logs_skippedtest_prepare_backend_webarena_verified_logs_skippedCode Formatting & Linting:
Ran
uv run black . --check— passes cleanly with all files compliant.Core BrowserGym Tests:
Verified core Playwright action tests pass without regressions.
Security & Edge Cases Considered
Noneand""values.skip_if_not_set=Falseto abort withRuntimeErrorif the reset URL is not configured.VisualWebArenaInstanceinheritsfull_reset()while honoring itsVWA_FULL_RESETvariable.Mentions
cc @Surya-5555 (maintainer) and @nikolas-sapa (issue author) — thank you both for the helpful discussion and feedback on the issue!