Skip to content

fix(webarena): keep the mounted map_setup.py standard-library only - #173

Merged
lanyue-llk merged 1 commit into
mainfrom
fix/webarena-map-setup-standalone
Nov 3, 2026
Merged

lanyue-llk merged 1 commit into
mainfrom
fix/webarena-map-setup-standalone

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What, why and how of this PR

Issues

Closes #167

Summary

deploy/webarena/README.md mounts map_setup.py alone at /opt/map_setup.py in the upstream Map image, but the file imported harness.web_fetch.safety at the top level for an acceptance check that never runs there. Under python -I -S the previous file stops with ModuleNotFoundError: No module named 'harness'. As the issue notes, this was reproduced with -I -S and not against the pinned image.

  • Move verify_map_endpoint and map_check_main unchanged into src/harness/environments/webarena/map_check.py, which only runs from this repository. A new module was needed because cli.py imports webarena_verified and map_archives.py covers a different stage.
  • scripts/verify_webarena_map.py keeps its name, arguments and behaviour, and now imports from map_check.
  • map_setup.py now imports only the standard library, as its docstring already said. Its setup and serve code is unchanged.

Rendered reports, frozen profiles and evidence are not affected.

Test plan

  • New test_mounted_script_initializes_a_volume_with_only_the_standard_library: copies the script alone into a temporary directory and runs it with -I -S, completing an offline setup from local archives. This covers the whole setup path, not only --help.
  • Negative control: the previous file under python -I -S ... --help fails with ModuleNotFoundError: No module named 'harness'. The new file prints its usage.
  • scripts/verify_webarena_map.py --help prints its usage.
  • pytest tests/environments tests/test_golden_reports.py -n 2: 132 passed. The golden snapshots are unchanged.
  • Lint gate (ruff check with F,TID252, then the default config): passed.
  • Not run: the script inside the pinned Map image.

The Map acceptance check runs from this repository, yet its top-level harness import sat in the file mounted alone into the upstream Map image. Move verify_map_endpoint and map_check_main to map_check.py and run the mounted script under -I -S in a test.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Review complete · 3486c18

No findings in this review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review, round 1

Head reviewed: 3486c18b8f810d299bc58bce9bf92cd3463bff84. No defects found.

What I verified

The fix

  • The base version of the mounted file fails under python -I -S map_setup.py --help with ModuleNotFoundError: No module named 'harness'. The head version prints its usage.
  • An AST walk of the head map_setup.py, including imports inside functions, finds only standard-library modules. This also covers the --serve path, which the new test does not run.

The move

  • verify_map_endpoint and map_check_main are identical at byte level between the base map_setup.py and the new map_check.py. The only diff is the two trailing blank lines before the next function.
  • map_setup.py still uses HTTPError, urlopen and argparse, and the removed urlencode has no remaining uses.
  • No caller of the old path remains. scripts/verify_webarena_map.py is the only entry point, and it keeps its name and arguments. No compatibility re-export was left in map_setup.py.
  • The stated reason for a new module holds: cli.py imports webarena_verified, and map_archives.py imports harness.distribution and covers a different stage.

The new test

  • It fails without the fix: with the old import line put back into map_setup.py, it fails on its return-code assertion.
  • It copies the file alone into a temporary directory, runs it with -I -S, and completes a full offline setup from local archives.

Scope

  • Closes #167 is accurate. The PR does the suggested move and adds the -I -S test.
  • The PR states that the script was not run inside the pinned Map image. I did not run it there either.

Repository rules

  • The diff touches no evidence, frozen profiles, golden snapshots or workflows.
  • It adds no private data, and the PR text has no attribution lines.

Local test and lint runs

  • pytest tests/environments tests/test_golden_reports.py -n 2: 132 passed, with golden snapshots unchanged.
  • Lint gate (F,TID252, then the default config): passed.

CI at this head

  • Passed: Tests and static checks, Installation and packaging, Rendered reference and report checks, Python 3.11, Select check scope, OCR dispatch and ocr-review.

lanyue-llk added a commit that referenced this pull request Nov 3, 2026
@lanyue-llk
lanyue-llk merged commit ec20748 into main Nov 3, 2026
7 checks passed
@lanyue-llk
lanyue-llk deleted the fix/webarena-map-setup-standalone branch November 3, 2026 17:14
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.

fix(webarena): mounted map_setup.py imports the harness package

1 participant