Repository navigation
refactor(browser-use): read participants and counts from the registry and evidence - #199
Conversation
There was a problem hiding this comment.
This review found 2 issue(s), including 2 blocking issue(s).
| failures = { | ||
| engine: int(value["tasks"]) - int(value["passes"]) for engine, value in measured.items() | ||
| } |
There was a problem hiding this comment.
P2 — Validate pass-count bounds before deriving failures. Replacing the fixed pass counts now allows a negative pass count for the reviewed browser: the existing synthetic bridge with failures=6 has five tasks, passes=-1, and six unique reviewed results, and satisfies the subsequent checks. It would publish -1/5 as a valid control result. Require integer counts with 0 <= passes <= tasks (without silently truncating fractional values), and add a rejection test for this case. This is a localized evidence-validation regression.
| task_count < 1 | ||
| or replay_engine not in measured | ||
| or reviewed_engine not in measured | ||
| or int(result.get("logical_results") or 0) != task_count * len(measured) |
There was a problem hiding this comment.
P2 — Validate the replay browser population against the bound trajectory profile before deriving this total. measured is extracted from the same results being checked, and _replay_results silently drops entries missing tasks or passes. For a three-browser bridge, removing the third browser (neither the provenance nor reviewed browser) and reducing logical_results from 15 to 10 passes all these checks, even if the bound profile still declares three methods. This allows an incomplete control comparison to be rendered as valid. Read the already hash-verified trajectory profile's methods[*].engine, require the result engine set to match it, and reject incomplete entries. Add a negative control that removes the third browser while adjusting the aggregate total.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 1
Reviewed head e8802ee6 against base f3201951. No approval or change request is implied. There are six findings: four P2 and two P3.
P2: Replay bridge accepts a negative or impossible pass count
src/harness/browser_use/report.py:2061 computes failures = tasks - passes without checking bounds.
I reproduced this with the PR's own _synthetic_bridge(tmp_path, failures=6). It gives {"tasks": 5, "passes": -1} and six reviewed results, and _load_trajectory_replay_bridge accepts it. _trajectory_replay_control then renders -1/5. The removed literals made this impossible, so this is a validation regression. The bridge is hash-bound, so an author would have to bind the bad file, but this check exists to catch exactly that.
Fix: require integer counts with 0 <= passes <= tasks, and add this case to the tamper controls. The real bridge (90/90 and 54/90) already satisfies this.
P2: Replay browser population is derived from the values being checked
src/harness/browser_use/report.py:1962 (_replay_results) and the check at :2068 read the browser set from effective_results, then compare logical_results to task_count * len(measured).
Both of these pass on the three-browser synthetic bridge:
- Remove
thirdand setlogical_resultsto 10. - Delete
third.passesand setlogical_resultsto 10. The incomplete entry is silently dropped by the"tasks" in value and "passes" in valuefilter.
So the PR's "every browser's task count equals the selection size" only holds for browsers that remain in the file. The old literals pinned the population. The bridge already hash-verifies trajectory_profile, and its methods[*].engine lists chromium and moli for the current cohort.
Fix: require the result engines to equal that bound method set, reject any non-scalar effective_results entry that lacks tasks or passes, and add a negative control for each case.
P2: English pages leave result links untranslated for any browser outside the current cohort
src/harness/browser_use/report_i18n.py:360 still has the pattern (.+?) · (Chromium|Moli 1\.1\.3) 结果.
I built the PR's fixture in English with alpha/beta/gamma, then compared Chinese text in en/ pages with a chromium/moli build. The only new untranslated text is on en/datasets/44.html: model-a · Alpha 结果, model-a · Beta 结果 and model-a · Gamma 结果. A relabelled Moli version hits the same gap. This is a remaining participant literal that blocks the size-independent behaviour #195 asks for, and AGENTS.md requires report-authored English interface text to be localized. The new end-to-end test only checks the reproduce page in English, so it misses this.
Fix: generalize the pattern to (.+?) · (.+?) 结果, keep the current English output, and assert the dataset link in the three-browser test.
P2: Reversal does not balance call order beyond two browsers
src/harness/browser_use/runner.py:532 reverses the order on odd tasks, so three browsers alternate abc and cba. b is never first and is always second. The docstring only promises that no browser always runs first, and tests/browser_use/test_runner.py:1503 pins this result. Since this PR exists to make the runner size-independent, the first run with a third browser would carry a systematic position difference.
Fix: rotate instead with offset = task_index % len(engines) and engines[offset:] + engines[:offset]. Two browsers still get (chromium, moli) then (moli, chromium), so the current cohort is unchanged. Three browsers then take each position equally often. Update the test to match.
P3: The neighbouring reproduce row still states a browser count
src/harness/browser_use/report.py:3568 keeps 一套站点环境,两个浏览器并行 directly below the row this PR made dynamic. A three-browser or one-browser report would still say "two browsers". The PR body lists the serial row as the one extra literal, but not this one.
Fix: use count-independent wording, or generate it so the current cohort keeps its bytes. If it stays deliberately, say so in the PR.
P3: Two stated behaviour changes have no direct test
The PR says a row with no model now raises and that _logical_results no longer writes to its input. No test under tests/browser_use/ asserts either: does not identify has no match there, and there is no input-unchanged assertion.
Fix: add one small test for _attempt_id/_logical_results covering both.
Verified with no defect
- Globals:
ENGINE_LABELS,MODEL_LABELS,BASELINE_ENGINEand the_configure_*functions are gone fromharness/browser_use, with no remainingglobal. The one remainingENGINE_LABELSis intrajectory_replay/public_webarena/report.py, outside this scope. - Removed model fallback: every
_attempt_id,_row_modeland_logical_resultscall inreport.pyandreport_check.pyreceives rows stamped by_load_evidence_bundlesor derived from them. Review rows are stamped separately. Removing the fallback does not affect production paths. - Frozen bridge:
research/browser-use-trajectory-replay-bridge.jsonloads with the real 90-task selection through the new validation. No evidence, profile or bridge file changes. - Golden snapshots:
tests/golden/is unchanged and the route hashes pass. - Local runs: both ruff gates pass.
tests/browser_use,tests/test_golden_reports.pyandtests/test_release_check_base.pygive 388 passed. - Runner order for the current cohort:
DEFAULT_BROWSER_IMAGESis orderedchromium,moli, so calls keep the old order. - Issue scope: apart from the findings above, labels, baseline, cardinalities, runner order and a different-size test are all present, so
Closes #195is reasonable once they are resolved.
Not verified
I did not rebuild from private measured evidence, run the visual release check, or run the release check (report_check.check) end to end on a three-browser report.
CI at e8802ee6
"Tests and static checks", "Installation and packaging" and "Rendered reference and report checks" all pass. ocr-review is failing on two blocking findings. They are the first two above, and I reproduced both independently.
|
Review round 1 fixes, head
Lint gate passes. |
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 2
Reviewed head bdaa2641 against base f3201951, which is still the newest main. No approval or change request is implied. There are two findings, both P3 test gaps. I found no correctness defect and no rule violation.
P3: The per-browser task count check has no working negative control
tests/browser_use/test_report.py:1857, the third.update(tasks=4) tamper case in test_replay_bridge_rejects_inconsistent_derived_counts.
That tamper leaves passes=5, so the bounds check rejects it. It never reaches any(value["tasks"] != task_count ...) at src/harness/browser_use/report.py:2085. When I deleted that condition, all of tests/browser_use/test_report.py and test_runner.py still passed. The check itself works: third.update(tasks=4, passes=4) is rejected with it and loads without it.
Fix: change the tamper to third.update(tasks=4, passes=4), or add it as a further case.
P3: No test shows that run() reads the browser registry
tests/browser_use/test_runner.py:1503 and src/harness/browser_use/runner.py:660.
The test passes tuple(ENGINE_IMAGES) into _engine_order itself, so it covers the rotation but not where the order comes from. When I changed the call in run() to _engine_order(("chromium", "moli"), task_index), which restores the hardcoded order this issue removes, all tests in those files still passed.
Fix: let _engine_order(task_index) read ENGINE_IMAGES itself, and test it with a monkeypatched three-entry registry. The existing run() test stops before the loop, so this is cheaper than extending it.
What I verified
- Round 1 fixes: all six are present. Reverting the i18n pattern, the pass-count bounds, the profile browser check or the rotation each fails a test. The same goes for the reviewed-browser failure check and the
logical_resultscheck. - Old globals:
ENGINE_LABELS,MODEL_LABELS,BASELINE_ENGINEand_configure_*are gone from the Browser Use track, andreport.pyhas noglobalstatement.public_webarena/report.pykeeps its own separateENGINE_LABELS, which is outside this issue. No browser or model literal remains inreport.pyorrunner.py. - Removed model fallback: every non-test caller of
_attempt_idand_logical_resultsgets rows that_load_evidence_bundleshas already stamped with a model._logical_resultsno longer writes to its input: a row with no model raises, and a row with one is left unchanged. - Runner order: the two-browser order matches the removed literal, and
ENGINE_IMAGESandENGINE_PORTSregister the same browsers. Nothing reads the oldalternating by tasklabel. - Replay bridge: the checks reject the tampered cases. The frozen bridge still loads with
task_count=90, and its counts match the removed literals (180, 90/90, 54/90, 30, 60, 36). - Other participant counts: I built English reports with two browsers and one model, and with three browsers and two models. Both leave the same 157 Chinese strings on English routes, so the larger cohort adds none. The ones I sampled are frozen task names and interface labels such as the
中文language control; I did not inspect all 157. - Reproduce row: using registered IDs rather than labels is a disclosed trade-off that keeps the published bytes, so I am not raising it. The last profile committed to this repository registers
chromiumthenmoli, with the labelMoli 1.1.3, so the generated text matches the removed literal. - Issue scope: every Browser Use item in #195 and in the #97 audit list is handled, so
Closes #195is accurate. - Bytes and evidence:
tests/golden/,evaluation/andresearch/are untouched by this diff. - Local gates: both
ruffcommands pass.pytest tests/browser_use tests/test_golden_reports.py tests/test_release_check_base.pygives 395 passed. - CI on
bdaa2641: Tests and static checks, Installation and packaging, Rendered reference and report checks, and Python 3.11 all succeeded. - Commits and PR text: no attribution lines, and the PR body has no private data.
Not verified
- No rebuild from private measured evidence, because no current Browser Use profile or evidence is available in this checkout. Byte stability rests on the golden route hashes.
report_check.checkwas not run end to end on a three-browser report. I only confirmed that it has no browser literals and builds its registry throughParticipants.from_profile.
|
Review round 2 fixes:
Nothing disputed. |
There was a problem hiding this comment.
✅ Re-review complete · 671e8ec
No findings in this incremental review.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 3
Reviewed head 671e8ecc against main f3201951. I found no correctness bugs, rule violations or scope gaps. Two tests are missing, both P3. Each one covers a check that replaced a removed literal.
Findings
P3: tests/browser_use/test_report.py:1864 (check at src/harness/browser_use/report.py:2088)
- Problem: The
provenance-splittamper changesexpert_repair_specas well assuccessful_browser_use_execution, so the expert check rejects it first and the historical count check never runs. This check replaced the literal 60. If I delete it, all tests intest_report.py,test_runner.py,test_report_check.pyandtest_golden_reports.pystill pass. A bridge with onlysuccessful_browser_use_executionraised by 1 then loads. With the check in place, that bridge is rejected. - Fix: Add a tamper that changes only
successful_browser_use_execution, for exampleb["base_trajectory_provenance"].update(successful_browser_use_execution=4), expectingcardinality.
P3: src/harness/browser_use/report.py:2107
- Problem: No test covers
key[0] != reviewed_engine, the generalized form of the old"moli"literal. If I delete it, the same tests still pass. A re-hashed review file that attributes one result tobasethen loads undercandidate_failure_review. With the condition in place, that file is rejected. - Fix: Add a control that rewrites one
cause_groups[*].results[*].enginein the synthetic review, updates the boundsha256and expectsresponsibility inventory.
What I verified
-
Local gates: Both ruff commands pass.
pytest tests/browser_use tests/test_golden_reports.py tests/test_release_check_base.pygives 396 passed.tests/golden/,evaluation/andresearch/have no changes. -
Real bridge:
research/browser-use-trajectory-replay-bridge.jsonloads through_load_trajectory_replay_bridgewith a 90-task count. Its bound trajectory profile declareschromiumandmoli, and the hash matches. -
Scope of #195:
- The label and baseline globals and all
globalmutation are gone fromreport.py. report.pyno longer has hardcoded browser names or the old count literals.runner.pyno longer has hardcoded browser names.- The trajectory replay public report has its own
ENGINE_LABELS, which is outside this issue.
- The label and baseline globals and all
-
Three-browser build: With no engine labels, I searched all HTML in both languages for fixed browser names and counts. The only matches were dataset task text, the four sites, and "two programmatic evaluators". None of them refer to browsers.
-
Runner order: Two-browser order matches the old code, because
DEFAULT_BROWSER_IMAGESlistschromiumthenmoli. Rotation gives each browser every position. Nothing reads theengine_orderlabel except the copy intoreport-data.json, so resume and frozen manifests are unaffected. -
Row model: All
_logical_resultsand_attempt_idcallers receive rows that_load_evidence_bundleshas already stamped, so removing the fallback and the input write changes nothing for real builds. -
Translation pattern:
(.+?) · (.+?) 结果has one source string, atreport.py:2981. It matches no entry in the translation table, and no other pattern targets that text. -
Mutation runs: Removing or weakening these made tests fail:
- the non-reviewed failure, logical result, per-browser task, expert and review count checks
- the duplicate-field guard
- baseline-first ordering
- rotation
- the translation pattern
- the parallel-browser wording
- the configuration count
Removing
task_count < 1,replay_engine not in measuredorreviewed_engine not in measuredmade no test fail. I am not raising those: the second is already enforced by_validate_replay_contract_definitions, the third would raiseKeyErroron the next check instead, and the first has no realistic input.
CI
All checks pass on 671e8ecc: Tests and static checks, Installation and packaging, Rendered reference and report checks, and Python 3.11. The PR is mergeable.
Not run
I did not rebuild from private measured evidence or run the full visual release check.
|
Review round 3: both findings are fixed with test-only changes. No production code changed.
Nothing was disputed. Lint is clean. |
There was a problem hiding this comment.
ℹ️ Review skipped · 40800c1
No reviewable content was selected for this run.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 4
Reviewed head 40800c1d against main f3201951.
Finding
P3, src/harness/browser_use/report.py:3659: fixed configuration count in a published claim label
- Problem: The claim in
data/interpretation-evidence.jsonis still the literal四配置最终共同成功任务的性能与资源 P50, while itsbasisrows now come from the registry. I built the PR's three-browser, two-model synthetic report: the file says four configurations above rows for six. This is the same kind of leftover as the reproduce row fixed in round 1, and the home page links this file for download. - Fix: Use the approach from that row. Keep the current text when
len(participants.models) * len(participants.engines) == 4, so current bytes do not change. Otherwise use a form that states the actual count. Add an assertion totest_report_follows_a_registry_of_another_size_without_module_state.
Verified with no defect
-
Globals:
ENGINE_LABELS,MODEL_LABELS,BASELINE_ENGINEand the_configure_*functions have no references left in the Browser Use code.report.pyhas noglobalstatement and nochromiumormoliliteral. -
Scan of the three-browser build: Across its HTML and JSON routes, in both languages, I searched for
Chromium,Moli,gpt-5and fixed browser or configuration counts. Apart from the finding above, the only hit was the frozen text of task #196, which is dataset input. -
Rows without a model: Every
_attempt_id,_row_modeland_logical_resultscaller receives rows stamped by_load_evidence_bundles, in bothreport.pyandreport_check.py, so removing the fallback and the write to the input has no effect on real paths. -
Runner:
configured_browser_images()starts fromDEFAULT_BROWSER_IMAGES, and_engine_orderreturns(chromium, moli)then(moli, chromium), so the two-browser order is unchanged. Nothing consumes theengine_orderlabel as a value. The report only copies it from each frozen manifest. -
Translation: The generalized
(.+?) · (.+?) 结果pattern is applied withfullmatch, after the exact-text lookup. English golden routes are unchanged. -
Replay bridge: I loaded the real
research/browser-use-trajectory-replay-bridge.jsonthrough_load_trajectory_replay_bridgewith the real 90-task selection. It passes, and its bound profile listschromiumandmoli. -
Mutation checks: I removed each of these in turn:
- the more-than-one-field check
- the non-reviewed-failures check
- the
logical_resultscheck - the expert count check
- the
failed_resultscheck - the
verified_resultscheck - baseline-first ordering
- the two-or-many wording
test_report.py,test_report_check.pyand the golden tests fail for each one. Two removals survive, and neither needs a test:replay_engine not in measuredis already enforced by_validate_replay_contract_definitions, andtask_count < 1is only a guard against an empty selection. -
Hash-bound files: The PR does not change
tests/golden/,research/orevaluation/.
Test results
- Lint gate: both
ruffcommands pass. - Targeted tests:
pytest tests/browser_use tests/test_golden_reports.py tests/test_release_check_base.pygives 398 passed. The PR body still says 396, from before the last two test commits. - CI on this head: all checks pass, including "Tests and static checks", "Installation and packaging" and "Rendered reference and report checks".
- Not run: a rebuild from private measured evidence, or the visual release check.
|
Round 4 fixes:
Snapshot change: the golden fixtures have one model and two browsers, so they carried the same wrong text. Nothing disputed. |
There was a problem hiding this comment.
✅ Re-review complete · 6a02367
No findings in this incremental review.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 5
Reviewed head 6a02367f against main f3201951, which is still the newest main. No defects found.
What I verified
- Module state:
ENGINE_LABELS,MODEL_LABELS,BASELINE_ENGINEand the_configure_*functions are gone fromharness/browser_use, and no reference remains insrc,scripts,tests,docsor.agents. The one remainingENGINE_LABELSis an unrelated local constant in the public WebArena report.report.pyandreport_check.pycontain nochromiumormoliliteral. - Rows without a model: the only callers of
_attempt_idand_logical_resultsoutsidereport.pyare inreport_check.py, and they use rows that_load_evidence_bundleshas stamped. Removing the fallback and the input mutation therefore breaks no supported path. - Runner order:
_engine_ordergives the same order as the old code for the current two browsers. Theengine_ordermanifest label is only copied into the public environment file, and nothing validates its value. - Bound bridge:
research/browser-use-trajectory-replay-bridge.jsonloads through the new checks withtask_count=90and is rejected withtask_count=89. The derived 60 and 30 provenance counts match the old literals. - Golden change: I built both Browser Use fixtures, put the old
四配置text back intodata/interpretation-evidence.json, and compared all route hashes with the snapshots onf3201951. They all match, so the PR's explanation of the snapshot change is accurate. - Current-cohort text:
ParticipantsyieldsChromium 与 Moliwith theMoli 1.1.3label in place. The English translations of the reproduce rows and the result link come out as expected. - Round 4 fix: forcing the claim back to
四配置for every count makestest_report_follows_a_registry_of_another_size_without_module_statefail. - Scope of #195: labels, baseline, order and counts all come from the registry or evidence, and the three-browser, two-model build followed by a one-browser build covers a different participant count.
Closes #195is accurate. - Rules: no compatibility aliases or parallel implementations, no evidence or profile changes, and no attribution lines or private data in the diff or commit messages.
Test results
- Lint gate: both
ruffcommands pass. - Targeted tests:
pytest tests/browser_use tests/test_golden_reports.py tests/test_release_check_base.py: 399 passed. - CI on this head: Tests and static checks, Installation and packaging, and Rendered reference and report checks all pass.
Noted, not a finding
From reading the code (I did not run this case), a future bridge with no expert-repaired trajectories would be rejected, because source_tasks.get("expert_repair_spec") returns None rather than 0. It fails closed with a clear error, the old literal rejected that bridge too, and the frozen bridge is not affected, so I would not change it here.
Not verified
I did not rebuild from private measured evidence or run the full visual release check. The PR body discloses both. Byte identity for the real cohort therefore rests on the synthetic snapshots and the text checks above.
6a02367 to
72baf14
Compare
Issues
Closes #195
Part of #97 (this PR covers the Browser Use items only).
Summary
report.pyno longer hasENGINE_LABELS,MODEL_LABELSorBASELINE_ENGINE, and noglobalmutation. A frozenParticipantsvalue is built from the report profile and passed to the functions that need it.report_check.pyuses the same constructor, so its duplicate engine validation is gone._attempt_id,_row_modeland_logical_resultsguessed a model from the global when a row had none. Evidence bundles already stamp every row, so the fallback only ever served tests. It is removed, and a row with no model now raises._logical_resultsalso no longer writes to its input rows.logical_resultsequals tasks times browserssource_contract_countsmethods[*].enginein the hash-verified trajectory profile, and each has integer counts with0 <= passes <= taskslex_browser_use_trajectory_replay_bridge/1schema has field names that contain an engine (chromium_trajectory_provenance,moli_failure_review). The bridge is hash-bound, so those names stay. The code now reads the engine from the<engine>_trajectory_provenanceand<engine>_failure_reviewkeys rather than from literals._engine_orderreadsENGINE_IMAGES, the same registry that starts the containers. Order rotates by task, so every browser takes every position, and is unchanged for the current two browsers. The run manifest'sengine_orderlabel for new runs now readsrotating by task; frozen manifests are untouched.<model> · <browser> 结果no longer lists the current browsers.Rendered output
The current four-configuration cohort renders the same bytes. The only snapshot change is
data/interpretation-evidence.jsonintests/golden/browser-use-pass.jsonandbrowser-use-fail.json. Those fixtures have one model and two browsers, so the common-success claim now reads2 种配置最终共同成功任务的性能与资源 P50instead of the wrong四配置…. Its basis and every other route are unchanged, and a two-model, two-browser build keeps the四配置…text.Test plan
ruffcommands pass.pytest tests/browser_use tests/test_golden_reports.py: 345 passed on the current head.pytest tests/browser_use tests/test_golden_reports.py tests/test_release_check_base.py: 396 passed before the last fix. This includes all golden route hashes.Participants.from_profile._engine_orderwith one, two and three registered browsers, read from the registry._logical_resultsleaves its input rows unchanged.research/browser-use-trajectory-replay-bridge.jsonstill loads and verifies, with no evidence or profile changes.tests/browser_use, the golden tests ortests/test_release_check_base.py. I did not compare them one by one against a run on main, so CI is the gate for the full suite.PYTHONPATHon interpreter commands, so these runs usedpytest -o "pythonpath=src .". That does not reach subprocesses, which is a likely cause of many of the local failures, such as CLI and quickstart tests.