Repository navigation
refactor(trajectory-replay): replace curated scripts with one subcommand CLI - #176
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 1
Reviewed head 1063b2fd against main 6f801e04 (main has not moved). Findings: one P1, two P2, two P3.
P1: the latency quiet-host guard no longer sees a curated replay run
src/harness/web_fetch/webmainbench_latency_correction.py:159, competing_benchmark_pids()
The marker is "-m harness.trajectory_replay.", with a trailing dot. It matched the old python -m harness.trajectory_replay.cli form. This PR changes examples/trajectory_replay/run.sh to -m harness.trajectory_replay evaluate, which has a space after the package name, so the marker misses it. A curated replay that shares the host during WebMainBench latency timing is now treated as a quiet host. Both timing checks at lines 258 and 294 pass, and the timing is certified.
I confirmed this by calling the function on this head with live stand-in processes whose command lines carry each form:
... -m harness.trajectory_replay.cli: detected... -m harness.trajectory_replay evaluate: not detected
The PR's reference search looked for removed script names, so it could not find this marker. #145 added -m harness.web_fetch.webmainbench_runner to the same tuple when it moved its entry point, so this is a known caller of entry-point spellings.
Fix: change the marker to "-m harness.trajectory_replay", which covers every subcommand and the public public_webarena.cli entry. Add rows for -m harness.trajectory_replay evaluate and -m harness.trajectory_replay.public_webarena.cli to test_latency_guard_sees_the_runner_through_each_current_entry (tests/test_web_fetch_owner_commands.py:125). Leave the frozen copies in data/latency-certifiers/*.py.txt alone. New runs bind their own runner source, and #145 already edited this live file.
P2: scripts/README.md says the guides show commands that they do not
scripts/README.md:96-100
The text says the listed guides "show the rest, except the commands listed under 'Pending owner decision (#93)'". Five commands appear in no guide, no Makefile target and no pending row:
catalog-audit-acceptancecatalog-audit-actionscatalog-comparison-inputscatalog-consolidatecatalog-rebind
Only --help lists them. The old row pointed to make webarena-catalog-* and the pinned set in check_track_naming.py, and this PR removes that pinned set.
Fix: add them to the pending table with the reason they stay, or document them in the catalog section of docs/trajectory-replay-protocol.md.
P2: no test shows that check() still enforces the weakened template gate
src/harness/trajectory_replay/webarena_report_check.py:535; tests/trajectory_replay/test_cli.py:133
The new test calls check_template_identity directly. I deleted the call at line 535 and ran tests/trajectory_replay, tests/test_golden_reports.py, tests/test_reporting_publication.py and tests/test_report_templates.py. All of them still passed (2225 passed, 5 skipped for the first three; 133 passed for test_cli.py, test_webarena_report.py and test_report_templates.py). So removing the gate from the release checker goes unnoticed, and package relies on that checker. The PR itself flags this gate as loosened, so the remaining binding needs a test at the public boundary. AGENTS.md also asks for behavioural tests rather than tests of private helpers.
Fix: use build_replay_fixture with a bound profile_sha256 and call checker.check() twice. A manifest with the old entrypoint must get past the gate, and one with a different renderer must raise "bypasses the maintained replay template".
P3: the template gate is copied from Browser Use
src/harness/trajectory_replay/webarena_report_check.py:521-527, which duplicates src/harness/browser_use/report_check.py:350-356.
The PR discloses this. AGENTS.md says to extend the current owner rather than add a parallel implementation, and harness/reporting/templates.py already owns template_identity.
Fix: move a check_template_identity(manifest, track, label) helper there and use it in both tracks, here or in a linked follow-up. I did not check whether browser_use/report_check.py is hash-bound, so check that before changing it. If it is, use the helper for this track only and link the follow-up.
P3: the moved guides use a bare python -m
docs/trajectory-replay-protocol.md (18 occurrences, for example lines 254, 271, 289 and 413) and evaluation/trajectory-replay/webarena-verified/README.md:66,68.
AGENTS.md allows repository Python only through make or uv run --frozen python. #143 wrote uv run --frozen python -m harness.browser_use ..., and docs/benchmarks.md in this PR does the same.
Fix: state the uv run --frozen form once per section, or spell it out at each command.
Verified with no defect
- Scope: 30 scripts removed, none of them bound by a hash in the code.
run_remote_three_method_cohort.pyanduse_prepared_webarena_cohort_reset.pyare kept, andcohort_reference_hashesdoes bind them. All kept*webarena*replay scripts import onlypublic_webarena, or are the environment scripts #174 tracks. So "Closes #172" holds once the P1 is fixed. - Script equivalence: I compared each removed script with its command. The arguments, defaults, output writes and exit behaviour of
replay,seeds,expert-seeds,promote,catalog-reportandmutation-diagnosticmatch. The rest are one-line delegations to the same functions, and every owner can be called with no arguments. - Router: tokens reach the owner in order, including
--, an empty string, values with spaces,-1and-h. - Hash bindings: the code bindings I read (
checker_sources,cohort_reference_hashes) name no file this PR changes. No SHA-256 of a changed non-test file at base appears in Git, apart from the empty-file digest matching the new__main__.py, which is a false positive. - Golden snapshots: only
report-manifest.jsonchanges. Building with the oldentrypointsubstituted back matches the snapshots on main for both outcomes, so the PR's claim holds. - Removed names: no reference remains except the deliberate fixture and the unrelated function name the PR lists.
.github/workflowsis untouched and does not call a moved script. - Local runs:
ruffboth gates passed.tests/trajectory_replay, golden, language, template, documented-path, packaging-hygiene and runtime-entrypoint tests: 2343 passed, 5 skipped. - Not run: the
maketargets, and a real report build, replay or publish against measured evidence. - CI on this head: Tests and static checks, Installation and packaging, Rendered reference and report checks, and Python 3.11 all pass. CI passing does not cover the P1, because no test exercises that marker with the new entry form.
|
Review round 1 is addressed. All five findings are fixed and none is disputed.
The golden snapshots did not change in this round. The local test results and limits are in the PR body's test plan. |
There was a problem hiding this comment.
✅ Re-review complete · 3b9a36c
No findings in this incremental review.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 2
Reviewed head 3b9a36c2 against main 6f801e04.
Findings
P3: PR body, "Reference search" section, is out of date. The section says a search for the removed script names leaves one file, tests/trajectory_replay/test_cli.py. Commit 3b9a36c2 added a second hit: tests/trajectory_replay/test_webarena_report.py:161 contains scripts/build_webarena_replay_report.py, again as the entry point recorded by a report built before the move. AGENTS.md asks for a repository inventory at the end of a structural change, so this statement should be correct.
Suggested fix: edit the PR body to name both test files and say each is a fixture for a report built before the move. No code change is needed.
Verified without findings
Round 1 fixes
- Each fix is present. I repeated these negative controls and reverted them:
- The old marker fails the latency guard test.
- Removing the
check()gate call fails theother-rendererandother-trackrows. - Removing a
scripts/README.mdrow fails the command coverage test. - Dropping
raise SystemExitfrommutation-diagnosticfails its exit status test.
Router semantics
- All 30 deleted scripts map to a
COMMANDSentry whose target exists. - The six parsers moved into
cli.pyhave the same arguments and post-processing as the old scripts. The only difference is the catalog report's--helpdescription text. - Only
run_remote_mutation_diagnostic.pyusedraise SystemExit, and that behaviour is kept. - Argument order, positionals and exit status 2 reach the owners unchanged. Each of the 8 commands I spot-checked returned 0 for
--helpwhen run outside the repository.
Template gate
check_template_identitystill rejects a different track or renderer and accepts the old entry point.report_check.pyandwebarena_report_check.pyare its only callers.
Hash bindings
webarena_replay.py,webarena_corrections.py,retrieval_acceptance.py,remote_runtime.py,remote_execution.py,webarena_report.py,webarena_report_visual.pyand both kept scripts are not in the diff.checker_sourceshashes only the visual modules andreporting/visual.py.verify_certifier_sourcechecks frozen copies and never the livewebmainbench_latency_correction.py, so the marker change invalidates nothing.- The pre-change hashes of the 10 changed files I searched for appear nowhere in Git. Receipts outside Git could not be checked.
Golden snapshots
- Parsing both snapshots against main shows
report-manifest.jsonis the only changed key out of 37 in each.
Scope
- Remaining scripts that import the track either import
public_webarenaor are the two hash-bound scripts. - The WebArena environment scripts stay in the
scripts/README.mdenvironment row, which is listed under #174 in the PR body. - No reference to a removed script remains in
.agents,.github, the Makefile, configs or docs. - Only
webarena_report_visual.pykeeps anif __name__block among the curated owners, as disclosed.
Local runs (Python 3.11, shared locked environment)
- Both ruff gates passed, and
check_track_naming.pypassed. pytest tests/trajectory_replay tests/browser_use/test_report_check.py tests/browser_use/test_cli.py tests/test_golden_reports.py tests/test_report_templates.py tests/test_documented_paths.py tests/test_web_fetch_owner_commands.py tests/test_public_report_language.py tests/test_packaging_hygiene.py -n 2: 2415 passed, 5 skipped.- I did not run the full suite locally, or a real report build, replay or publish against measured evidence.
CI
- Tests and static checks, Installation and packaging, Rendered reference and report checks, and Python 3.11 all passed on this head.
|
Review round 2 is addressed. The one finding is fixed and none is disputed.
I reran the search on 3b9a36c before editing. It also showed uses of the names without No code changed, so I ran no tests in this round. CI on 3b9a36c had already passed. |
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 3
Reviewed head 3b9a36c2 against main 6f801e04, which is still the tip of main.
Findings
No defects found.
What I verified
Router
- Every command in
COMMANDSreaches its owner's--helpwhen run throughpython -m harness.trajectory_replay. - Arguments reach owners in their original order, including positionals,
--,-hand values that contain spaces. sys.argvis restored after the call. Owners' argparse usage shows the public command name.
Moved code
- I compared the AST source of
replay,seeds,expert_seeds,promote,catalog_reportandevaluatewith the removed scripts and the oldcli.py. The only differences are the function names, lazy imports, one comment and a literaldescriptionthat replaces__doc__. - Each removed thin script called the owner function that
COMMANDSnow names. - No owner
mainreturns a meaningful status.mutation-diagnostickeepsraise SystemExit(...). reportno longer makes the explicitresolve_templatecall, butwebarena_report.py:2132still reaches it throughtemplate_identity.
Callers
git grepfor the removed script names, including all tracked files such as.agents/and.github/workflows/, finds only the two fixtures the PR body names, plus thebuild_webarena_replay_reportfunction and test module names that do not refer to scripts.- All seven test modules that keep a removed script's name exist as the PR body says.
- No caller still uses
-m harness.trajectory_replay.clior a removed owner__main__block. Subprocess calls in the track run the reset hook and public WebArena code, not a removed entry. - Public WebArena stays on its own
public_webarena.cli.
Evidence and frozen authorities
webarena_replay.py,webarena_corrections.py,retrieval_acceptance.py,remote_runtime.py,remote_execution.py,webarena_report.py,webarena_report_visual.py,reporting/visual.pyand the two kept scripts are not in the diff.- SHA-256 digests of every changed or removed file at
mainappear nowhere in Git atmain. - A read-only search of the JSON receipts in the local data home's
evidence/andreviews/found no hits. It had a 120-second limit, so it may not have finished. Treat it as supporting evidence only. - The frozen latency certifier copies are unchanged.
Report gate
check_template_identitykeeps the old rejection for a profile-bound report with a missing template, a different renderer or a different track. Onlyentrypointis relaxed, and the PR discloses that.test_check_binds_the_renderer_not_the_entry_pointruns the gate throughcheck().competing_benchmark_pidsnow matches the subcommand form andpublic_webarena.cli, and its test covers both.
Golden snapshots
- Only the
report-manifest.jsonhash changes, intrajectory-replay-passandtrajectory-replay-fail. - I did not repeat the author's check that substitutes the old entry point back in. No HTML route hash changed.
Local runs on this head
- Both ruff gates passed.
pytest tests/test_golden_reports.py tests/trajectory_replay tests/browser_use/test_report_check.py tests/browser_use/test_cli.py tests/test_report_templates.py tests/test_documented_paths.py tests/test_web_fetch_owner_commands.py tests/test_public_report_language.py tests/test_packaging_hygiene.py tests/test_runtime_entrypoints.py -n 2: 2434 passed, 5 skipped.repository_contract_findingsreturned no findings.make -n trajectory-replay-report-checkprints the new command.
CI
- All checks passed on
3b9a36c2, including "Tests and static checks" and "Installation and packaging". The run's head SHA matches this head.
Scope
Closes #172holds: the issue allows keeping scripts that a frozen authority names, and the public WebArena isolation comes fromAGENTS.md. #174 is open for the scripts left to decide.
Limits
I did not run a real report build, visual gate, replay or publish against measured evidence. I also did not run the full suite locally; CI covers it.
…g an owner decision
3b9a36c to
94e2dfe
Compare
Issues
Closes #172. The scripts that had to stay are listed below; #174 tracks the public WebArena and environment scripts.
Summary
30 curated Browser Trajectory Replay scripts become subcommands of
python -m harness.trajectory_replay <command>, using the router pattern from #139 and #143. No old names remain as aliases.build_webarena_replay_report.pyreportcheck_webarena_replay_report.pycheckcheck_webarena_replay_visual.pyvisualpackage_webarena_replay_artifact_site.pypackagepublish_webarena_replay_artifact_site.pypublishrun_webarena_catalog.pycatalog-runbuild_webarena_catalog_report.pycatalog-reportcheck_webarena_catalog_release.pycatalog-release-checkaudit_webarena_catalog_acceptance.pycatalog-audit-acceptanceaudit_webarena_catalog_actions.pycatalog-audit-actionsbuild_webarena_catalog_comparison_inputs.pycatalog-comparison-inputsconsolidate_webarena_catalog.pycatalog-consolidaterebind_webarena_catalog.pycatalog-rebindfreeze_webarena_three_method_inputs.pycohort-freezefreeze_original36_candidate_cohort.pycohort-freeze-original-failuresrevise_webarena_method_inputs.pycohort-reviseaggregate_webarena_three_method_cohorts.pycohort-aggregaterun_remote_mutation_diagnostic.pymutation-diagnosticreevaluate_webarena_evaluator_transition.pyevaluator-transitionaudit_replay_readiness.pyaudit-readinessaudit_replay_cart_assertion.pyaudit-cart-assertionaudit_replay_comparison_inputs.pyaudit-comparison-inputsaudit_saved_replay_correction.pyaudit-saved-correctionrescore_saved_retrieval_attempt.pyrescore-saved-retrievalbuild_revised_webarena_dataset.pydataset-revisionmerge_webarena_replay_results.pymerge-resultsrun_webarena_trajectory_replay.pyreplaybuild_browser_use_replay_seeds.pyseedsbuild_webarena_expert_seeds.pyexpert-seedspromote_webarena_trajectories.pypromotepython -m harness.trajectory_replay.cli, whichexamples/trajectory_replay/run.shcalled, is now theevaluatecommand, so the track has one entry point.The Makefile,
configs/report-templates.json,docs/benchmarks.md,docs/report-hosting.md,docs/trajectory-replay-protocol.md,evaluation/trajectory-replay/webarena-verified/README.md,scripts/README.md,examples/trajectory_replay/run.shand the tests move in this change.scripts/check_track_naming.pyused to pin the exact set of catalog scripts; it now rejects any*webarena_catalog*script.Differences from the earlier routers
cli.py.evaluate,replay,seeds,expert-seeds,promoteandcatalog-reporthad their argument parsing in a script or incli.py. It stays incli.pyand moves unchanged. Cohort certificates hashwebarena_replay.py, so its parser cannot go there, and keeping the six together leaveswebarena_report.py,webarena_dataset.pyand the seed modules byte-identical.mutation-diagnostickeeps its exit status. The removed script usedraise SystemExit(...), so this command does too. The other owners return nothing useful, and their scripts ignored the result.resolve_templatecall is gone, as in refactor(browser-use): replace report scripts with one subcommand CLI #143.reportstill resolves the same template when it builds the manifest.Golden snapshots changed:
trajectory-replay-passandtrajectory-replay-failOnly
report-manifest.jsonchanges in each snapshot. It recordstemplate.entrypoint, which now readssrc/harness/trajectory_replay/cli.py.resolve_templaterequires that path to exist, so the old value could not stay.To confirm nothing else moved, I substituted the old entry point back into the new bytes. Both files then hash to the previously committed snapshot values. No HTML route changes, and no other track's snapshot changes.
Please review: the report check is less strict
webarena_report_check.checkcompared the whole template identity, includingentrypoint. Left as it was, it would reject any profile-bound report built before this PR with "report bypasses the maintained replay template", andpackagerelies on that check.It now binds
trackandrendererthroughcheck_template_identity, matching what #143 did for Browser Use. Reports built earlier stay valid and a different renderer or track is still rejected. The trade-off is thatentrypointis no longer enforced for this track. The function now lives inharness/reporting/templates.pyand both tracks call it, sobrowser_use/report_check.pyis in this diff. No code or file in Git hash-binds that module ortemplates.py. The rejection message now names the track id (browser-use,trajectory-replay).Latency host guard
competing_benchmark_pidsinwebmainbench_latency_correction.pynow matches-m harness.trajectory_replay. The old-m harness.trajectory_replay.marker would have missed every subcommand form. The new marker also countscheck,reportand the other subcommands, and-m harness.trajectory_replay.public_webarena.cliis still matched. The frozen certifier copies are unchanged.Left in place
scripts/run_remote_three_method_cohort.pyremote_execution.cohort_reference_hasheshashes this exact path ascommand_entry, andremote_execution.pyis hash-bound itself, so the path cannot change.scripts/use_prepared_webarena_cohort_reset.py--cohort-reset-hook;cohort_reference_hashesbinds its hash ascohort_reset_hook.if __name__block inwebarena_report_visual.pychecker_sources, so it stays byte-identical. Blocks in the other report and catalog owners are removed.AGENTS.mdkeeps this replay isolated, so they must not join the curated entry point. Their owner decision is in #174.lock_webarena_images.py,manage_webarena_environment.py,manage_webarena_rainbond_pool.py,verify_webarena_env_contract.py,verify_webarena_map.pyharness.environments.webarena, not this track. Tracked in #174.No workflow calls a moved script, so
.github/workflows/needed no change.Effects on existing evidence
None intended.
webarena_replay.py,webarena_corrections.py,retrieval_acceptance.py,remote_runtime.py,remote_execution.py,webarena_report.py,webarena_report_visual.pyand the two kept scripts are byte-identical tomain. I also hashed each file underscripts/,docs/,configs/, the Makefile,src/harness/trajectory_replay/,tests/package_smoke.pyand the verified-trajectories README, then searched the repository for those digests. None is recorded in Git. Receipts outside Git could not be checked here; the source-hash lists in the code are the evidence for what they bind.Reference search
Searching the working tree (excluding
.git,.venvand__pycache__) for the removed script file names leaves two files. Both hits are the same path,scripts/build_webarena_replay_report.py, and each is a fixture for a report built before the move:tests/trajectory_replay/test_cli.py:156tests/trajectory_replay/test_webarena_report.py:161Searching for the names without
.pyalso finds uses that do not refer to the scripts.build_webarena_replay_reportis a function inwebarena_report.py, called fromtest_webarena_report.py. Seven test modules undertests/trajectory_replay/keep a removed script's name in their own file name, such astest_run_webarena_catalog.py, andtest_prepared_webarena_cohort_reset.pyandtest_remote_three_method_cohort.pyimport one of them.Test plan
Run locally with the shared locked environment on Python 3.11:
ruff check --config 'include=["*.py"]' --select F,TID252 .andruff check: passed.pytest tests/trajectory_replay tests/test_golden_reports.py tests/test_public_report_language.py tests/test_report_templates.py tests/test_documented_paths.py tests/test_packaging_hygiene.py tests/test_runtime_entrypoints.py tests/test_web_fetch_owner_commands.py tests/test_reporting_publication.py tests/test_reporting_upload.py tests/test_reporting_binding.py tests/test_reporting_recovery.py tests/test_reporting_publish_client.py tests/test_env_file.py tests/environments tests/benchmarks/test_checkout_entrypoint_precedence.py -n 2: 2743 passed, 5 skipped, 1 failed.test_registry_consumers_import_without_the_optional_webarena_evaluator. Its subprocess imported another checkout's install, which lacksharness.environments.webarena.topology(see the limit below). This PR does not touch that module.test_cli.pyso every command's--helpruns through its owner:pytest tests/trajectory_replay/test_cli.py -n 2: 51 passed. I did not repeat the larger run.repository_contract_findingsfromscripts/check_track_naming.py: no findings.PYTHONPATHset to this checkout: both ruff gates passed.pytest tests/trajectory_replay tests/browser_use/test_report_check.py tests/browser_use/test_cli.py tests/test_golden_reports.py tests/test_report_templates.py tests/test_documented_paths.py tests/test_web_fetch_owner_commands.py tests/test_public_report_language.py tests/test_packaging_hygiene.py -n 2: 2415 passed, 5 skipped. Golden snapshots did not change in this round.check()gate call fails the renderer and track rows; enforcingentrypointagain fails the old-entry-point row; restoring the old marker fails the latency guard test; removing the newscripts/README.mdrows fails the command coverage test.Limits of the local run:
PYTHONPATHprefix, so I used pytest's-o "pythonpath=src .". Subprocess tests that do not set their own path can import another checkout. The tests this PR moves to-m harness.trajectory_replaynow put this checkout'ssrcfirst.tests/package_smoke.pywas edited but not run locally. The "Installation and packaging" check runs it.