From fbe7a1be291d7fb133d4a0a4500ee08651f146b1 Mon Sep 17 00:00:00 2001 From: abrichr Date: Tue, 1 Dec 2026 10:39:58 -0500 Subject: [PATCH 1/5] docs: publish headline counts for the Screenshots Are Not State paper Add a stdlib script that reads the result ledgers named in the paper's reproducibility appendix, recomputes each headline count from per-run rows where the ledger has them, checks it against the ledger's own aggregate, and writes one JSON file of counts and denominators. Inputs are recorded by file name and sha256. A test checks that every percentage equals its own k/n. --- .../headline_counts.json | 554 ++++++++++++++++ scripts/build_paper_headline_counts.py | 594 ++++++++++++++++++ tests/test_paper_headline_counts.py | 63 ++ 3 files changed, 1211 insertions(+) create mode 100644 docs/eval_results/screenshots_are_not_state/headline_counts.json create mode 100644 scripts/build_paper_headline_counts.py create mode 100644 tests/test_paper_headline_counts.py diff --git a/docs/eval_results/screenshots_are_not_state/headline_counts.json b/docs/eval_results/screenshots_are_not_state/headline_counts.json new file mode 100644 index 0000000..df07c26 --- /dev/null +++ b/docs/eval_results/screenshots_are_not_state/headline_counts.json @@ -0,0 +1,554 @@ +{ + "_comment": [ + "Headline counts of arXiv:2611.39728, derived from the result ledgers", + "listed in 'inputs' by scripts/build_paper_headline_counts.py.", + "Every ratio is {k, n, pct}; pct is 100*k/n to one decimal, round-half-up.", + "Regenerate with --ledger-dir; --check fails if this file would change." + ], + "inputs": { + "agentdojo_results.json": { + "public_copy": "OpenAdaptAI/OpenAdapt:benchmarks/public-runs/agentdojo_results.json", + "sha256": "aebc4811aefc1647a5b41c59e6580c2e743a4dfbf4d24cd63a9e7a1f36beb2d7" + }, + "clean_hab_multitab_v3_scale_n50_results.json": { + "sha256": "df32a4f2c9bab95aa3cb3f5897c9318dc120aa4c661b40af940132ea35bfa906" + }, + "dim_chrome_metrics.json": { + "sha256": "00023dd5cd3733bda27963b2434b29169438a236896fbece631afc78a8638e13" + }, + "esb_fault_d_live_n16_v2_results.json": { + "sha256": "40689d97932b261233bef4ac080d78ebbe70569c92e328acc60649f04b4ec8e0" + }, + "esb_fault_d_v3_gpt62sol_results.json": { + "sha256": "748be9a9cce7dcb2a0646b02d669e541aed81634180a3343af1b7ce5a1c5d8fd" + }, + "esb_v1_live_n64_v2_results.json": { + "sha256": "332d31cf981ffe10bdd3e7a2762734961394d7fca6088d8b6432f4dc4581d54e" + }, + "exp_a_full_4app_indexed_n60_results.json": { + "sha256": "1a3a278691e2b74445ffded1884f93e78a60551eb7ea197dbdf8a55ebe5be098" + }, + "exp_hitl_cold_to_warm_n60_results.json": { + "sha256": "2c3063f3b6133dcf99a1d6176d58188ba76233697d02b06da2dd3569bd4b2258" + }, + "exp_z_zero_phi_full_4task_repair_results.json": { + "sha256": "043f8e0f2a7e677cb268195d9c8083e119a03075557295f1ea843cb0f6b3bb06" + }, + "hab_v8_longitudinal_n60_results.json": { + "sha256": "d215e035f13fb29145a7dcf8683d6fd66b369cdd057d5b41723b295af0e138f8" + }, + "osharm_live_v2_results.json": { + "public_copy": "OpenAdaptAI/OpenAdapt:benchmarks/public-runs/osharm_live_v2_results.json", + "sha256": "967d271227171a6b5327e8bda4e64970436ae701b8245d7f7461b52e5faa561a" + }, + "pixel_only_osharm_veto4b_results.json": { + "sha256": "7cbfa5cf385fa2b43162955c2d6e2f414b548ab5d1b514e41b6dbad85a864142" + }, + "stweb_scale_n40_prestep_v2_results.json": { + "sha256": "b4bce38e48abf9f4d7c982f6ffc672e1ee25b67652fd59078fed2c6b32527777" + }, + "upstream_desktop_chaos_v2_results.json": { + "sha256": "646ad0e6b7921b98013e8f2e65a7a503a2db02ce46499f2f9b2a080b7c5f2d75" + }, + "upstream_desktop_chaos_v3_6series_results.json": { + "sha256": "7134dfa693c47b74fabc55e6373c8dae0ed086597d88574f3e94ae6218da21d1" + }, + "veto4b_r6_desktop_results.json": { + "public_copy": "OpenAdaptAI/OpenAdapt:benchmarks/public-runs/veto4b_r6_desktop_results.json", + "sha256": "8894ef43fdcf051f36096e2378a08cb29ae98bea08477bed0543f88c2f654a43" + }, + "wave2_health_admin_v4_ehr_results.json": { + "sha256": "115c90b2e9392db31726b4cdf637667eac0d523a9b356bb3038a9fdbe7bc51bd" + } + }, + "paper": { + "arxiv": "2611.39728", + "title": "Screenshots Are Not State: Transactional Verification and Compilation for GUI Agents" + }, + "results": { + "agentdojo_gemini25flash": { + "benchmark": "AgentDojo v1.2.1, 4 suites, important_instructions attack", + "runs_across_4_models": 512, + "unwrapped": { + "attack_success": { + "k": 35, + "n": 48, + "pct": 72.9 + }, + "benign_utility": { + "k": 6, + "n": 16, + "pct": 37.5 + } + }, + "wrapped": { + "attack_success": { + "k": 8, + "n": 48, + "pct": 16.7 + }, + "benign_utility": { + "k": 9, + "n": 16, + "pct": 56.3 + } + } + }, + "desktop_chaos_model_upgrade": { + "after_upgrade": { + "model": "gpt-6.1-terra", + "unwrapped_success": { + "k": 25, + "n": 25, + "pct": 100.0 + } + }, + "before_upgrade": { + "model": "gpt-5.6-luna", + "unwrapped_success": { + "k": 3, + "n": 25, + "pct": 12.0 + } + }, + "benchmark": "DesktopChaosBench v0.1, 25 single-button tasks" + }, + "desktop_verifier_osworld_unseen_apps": { + "auroc": 0.7905, + "auroc_before_training": 0.6272, + "benchmark": "OSWorld-Verified, held-out apps gimp, libreoffice_calc, thunderbird, vlc", + "clean_runs": 87, + "delong_p_value": 0.005096, + "dim_the_chrome": { + "crop_px": [ + 384, + 384 + ], + "unchanged_pixel_fraction_by_theme": { + "v1": 0.957, + "v2": 0.9484, + "v2_dark": 0.9469 + }, + "unchanged_pixel_pct_mean": 95.1 + }, + "failed_runs": 73, + "median_ms": 356.88, + "n_runs": 160, + "raw_threshold": { + "false_alarms": { + "k": 8, + "n": 87, + "pct": 9.2 + }, + "missed_failures": { + "k": 33, + "n": 73, + "pct": 45.2 + } + }, + "session_start_normalized": { + "auroc": 0.7857, + "false_alarms": { + "k": 6, + "n": 87, + "pct": 6.9 + }, + "missed_failures": { + "k": 35, + "n": 73, + "pct": 47.9 + } + }, + "vram_gb": 3.154 + }, + "esb_multifault_n64": { + "benchmark": "EnterpriseSessionBench, faults A/B/C (48 runs) and D (16 runs)", + "mcnemar_p": { + "duplicate_records": 4e-06, + "silent_errors": 4e-06, + "verified": 6.1e-05 + }, + "model_call_reduction": { + "after": 399, + "before": 550, + "pct": 27.5 + }, + "unwrapped": { + "backend_api_calls": 0, + "duplicate_records": { + "k": 19, + "n": 64, + "pct": 29.7 + }, + "model_calls": 550, + "records_lost": { + "k": 8, + "n": 104, + "pct": 7.7 + }, + "silent_errors": { + "k": 19, + "n": 64, + "pct": 29.7 + }, + "verified": { + "k": 42, + "n": 64, + "pct": 65.6 + } + }, + "wrapped": { + "backend_api_calls": 0, + "duplicate_records": { + "k": 0, + "n": 64, + "pct": 0.0 + }, + "model_calls": 399, + "records_lost": { + "k": 11, + "n": 104, + "pct": 10.6 + }, + "silent_errors": { + "k": 0, + "n": 64, + "pct": 0.0 + }, + "verified": { + "k": 57, + "n": 64, + "pct": 89.1 + } + } + }, + "esb_sigkill_gen1": { + "benchmark": "EnterpriseSessionBench Fault D, SIGKILL after record 1, 2 records per run", + "model": "gpt-5.6-sol", + "unwrapped": { + "backend_api_calls": 0, + "duplicate_records": { + "k": 11, + "n": 16, + "pct": 68.8 + }, + "model_calls": 191, + "silent_errors": { + "k": 11, + "n": 16, + "pct": 68.8 + }, + "verified": { + "k": 2, + "n": 16, + "pct": 12.5 + } + }, + "wrapped": { + "backend_api_calls": 0, + "duplicate_records": { + "k": 0, + "n": 16, + "pct": 0.0 + }, + "model_calls": 193, + "silent_errors": { + "k": 0, + "n": 16, + "pct": 0.0 + }, + "verified": { + "k": 9, + "n": 16, + "pct": 56.3 + } + } + }, + "esb_sigkill_gen2": { + "benchmark": "EnterpriseSessionBench Fault D, SIGKILL after record 1, 2 records per run", + "mcnemar_p_unwrapped_vs_wrapped_fresh_state": { + "duplicate_records": 0.001953, + "silent_errors": 0.003906, + "verified": 0.000244 + }, + "model": "gpt-6.2-sol", + "unwrapped": { + "backend_api_calls": 0, + "duplicate_records": { + "k": 10, + "n": 16, + "pct": 62.5 + }, + "model_calls": 188, + "silent_errors": { + "k": 9, + "n": 16, + "pct": 56.3 + }, + "verified": { + "k": 3, + "n": 16, + "pct": 18.8 + } + }, + "wrapped_fresh_state": { + "backend_api_calls": 0, + "duplicate_records": { + "k": 0, + "n": 16, + "pct": 0.0 + }, + "model_calls": 66, + "silent_errors": { + "k": 0, + "n": 16, + "pct": 0.0 + }, + "verified": { + "k": 16, + "n": 16, + "pct": 100.0 + } + }, + "wrapped_kept_state": { + "backend_api_calls": 0, + "duplicate_records": { + "k": 0, + "n": 16, + "pct": 0.0 + }, + "model_calls": 21, + "silent_errors": { + "k": 0, + "n": 16, + "pct": 0.0 + }, + "verified": { + "k": 16, + "n": 16, + "pct": 100.0 + } + } + }, + "healthadminbench_appeals_heldout_n50": { + "benchmark": "HealthAdminBench appeals_denials, 50 held-out tasks, 10 demonstrations", + "mcnemar_p_silent_errors": 1.86e-09, + "unwrapped": { + "silent_errors": { + "k": 31, + "n": 50, + "pct": 62.0 + }, + "verified": { + "k": 19, + "n": 50, + "pct": 38.0 + } + }, + "wrapped": { + "allowed_saves_correct": { + "k": 10, + "n": 11, + "pct": 90.9 + }, + "human_touches": 0, + "silent_errors": { + "k": 1, + "n": 50, + "pct": 2.0 + }, + "verified": { + "k": 10, + "n": 50, + "pct": 20.0 + } + } + }, + "healthadminbench_scaled_n52": { + "benchmark": "HealthAdminBench, 26 tasks x 2 models", + "mcnemar_p_silent_errors": 9.3132e-10, + "unwrapped": { + "silent_errors": { + "k": 32, + "n": 52, + "pct": 61.5 + }, + "stopped_for_a_person": { + "k": 0, + "n": 52, + "pct": 0.0 + }, + "verified": { + "k": 20, + "n": 52, + "pct": 38.5 + } + }, + "wrapped": { + "silent_errors": { + "k": 1, + "n": 52, + "pct": 1.9 + }, + "stopped_for_a_person": { + "k": 45, + "n": 52, + "pct": 86.5 + }, + "verified": { + "k": 6, + "n": 52, + "pct": 11.5 + } + } + }, + "osharm_n54": { + "benchmark": "OS-Harm, 9 tasks x 3 models", + "mcnemar_p_harmful": 0.00391, + "n_runs": 54, + "unwrapped": { + "harmful": { + "k": 12, + "n": 27, + "pct": 44.4 + }, + "policy_compliant_completion": { + "k": 11, + "n": 27, + "pct": 40.7 + } + }, + "wrapped": { + "harmful": { + "k": 3, + "n": 27, + "pct": 11.1 + }, + "policy_compliant_completion": { + "k": 17, + "n": 27, + "pct": 63.0 + } + } + }, + "step_critic_osworld": { + "benchmark": "OSWorld-Verified, claude-opus-4.5 trajectories, 10 Ubuntu apps", + "clean_runs": 63, + "clean_runs_blocked": { + "k": 63, + "n": 63, + "pct": 100.0 + }, + "failed_runs": 57, + "median_ms_per_check": 2944.91, + "n_runs": 120 + }, + "stwebagentbench_3app_n44": { + "benchmark": "ST-WebAgentBench, ShoppingAdmin + GitLab + SuiteCRM, 44 tasks", + "commit_only": { + "silent_errors": { + "k": 22, + "n": 44, + "pct": 50.0 + }, + "task_completion": { + "k": 5, + "n": 44, + "pct": 11.4 + }, + "total_tokens": 2093172 + }, + "mcnemar_p_silent_errors_unwrapped_vs_wrapped": 1.86e-09, + "unwrapped": { + "silent_errors": { + "k": 42, + "n": 44, + "pct": 95.5 + }, + "task_completion": { + "k": 3, + "n": 44, + "pct": 6.8 + }, + "total_tokens": 1505674 + }, + "wrapped": { + "silent_errors": { + "k": 12, + "n": 44, + "pct": 27.3 + }, + "task_completion": { + "k": 6, + "n": 44, + "pct": 13.6 + }, + "total_tokens": 2088516 + } + }, + "ui_drift_n60": { + "after_local_repair": { + "outbound_bytes_of_field_values": 0, + "previously_failing_repaired": "4/4", + "silent_errors": 0, + "verified": { + "k": 60, + "n": 60, + "pct": 100.0 + } + }, + "benchmark": "Gitea, Vikunja, Memos and Mealie upgrades, 60 workflows", + "indexed_live_dom": { + "silent_errors": { + "k": 0, + "n": 60, + "pct": 0.0 + }, + "verified": { + "k": 56, + "n": 60, + "pct": 93.3 + } + }, + "warm_replay": { + "median_ms": 1842.7, + "model_calls": 0, + "verified": { + "k": 60, + "n": 60, + "pct": 100.0 + } + } + }, + "zero_sop_ehr_n12": { + "benchmark": "HealthAdminBench live EMR portal, 12 tasks, no clinic rules given", + "mcnemar_p_silent_errors": 0.453125, + "model": "gpt-6.1-terra", + "unwrapped": { + "silent_errors": { + "k": 5, + "n": 12, + "pct": 41.7 + }, + "verified": { + "k": 2, + "n": 12, + "pct": 16.7 + } + }, + "wrapped": { + "silent_errors": { + "k": 2, + "n": 12, + "pct": 16.7 + }, + "verified": { + "k": 0, + "n": 12, + "pct": 0.0 + } + } + } + }, + "schema": "openadapt-evals.paper-headline-counts.v1" +} diff --git a/scripts/build_paper_headline_counts.py b/scripts/build_paper_headline_counts.py new file mode 100644 index 0000000..2639a9b --- /dev/null +++ b/scripts/build_paper_headline_counts.py @@ -0,0 +1,594 @@ +#!/usr/bin/env python3 +"""Derive the headline counts of arXiv:2611.39728 from its result ledgers. + +"Screenshots Are Not State: Transactional Verification and Compilation for GUI +Agents" reports its results as counts over runs. This script reads the raw +result ledgers named in the paper's reproducibility appendix, recomputes each +count from per-run rows where the ledger has them, checks every recomputed +count against the aggregate the ledger itself recorded, and writes one small +JSON file of counts and denominators: + + docs/eval_results/screenshots_are_not_state/headline_counts.json + +The output holds counts, denominators, a few medians and the p-values the +ledgers recorded. It holds no per-run transcripts, screenshots, task text, +URLs or file system paths. Each input is identified by its file name and its +sha256, so anyone holding a ledger can confirm it is the one these counts came +from. + +Percentages are written to one decimal place with round-half-up (so 9/16 is +56.3, not the 56.2 that binary floating point formatting gives). The exact +count and denominator sit next to every percentage. + +Usage: + python scripts/build_paper_headline_counts.py --ledger-dir DIR [--ledger-dir DIR ...] + python scripts/build_paper_headline_counts.py --ledger-dir DIR --check + +Standard library only. +""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import math +import sys +from decimal import ROUND_HALF_UP, Decimal +from pathlib import Path +from typing import Any + +ROOT = Path(__file__).resolve().parents[1] +OUTPUT = ROOT / "docs" / "eval_results" / "screenshots_are_not_state" / "headline_counts.json" + +SCHEMA = "openadapt-evals.paper-headline-counts.v1" + +# Ledgers that are also published byte for byte in the public OpenAdapt +# repository. The others are not public; their sha256 is recorded instead. +PUBLIC_COPIES = { + "agentdojo_results.json": "benchmarks/public-runs/agentdojo_results.json", + "osharm_live_v2_results.json": "benchmarks/public-runs/osharm_live_v2_results.json", + "veto4b_r6_desktop_results.json": "benchmarks/public-runs/veto4b_r6_desktop_results.json", +} +PUBLIC_REPO = "OpenAdaptAI/OpenAdapt" + +LEDGERS = ( + "pixel_only_osharm_veto4b_results.json", + "veto4b_r6_desktop_results.json", + "dim_chrome_metrics.json", + "upstream_desktop_chaos_v2_results.json", + "upstream_desktop_chaos_v3_6series_results.json", + "esb_fault_d_live_n16_v2_results.json", + "esb_fault_d_v3_gpt62sol_results.json", + "esb_v1_live_n64_v2_results.json", + "exp_a_full_4app_indexed_n60_results.json", + "exp_z_zero_phi_full_4task_repair_results.json", + "exp_hitl_cold_to_warm_n60_results.json", + "clean_hab_multitab_v3_scale_n50_results.json", + "hab_v8_longitudinal_n60_results.json", + "stweb_scale_n40_prestep_v2_results.json", + "osharm_live_v2_results.json", + "agentdojo_results.json", + "wave2_health_admin_v4_ehr_results.json", +) + + +class LedgerMismatch(RuntimeError): + """A recomputed count disagrees with the ledger's own aggregate.""" + + +def pct(k: int, n: int) -> float: + """k/n as a percentage, one decimal place, round-half-up.""" + if n <= 0: + raise ValueError(f"empty denominator for {k}/{n}") + value = (Decimal(k) * 100 / Decimal(n)).quantize(Decimal("0.1"), rounding=ROUND_HALF_UP) + return float(value) + + +def ratio(k: int, n: int) -> dict[str, Any]: + if not 0 <= k <= n: + raise ValueError(f"count {k} outside 0..{n}") + return {"k": k, "n": n, "pct": pct(k, n)} + + +def agree(label: str, recomputed: Any, recorded: Any) -> None: + if isinstance(recorded, float) and isinstance(recomputed, (int, float)): + if abs(recomputed - recorded) > 5e-4: + raise LedgerMismatch(f"{label}: recomputed {recomputed}, ledger has {recorded}") + return + if recomputed != recorded: + raise LedgerMismatch(f"{label}: recomputed {recomputed}, ledger has {recorded}") + + +def mcnemar_p(b: int, c: int) -> float: + """Exact two-sided McNemar p-value from the two discordant counts.""" + n = b + c + if n == 0: + return 1.0 + tail = sum(math.comb(n, i) for i in range(min(b, c) + 1)) / 2**n + return float(f"{min(1.0, 2 * tail):.3g}") + + +def count(rows: list[dict], field: str) -> int: + return sum(1 for row in rows if row[field]) + + +def find_ledgers(dirs: list[Path]) -> dict[str, Path]: + found: dict[str, Path] = {} + for name in LEDGERS: + for directory in dirs: + hits = sorted(directory.rglob(name)) + if hits: + found[name] = hits[0] + break + else: + raise SystemExit(f"ledger {name} not found under {[str(d) for d in dirs]}") + return found + + +def sha256(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + +# --------------------------------------------------------------------------- +# one function per result +# --------------------------------------------------------------------------- + + +def step_critic(doc: dict) -> dict: + """Section 5.3, Table 5: a per-step visual critic on OSWorld-Verified.""" + arm = doc["arms"]["arm1_step_level_vlm_judge"] + agree("step critic clean runs", arm["fp"] + arm["tn"], arm["n_clean"]) + return { + "benchmark": "OSWorld-Verified, claude-opus-4.5 trajectories, 10 Ubuntu apps", + "n_runs": arm["n"], + "clean_runs": arm["n_clean"], + "failed_runs": arm["n_failures"], + "clean_runs_blocked": ratio(arm["fp"], arm["n_clean"]), + "median_ms_per_check": doc["latency_ms"]["arm1_step_level_ep_p50"], + } + + +def desktop_verifier(doc: dict, dim: dict) -> dict: + """Section 5.3: 2-frame desktop verifier on four unseen Ubuntu apps.""" + arms = doc["arms"] + raw = arms["veto4b_r6_raw_tau0"] + session = arms["veto4b_r6_session_start_z05"] + for name in ("veto4b_r6_raw_tau0", "veto4b_r6_session_start_z05"): + arm = arms[name] + agree(f"{name} clean", arm["fp"] + arm["tn"], arm["n_clean"]) + agree(f"{name} failures", arm["tp"] + arm["fn"], arm["n_failures"]) + fractions = { + theme: spec["unchanged_chrome_fraction"] for theme, spec in sorted(dim["themes"].items()) + } + mean_fraction = sum(fractions.values()) / len(fractions) + return { + "benchmark": "OSWorld-Verified, held-out apps gimp, libreoffice_calc, thunderbird, vlc", + "n_runs": raw["n"], + "clean_runs": raw["n_clean"], + "failed_runs": raw["n_failures"], + "auroc": raw["auroc"], + "auroc_before_training": arms["veto4b_r5_zeroshot_single_raw"]["auroc"], + "delong_p_value": doc["delong_paired_auroc"]["r6_vs_r5_single"]["p_value"], + "median_ms": doc["latency_ms"]["r6_2frame_p50"], + "vram_gb": doc["model"]["vram_load_gb"], + "raw_threshold": { + "false_alarms": ratio(raw["fp"], raw["n_clean"]), + "missed_failures": ratio(raw["fn"], raw["n_failures"]), + }, + "session_start_normalized": { + "auroc": session["auroc"], + "false_alarms": ratio(session["fp"], session["n_clean"]), + "missed_failures": ratio(session["fn"], session["n_failures"]), + }, + "dim_the_chrome": { + "crop_px": dim["output_size"], + "unchanged_pixel_fraction_by_theme": fractions, + "unchanged_pixel_pct_mean": float( + (Decimal(str(mean_fraction)) * 100).quantize(Decimal("0.1"), ROUND_HALF_UP) + ), + }, + } + + +def desktop_chaos(gen1: dict, gen2: dict) -> dict: + """Section 5.4: DesktopChaosBench unwrapped success across a model upgrade.""" + out: dict[str, Any] = { + "benchmark": "DesktopChaosBench v0.1, 25 single-button tasks", + } + for key, doc in (("before_upgrade", gen1), ("after_upgrade", gen2)): + tasks = doc["per_task_diagnostics"] + wins = sum(1 for task in tasks if task["arm_0"]["success"]) + agree(f"{key} task count", len(tasks), doc["n_tasks"]) + agree( + f"{key} unwrapped success", + wins / len(tasks), + doc["scoreboard_by_arm"]["arm_0_unwrapped"]["avc_0"], + ) + out[key] = { + "model": doc["model_id"].split(":", 1)[-1], + "unwrapped_success": ratio(wins, len(tasks)), + } + return out + + +def _esb_arm(rows: list[dict], verified_field: str) -> dict: + return { + "verified": ratio(count(rows, verified_field), len(rows)), + "duplicate_records": ratio(count(rows, "duplicate_mutation"), len(rows)), + "silent_errors": ratio(count(rows, "silent_error"), len(rows)), + "model_calls": sum(row["llm_calls"] for row in rows), + "backend_api_calls": sum(row["backend_api_calls_during_episode"] for row in rows), + } + + +def _check_esb(label: str, arm: dict, recorded: dict) -> None: + agree(f"{label} verified", arm["verified"]["k"], recorded["verified_exact_once"]) + agree(f"{label} duplicates", arm["duplicate_records"]["k"], recorded["duplicate_mutations"]) + agree(f"{label} silent errors", arm["silent_errors"]["k"], recorded["silent_errors"]) + agree(f"{label} model calls", arm["model_calls"], recorded["total_llm_calls"]) + agree(f"{label} n", arm["verified"]["n"], recorded["n"]) + + +def esb_sigkill_gen1(doc: dict) -> dict: + """Table 7, SIGKILL Gen 1: gpt-5.6-sol, crash after record 1.""" + unwrapped = _esb_arm(doc["rows_unwrapped"], "exact_once") + wrapped = _esb_arm(doc["rows_wrapped"], "exact_once") + _check_esb("gen1 unwrapped", unwrapped, doc["arms"]["unwrapped"]) + _check_esb("gen1 wrapped", wrapped, doc["arms"]["openadapt_wrap"]) + return { + "benchmark": "EnterpriseSessionBench Fault D, SIGKILL after record 1, 2 records per run", + "model": "gpt-5.6-sol", + "unwrapped": unwrapped, + "wrapped": wrapped, + } + + +def esb_sigkill_gen2(doc: dict) -> dict: + """Table 7, SIGKILL Gen 2: gpt-6.2-sol, crash after record 1.""" + rows = doc["rows"] + arms = { + "unwrapped": _esb_arm(rows["unwrapped"], "exact_once"), + "wrapped_fresh_state": _esb_arm(rows["wrapped_iid"], "exact_once"), + "wrapped_kept_state": _esb_arm(rows["wrapped_cl"], "exact_once"), + } + recorded = { + "unwrapped": "unwrapped", + "wrapped_fresh_state": "wrapped_iid", + "wrapped_kept_state": "wrapped_cl", + } + for key, source in recorded.items(): + _check_esb(f"gen2 {key}", arms[key], doc["arms"][source]) + tests = doc["mcnemar_exact_two_sided"]["unwrapped_vs_wrapped_iid"] + return { + "benchmark": "EnterpriseSessionBench Fault D, SIGKILL after record 1, 2 records per run", + "model": "gpt-6.2-sol", + **arms, + "mcnemar_p_unwrapped_vs_wrapped_fresh_state": { + "verified": tests["verified_completion_rate"]["p_value"], + "duplicate_records": tests["duplicate_mutation"]["p_value"], + "silent_errors": tests["ser"]["p_value"], + }, + } + + +def esb_multifault(doc: dict, gen1: dict) -> dict: + """Table 7, Multi-Fault N=64: faults A, B, C (48 runs) plus fault D (16 runs).""" + out: dict[str, Any] = { + "benchmark": "EnterpriseSessionBench, faults A/B/C (48 runs) and D (16 runs)", + } + names = {"unwrapped": "unwrapped", "wrapped": "openadapt_wrap"} + for key, source in names.items(): + total = doc["arms"][source] + parts = [doc["by_suite"][suite][source] for suite in sorted(doc["by_suite"])] + for field in ( + "n", + "target_records", + "verified_exact_once", + "duplicate_mutations", + "silent_errors", + "items_lost", + "total_llm_calls", + ): + agree(f"n64 {key} {field}", sum(part[field] for part in parts), total[field]) + # The fault D share is the Gen 1 SIGKILL ledger. + fault_d = doc["by_suite"]["fault_d_sigkill_n16_v2"][source] + agree(f"n64 {key} fault D verified", fault_d["verified_exact_once"], + gen1[key]["verified"]["k"]) + agree(f"n64 {key} fault D duplicates", fault_d["duplicate_mutations"], + gen1[key]["duplicate_records"]["k"]) + out[key] = { + "verified": ratio(total["verified_exact_once"], total["n"]), + "duplicate_records": ratio(total["duplicate_mutations"], total["n"]), + "silent_errors": ratio(total["silent_errors"], total["n"]), + "records_lost": ratio(total["items_lost"], total["target_records"]), + "model_calls": total["total_llm_calls"], + "backend_api_calls": total["backend_api_calls_during_run"], + } + before = out["unwrapped"]["model_calls"] + after = out["wrapped"]["model_calls"] + out["model_call_reduction"] = { + "before": before, + "after": after, + "pct": pct(before - after, before), + } + tests = doc["mcnemar_exact_two_sided_n64"] + out["mcnemar_p"] = { + "verified": tests["exact_once"]["p_value"], + "duplicate_records": tests["duplicate_mutation"]["p_value"], + "silent_errors": tests["silent_error"]["p_value"], + } + return out + + +def ui_drift(indexed: dict, repair: dict, warm: dict) -> dict: + """Section 5.4, Table 6: 60 workflows replayed after four app upgrades.""" + per_app = 0 + for spec in indexed["per_app"].values(): + per_app += int(spec.split("/", 1)[0]) + agree("indexed per-app sum", per_app, indexed["total_verified"]) + warm_arm = warm["warm_compiled_verified_completion"] + return { + "benchmark": "Gitea, Vikunja, Memos and Mealie upgrades, 60 workflows", + "indexed_live_dom": { + "verified": ratio(indexed["total_verified"], indexed["n"]), + "silent_errors": ratio(indexed["silent_errors"], indexed["n"]), + }, + "after_local_repair": { + "previously_failing_repaired": repair["previously_failing_repaired"], + "verified": ratio( + int(repair["after_n60_verified"].split("/", 1)[0]), + int(repair["after_n60_verified"].split("/", 1)[1].split()[0]), + ), + "silent_errors": repair["silent_errors"], + "outbound_bytes_of_field_values": repair["outbound_phi_bytes_leaked"], + }, + "warm_replay": { + "verified": ratio(warm_arm["verified_count"], warm_arm["n"]), + "model_calls": warm_arm["llm_calls"], + "median_ms": warm_arm["warm_p50_latency_ms"], + }, + } + + +def hab_scaled(doc: dict) -> dict: + """Table 3, Scaled Frontier N=52 (26 tasks x 2 models).""" + arms = doc["arms"] + before = arms["baseline_gpt54"]["episodes"] + arms["baseline_claude55"]["episodes"] + after = ( + arms["clean_multitab_jit_gpt54"]["episodes"] + + arms["clean_multitab_jit_claude55"]["episodes"] + ) + pooled = doc["pooled_n52"] + out = {"benchmark": "HealthAdminBench, 26 tasks x 2 models"} + for key, rows, recorded in ( + ("unwrapped", before, pooled["baseline"]), + ("wrapped", after, pooled["clean_multitab_jit_v3"]), + ): + arm = { + "silent_errors": ratio(count(rows, "ser"), len(rows)), + "verified": ratio(count(rows, "avc"), len(rows)), + "stopped_for_a_person": ratio(count(rows, "escalated"), len(rows)), + } + agree(f"hab52 {key} ser", arm["silent_errors"]["k"], recorded["ser_count"]) + agree(f"hab52 {key} avc", arm["verified"]["k"], recorded["avc_count"]) + agree(f"hab52 {key} escalated", arm["stopped_for_a_person"]["k"], + recorded["escalation_count"]) + out[key] = arm + out["mcnemar_p_silent_errors"] = pooled["mcnemar_ser"]["p_value"] + return out + + +def hab_appeals(doc: dict) -> dict: + """Table 3, Appeals Held-Out N=50, 10 demonstrations, zero human touches.""" + pooled = doc["pooled_heldout_n50"] + before = pooled["summaries"]["pooled50_unwrapped_g4"] + after = pooled["summaries"]["pooled50_w1_auto_0touch"] + allowed_k, allowed_n = (int(x) for x in after["commit_precision"].split("/")) + agree("appeals allowed-and-correct", allowed_k, after["avc"]) + return { + "benchmark": "HealthAdminBench appeals_denials, 50 held-out tasks, 10 demonstrations", + "unwrapped": { + "silent_errors": ratio(before["ser"], before["n"]), + "verified": ratio(before["avc"], before["n"]), + }, + "wrapped": { + "silent_errors": ratio(after["ser"], after["n"]), + "verified": ratio(after["avc"], after["n"]), + "allowed_saves_correct": ratio(allowed_k, allowed_n), + "human_touches": after["total_human_touches"], + }, + "mcnemar_p_silent_errors": mcnemar_p( + pooled["paired_mcnemar_exact"]["unwrapped_vs_w1_auto"]["ser"]["a_only_true"], + pooled["paired_mcnemar_exact"]["unwrapped_vs_w1_auto"]["ser"]["b_only_true"], + ), + } + + +def stweb(doc: dict) -> dict: + """Table 4, 3-App N=44 (gpt-5.4): unwrapped vs policy checks and PREPARE.""" + arms = { + "unwrapped": doc["arms"]["arm0_unwrapped_gpt54"], + "commit_only": doc["arms"]["arm2_commitjit_idea15"], + "wrapped": doc["arms"]["arm3_prestep_prepare_v2"], + } + out: dict[str, Any] = { + "benchmark": "ST-WebAgentBench, ShoppingAdmin + GitLab + SuiteCRM, 44 tasks", + } + for key, arm in arms.items(): + rows = arm["episodes"] + agg = arm["aggregate"] + completed = count(rows, "completed") + agree(f"stweb {key} completed", completed, agg["cr_count"]) + agree(f"stweb {key} n", len(rows), agg["n"]) + out[key] = { + "silent_errors": ratio(agg["ser_count"], agg["n"]), + "task_completion": ratio(completed, len(rows)), + "total_tokens": agg["total_tokens"], + } + test = doc["mcnemar_tests"]["arm0_unwrapped_gpt54_vs_arm3_prestep_prepare_v2"]["pooled"] + out["mcnemar_p_silent_errors_unwrapped_vs_wrapped"] = mcnemar_p( + test["ser"]["b_only_a"], test["ser"]["c_only_b"] + ) + return out + + +def osharm(doc: Any) -> dict: + """Section 5.2: official OS-Harm, 9 tasks x 3 models x 2 arms.""" + runs = doc["runs"] if isinstance(doc, dict) else doc + out: dict[str, Any] = {"benchmark": "OS-Harm, 9 tasks x 3 models", "n_runs": len(runs)} + for key, arm in (("unwrapped", "unverified"), ("wrapped", "openadapt_verified")): + rows = [run for run in runs if run["arm"] == arm] + out[key] = { + "harmful": ratio(count(rows, "harm_or_policy_violation"), len(rows)), + "policy_compliant_completion": ratio(count(rows, "cup"), len(rows)), + } + by_pair: dict[tuple[str, str], dict[str, bool]] = {} + for run in runs: + by_pair.setdefault((run["model"], run["task_id"]), {})[run["arm"]] = run[ + "harm_or_policy_violation" + ] + b = sum(1 for pair in by_pair.values() if pair["unverified"] and not pair["openadapt_verified"]) + c = sum(1 for pair in by_pair.values() if pair["openadapt_verified"] and not pair["unverified"]) + out["mcnemar_p_harmful"] = mcnemar_p(b, c) + return out + + +def zero_sop_ehr(doc: dict) -> dict: + """Table 3, Zero-SOP EHR N=12: HealthAdminBench live EMR portal, no clinic rules.""" + tasks = doc["per_task_diagnostics"] + out: dict[str, Any] = { + "benchmark": "HealthAdminBench live EMR portal, 12 tasks, no clinic rules given", + "model": doc["model_id"].split(":", 1)[-1], + } + for key, arm in (("unwrapped", "arm_0"), ("wrapped", "arm_3")): + rows = [task[arm] for task in tasks] + verified = count(rows, "vcr_hit") + silent = count(rows, "ser_hit") + board = doc["scoreboard_by_arm"][f"{arm}_{key}"] + agree(f"ehr {key} vcr", verified / len(rows), board["verified_completion_rate"]) + agree(f"ehr {key} ser", silent / len(rows), board["ser"]) + out[key] = { + "verified": ratio(verified, len(rows)), + "silent_errors": ratio(silent, len(rows)), + } + out["mcnemar_p_silent_errors"] = doc["mcnemar_exact_p"]["arm_3_vs_arm_0_ser"] + return out + + +def agentdojo(doc: dict) -> dict: + """Section 5.2: AgentDojo v1.2.1, gemini-2.5-flash, 4 suites.""" + arms = doc["models"]["google:gemini-2.5-flash"]["arms"] + total = 0 + for model in doc["models"].values(): + for arm in model["arms"].values(): + total += arm["aggregate"]["benign_n"] + arm["aggregate"]["attack_n"] + out: dict[str, Any] = { + "benchmark": "AgentDojo v1.2.1, 4 suites, important_instructions attack", + "runs_across_4_models": total, + } + for key, arm in (("unwrapped", "unverified"), ("wrapped", "openadapt_guard")): + agg = arms[arm]["aggregate"] + out[key] = { + "attack_success": ratio(agg["attack_success_count"], agg["attack_n"]), + "benign_utility": ratio(agg["benign_utility_pass"], agg["benign_n"]), + } + return out + + +# --------------------------------------------------------------------------- + + +def build(paths: dict[str, Path]) -> dict: + docs = {name: json.loads(path.read_text(encoding="utf-8")) for name, path in paths.items()} + gen1 = esb_sigkill_gen1(docs["esb_fault_d_live_n16_v2_results.json"]) + results = { + "step_critic_osworld": step_critic(docs["pixel_only_osharm_veto4b_results.json"]), + "desktop_verifier_osworld_unseen_apps": desktop_verifier( + docs["veto4b_r6_desktop_results.json"], docs["dim_chrome_metrics.json"] + ), + "desktop_chaos_model_upgrade": desktop_chaos( + docs["upstream_desktop_chaos_v2_results.json"], + docs["upstream_desktop_chaos_v3_6series_results.json"], + ), + "esb_sigkill_gen1": gen1, + "esb_sigkill_gen2": esb_sigkill_gen2(docs["esb_fault_d_v3_gpt62sol_results.json"]), + "esb_multifault_n64": esb_multifault(docs["esb_v1_live_n64_v2_results.json"], gen1), + "ui_drift_n60": ui_drift( + docs["exp_a_full_4app_indexed_n60_results.json"], + docs["exp_z_zero_phi_full_4task_repair_results.json"], + docs["exp_hitl_cold_to_warm_n60_results.json"], + ), + "healthadminbench_scaled_n52": hab_scaled( + docs["clean_hab_multitab_v3_scale_n50_results.json"] + ), + "healthadminbench_appeals_heldout_n50": hab_appeals( + docs["hab_v8_longitudinal_n60_results.json"] + ), + "stwebagentbench_3app_n44": stweb(docs["stweb_scale_n40_prestep_v2_results.json"]), + "osharm_n54": osharm(docs["osharm_live_v2_results.json"]), + "agentdojo_gemini25flash": agentdojo(docs["agentdojo_results.json"]), + "zero_sop_ehr_n12": zero_sop_ehr(docs["wave2_health_admin_v4_ehr_results.json"]), + } + inputs = {} + for name in sorted(paths): + entry: dict[str, Any] = {"sha256": sha256(paths[name])} + if name in PUBLIC_COPIES: + entry["public_copy"] = f"{PUBLIC_REPO}:{PUBLIC_COPIES[name]}" + inputs[name] = entry + return { + "_comment": [ + "Headline counts of arXiv:2611.39728, derived from the result ledgers", + "listed in 'inputs' by scripts/build_paper_headline_counts.py.", + "Every ratio is {k, n, pct}; pct is 100*k/n to one decimal, round-half-up.", + "Regenerate with --ledger-dir; --check fails if this file would change.", + ], + "schema": SCHEMA, + "paper": { + "title": ( + "Screenshots Are Not State: Transactional Verification and " + "Compilation for GUI Agents" + ), + "arxiv": "2611.39728", + }, + "inputs": inputs, + "results": results, + } + + +def render(summary: dict) -> str: + return json.dumps(summary, indent=2, sort_keys=True) + "\n" + + +def main(argv: list[str]) -> int: + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument( + "--ledger-dir", + action="append", + required=True, + type=Path, + help="directory searched (recursively) for the ledgers; repeatable", + ) + parser.add_argument("--output", type=Path, default=OUTPUT) + parser.add_argument( + "--check", + action="store_true", + help="exit 1 if the committed output differs from a fresh build", + ) + args = parser.parse_args(argv) + text = render(build(find_ledgers(args.ledger_dir))) + if args.check: + current = args.output.read_text(encoding="utf-8") if args.output.is_file() else "" + if current != text: + print(f"{args.output} is out of date; rerun without --check", file=sys.stderr) + return 1 + print(f"{args.output} matches the ledgers") + return 0 + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(text, encoding="utf-8") + print(f"wrote {args.output}") + return 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/tests/test_paper_headline_counts.py b/tests/test_paper_headline_counts.py new file mode 100644 index 0000000..cac26ac --- /dev/null +++ b/tests/test_paper_headline_counts.py @@ -0,0 +1,63 @@ +"""The published paper headline counts stay internally consistent. + +The ledgers the counts come from are not all public, so this test cannot +rebuild the file. It checks what a reader can check without them: every +percentage equals its own count over its own denominator, and the file carries +no paths, URLs or per-run rows. +""" + +from __future__ import annotations + +import json +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "scripts")) + +import build_paper_headline_counts as builder # noqa: E402 + +SUMMARY = builder.OUTPUT + + +def _ratios(node, where=""): + if isinstance(node, dict): + if set(node) == {"k", "n", "pct"}: + yield where, node + return + for key, value in node.items(): + yield from _ratios(value, f"{where}/{key}") + elif isinstance(node, list): + for index, value in enumerate(node): + yield from _ratios(value, f"{where}/{index}") + + +def test_every_percentage_matches_its_counts(): + summary = json.loads(SUMMARY.read_text(encoding="utf-8")) + ratios = list(_ratios(summary["results"])) + assert ratios, "no {k, n, pct} ratios found" + for where, ratio in ratios: + assert 0 <= ratio["k"] <= ratio["n"], where + assert ratio["pct"] == builder.pct(ratio["k"], ratio["n"]), where + + +def test_half_up_rounding(): + assert builder.pct(9, 16) == 56.3 + assert builder.pct(3, 16) == 18.8 + assert builder.pct(42, 64) == 65.6 + + +def test_exact_mcnemar(): + assert builder.mcnemar_p(30, 0) == 1.86e-09 + assert builder.mcnemar_p(0, 0) == 1.0 + + +def test_file_is_canonical_and_carries_no_paths(): + text = SUMMARY.read_text(encoding="utf-8") + assert text == builder.render(json.loads(text)) + for marker in ("/Users/", "/home/", "http://", "https://", "C:\\"): + assert marker not in text + summary = json.loads(text) + assert sorted(summary["inputs"]) == sorted(builder.LEDGERS) + for entry in summary["inputs"].values(): + assert len(entry["sha256"]) == 64 From 9a2b53ace3097c4be2f8bb280d159b5844cee24b Mon Sep 17 00:00:00 2001 From: abrichr Date: Tue, 1 Dec 2026 10:47:30 -0500 Subject: [PATCH 2/5] docs: label the step-critic latency as a per-run total The ledger's arm1_step_level_ep_p50 is the median over runs of the critic latency summed over every step checked, not the latency of one check. Rename the key, say which inputs the paper's appendix does not name, and drop table and section numbers that were not checked against the paper. --- .../headline_counts.json | 2 +- scripts/build_paper_headline_counts.py | 36 ++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/eval_results/screenshots_are_not_state/headline_counts.json b/docs/eval_results/screenshots_are_not_state/headline_counts.json index df07c26..dcb3228 100644 --- a/docs/eval_results/screenshots_are_not_state/headline_counts.json +++ b/docs/eval_results/screenshots_are_not_state/headline_counts.json @@ -440,7 +440,7 @@ "pct": 100.0 }, "failed_runs": 57, - "median_ms_per_check": 2944.91, + "median_ms_per_run_all_steps": 2944.91, "n_runs": 120 }, "stwebagentbench_3app_n44": { diff --git a/scripts/build_paper_headline_counts.py b/scripts/build_paper_headline_counts.py index 2639a9b..1b4b999 100644 --- a/scripts/build_paper_headline_counts.py +++ b/scripts/build_paper_headline_counts.py @@ -3,8 +3,10 @@ "Screenshots Are Not State: Transactional Verification and Compilation for GUI Agents" reports its results as counts over runs. This script reads the raw -result ledgers named in the paper's reproducibility appendix, recomputes each -count from per-run rows where the ledger has them, checks every recomputed +result ledgers those counts were computed from (most are named in the paper's +reproducibility appendix; dim_chrome_metrics, exp_hitl_cold_to_warm_n60, +osharm_live_v2 and agentdojo_results are not), recomputes each count from +per-run rows where the ledger has them, checks every recomputed count against the aggregate the ledger itself recorded, and writes one small JSON file of counts and denominators: @@ -136,7 +138,7 @@ def sha256(path: Path) -> str: def step_critic(doc: dict) -> dict: - """Section 5.3, Table 5: a per-step visual critic on OSWorld-Verified.""" + """A per-step visual critic on OSWorld-Verified.""" arm = doc["arms"]["arm1_step_level_vlm_judge"] agree("step critic clean runs", arm["fp"] + arm["tn"], arm["n_clean"]) return { @@ -145,12 +147,14 @@ def step_critic(doc: dict) -> dict: "clean_runs": arm["n_clean"], "failed_runs": arm["n_failures"], "clean_runs_blocked": ratio(arm["fp"], arm["n_clean"]), - "median_ms_per_check": doc["latency_ms"]["arm1_step_level_ep_p50"], + # The ledger's arm1_step_level_ep_p50 is the median, over runs, of the + # critic latency summed over every step checked in the run. + "median_ms_per_run_all_steps": doc["latency_ms"]["arm1_step_level_ep_p50"], } def desktop_verifier(doc: dict, dim: dict) -> dict: - """Section 5.3: 2-frame desktop verifier on four unseen Ubuntu apps.""" + """2-frame desktop verifier on four unseen Ubuntu apps.""" arms = doc["arms"] raw = arms["veto4b_r6_raw_tau0"] session = arms["veto4b_r6_session_start_z05"] @@ -192,7 +196,7 @@ def desktop_verifier(doc: dict, dim: dict) -> dict: def desktop_chaos(gen1: dict, gen2: dict) -> dict: - """Section 5.4: DesktopChaosBench unwrapped success across a model upgrade.""" + """DesktopChaosBench unwrapped success across a model upgrade.""" out: dict[str, Any] = { "benchmark": "DesktopChaosBench v0.1, 25 single-button tasks", } @@ -231,7 +235,7 @@ def _check_esb(label: str, arm: dict, recorded: dict) -> None: def esb_sigkill_gen1(doc: dict) -> dict: - """Table 7, SIGKILL Gen 1: gpt-5.6-sol, crash after record 1.""" + """EnterpriseSessionBench SIGKILL, generation 1: gpt-5.6-sol, crash after record 1.""" unwrapped = _esb_arm(doc["rows_unwrapped"], "exact_once") wrapped = _esb_arm(doc["rows_wrapped"], "exact_once") _check_esb("gen1 unwrapped", unwrapped, doc["arms"]["unwrapped"]) @@ -245,7 +249,7 @@ def esb_sigkill_gen1(doc: dict) -> dict: def esb_sigkill_gen2(doc: dict) -> dict: - """Table 7, SIGKILL Gen 2: gpt-6.2-sol, crash after record 1.""" + """EnterpriseSessionBench SIGKILL, generation 2: gpt-6.2-sol, crash after record 1.""" rows = doc["rows"] arms = { "unwrapped": _esb_arm(rows["unwrapped"], "exact_once"), @@ -273,7 +277,7 @@ def esb_sigkill_gen2(doc: dict) -> dict: def esb_multifault(doc: dict, gen1: dict) -> dict: - """Table 7, Multi-Fault N=64: faults A, B, C (48 runs) plus fault D (16 runs).""" + """EnterpriseSessionBench, N=64: faults A, B, C (48 runs) plus fault D (16 runs).""" out: dict[str, Any] = { "benchmark": "EnterpriseSessionBench, faults A/B/C (48 runs) and D (16 runs)", } @@ -322,7 +326,7 @@ def esb_multifault(doc: dict, gen1: dict) -> dict: def ui_drift(indexed: dict, repair: dict, warm: dict) -> dict: - """Section 5.4, Table 6: 60 workflows replayed after four app upgrades.""" + """60 workflows replayed after four app upgrades.""" per_app = 0 for spec in indexed["per_app"].values(): per_app += int(spec.split("/", 1)[0]) @@ -352,7 +356,7 @@ def ui_drift(indexed: dict, repair: dict, warm: dict) -> dict: def hab_scaled(doc: dict) -> dict: - """Table 3, Scaled Frontier N=52 (26 tasks x 2 models).""" + """HealthAdminBench, N=52 (26 tasks x 2 models).""" arms = doc["arms"] before = arms["baseline_gpt54"]["episodes"] + arms["baseline_claude55"]["episodes"] after = ( @@ -380,7 +384,7 @@ def hab_scaled(doc: dict) -> dict: def hab_appeals(doc: dict) -> dict: - """Table 3, Appeals Held-Out N=50, 10 demonstrations, zero human touches.""" + """HealthAdminBench appeals, 50 held-out tasks, 10 demonstrations, zero human touches.""" pooled = doc["pooled_heldout_n50"] before = pooled["summaries"]["pooled50_unwrapped_g4"] after = pooled["summaries"]["pooled50_w1_auto_0touch"] @@ -406,7 +410,7 @@ def hab_appeals(doc: dict) -> dict: def stweb(doc: dict) -> dict: - """Table 4, 3-App N=44 (gpt-5.4): unwrapped vs policy checks and PREPARE.""" + """ST-WebAgentBench, 3 apps, N=44 (gpt-5.4): unwrapped vs policy checks and PREPARE.""" arms = { "unwrapped": doc["arms"]["arm0_unwrapped_gpt54"], "commit_only": doc["arms"]["arm2_commitjit_idea15"], @@ -434,7 +438,7 @@ def stweb(doc: dict) -> dict: def osharm(doc: Any) -> dict: - """Section 5.2: official OS-Harm, 9 tasks x 3 models x 2 arms.""" + """Official OS-Harm, 9 tasks x 3 models x 2 arms.""" runs = doc["runs"] if isinstance(doc, dict) else doc out: dict[str, Any] = {"benchmark": "OS-Harm, 9 tasks x 3 models", "n_runs": len(runs)} for key, arm in (("unwrapped", "unverified"), ("wrapped", "openadapt_verified")): @@ -455,7 +459,7 @@ def osharm(doc: Any) -> dict: def zero_sop_ehr(doc: dict) -> dict: - """Table 3, Zero-SOP EHR N=12: HealthAdminBench live EMR portal, no clinic rules.""" + """Zero-SOP EHR, N=12: HealthAdminBench live EMR portal, no clinic rules.""" tasks = doc["per_task_diagnostics"] out: dict[str, Any] = { "benchmark": "HealthAdminBench live EMR portal, 12 tasks, no clinic rules given", @@ -477,7 +481,7 @@ def zero_sop_ehr(doc: dict) -> dict: def agentdojo(doc: dict) -> dict: - """Section 5.2: AgentDojo v1.2.1, gemini-2.5-flash, 4 suites.""" + """AgentDojo v1.2.1, gemini-2.5-flash, 4 suites.""" arms = doc["models"]["google:gemini-2.5-flash"]["arms"] total = 0 for model in doc["models"].values(): From a5db0ea501ce65c5ed7c91c8a2b7b7d731372196 Mon Sep 17 00:00:00 2001 From: abrichr Date: Tue, 1 Dec 2026 10:55:00 -0500 Subject: [PATCH 3/5] docs: add per-check critic latency and the ST-Web token increase Record the step critic's median per-check latency (each run stores its summed critic time and the number of steps checked) and the wrapped ST-WebAgentBench arm's token use relative to the unwrapped arm. --- .../headline_counts.json | 6 ++++- scripts/build_paper_headline_counts.py | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/eval_results/screenshots_are_not_state/headline_counts.json b/docs/eval_results/screenshots_are_not_state/headline_counts.json index dcb3228..ed1276e 100644 --- a/docs/eval_results/screenshots_are_not_state/headline_counts.json +++ b/docs/eval_results/screenshots_are_not_state/headline_counts.json @@ -440,8 +440,11 @@ "pct": 100.0 }, "failed_runs": 57, + "max_steps_checked_per_run": 6, + "median_ms_per_check": 492.3, "median_ms_per_run_all_steps": 2944.91, - "n_runs": 120 + "n_runs": 120, + "steps_checked": 676 }, "stwebagentbench_3app_n44": { "benchmark": "ST-WebAgentBench, ShoppingAdmin + GitLab + SuiteCRM, 44 tasks", @@ -483,6 +486,7 @@ "n": 44, "pct": 13.6 }, + "token_increase_vs_unwrapped_pct": 38.7, "total_tokens": 2088516 } }, diff --git a/scripts/build_paper_headline_counts.py b/scripts/build_paper_headline_counts.py index 1b4b999..8f280ca 100644 --- a/scripts/build_paper_headline_counts.py +++ b/scripts/build_paper_headline_counts.py @@ -35,6 +35,7 @@ import hashlib import json import math +import statistics import sys from decimal import ROUND_HALF_UP, Decimal from pathlib import Path @@ -141,6 +142,17 @@ def step_critic(doc: dict) -> dict: """A per-step visual critic on OSWorld-Verified.""" arm = doc["arms"]["arm1_step_level_vlm_judge"] agree("step critic clean runs", arm["fp"] + arm["tn"], arm["n_clean"]) + runs = doc["per_item_predictions"] + agree("step critic run count", len(runs), arm["n"]) + per_run_ms = [run["arm1_ep_latency_ms"] for run in runs] + # Per-run latencies are stored to 0.1 ms, so compare at that precision. + agree("step critic per-run median", round(statistics.median(per_run_ms), 1), + round(doc["latency_ms"]["arm1_step_level_ep_p50"], 1)) + clean = [run for run in runs if run["is_failure"] == 0] + agree("step critic clean blocked", count(clean, "arm1_step_vetoed"), arm["fp"]) + per_check_ms = [ + run["arm1_ep_latency_ms"] / run["n_steps_evaluated_arm1"] for run in runs + ] return { "benchmark": "OSWorld-Verified, claude-opus-4.5 trajectories, 10 Ubuntu apps", "n_runs": arm["n"], @@ -150,6 +162,11 @@ def step_critic(doc: dict) -> dict: # The ledger's arm1_step_level_ep_p50 is the median, over runs, of the # critic latency summed over every step checked in the run. "median_ms_per_run_all_steps": doc["latency_ms"]["arm1_step_level_ep_p50"], + # Each run records its summed critic time and how many steps were + # checked; this is the median over runs of that run's mean per check. + "median_ms_per_check": round(statistics.median(per_check_ms), 1), + "steps_checked": sum(run["n_steps_evaluated_arm1"] for run in runs), + "max_steps_checked_per_run": max(run["n_steps_evaluated_arm1"] for run in runs), } @@ -430,6 +447,12 @@ def stweb(doc: dict) -> dict: "task_completion": ratio(completed, len(rows)), "total_tokens": agg["total_tokens"], } + before = out["unwrapped"]["total_tokens"] + out["wrapped"]["token_increase_vs_unwrapped_pct"] = float( + (Decimal(out["wrapped"]["total_tokens"] - before) * 100 / Decimal(before)).quantize( + Decimal("0.1"), rounding=ROUND_HALF_UP + ) + ) test = doc["mcnemar_tests"]["arm0_unwrapped_gpt54_vs_arm3_prestep_prepare_v2"]["pooled"] out["mcnemar_p_silent_errors_unwrapped_vs_wrapped"] = mcnemar_p( test["ser"]["b_only_a"], test["ser"]["c_only_b"] From 7bf4203dc01af995b697981e42e7a758b928af29 Mon Sep 17 00:00:00 2001 From: abrichr Date: Tue, 1 Dec 2026 11:14:47 -0500 Subject: [PATCH 4/5] docs: measure the desktop verifier's dimmed share on the 160 held-out runs Add scripts/measure_desktop_dim_share.py, which replays the evaluation runner's dim_the_chrome on the first and last frame of each held-out OSWorld-Verified run, read in place from the public trajectory archives. The headline counts gain a per-app summary of the dimmed share; the per-run file is an input recorded by sha256. --- .../headline_counts.json | 146 ++++++++++++ scripts/build_paper_headline_counts.py | 57 ++++- scripts/measure_desktop_dim_share.py | 222 ++++++++++++++++++ tests/test_paper_headline_counts.py | 11 + 4 files changed, 435 insertions(+), 1 deletion(-) create mode 100644 scripts/measure_desktop_dim_share.py diff --git a/docs/eval_results/screenshots_are_not_state/headline_counts.json b/docs/eval_results/screenshots_are_not_state/headline_counts.json index ed1276e..f136583 100644 --- a/docs/eval_results/screenshots_are_not_state/headline_counts.json +++ b/docs/eval_results/screenshots_are_not_state/headline_counts.json @@ -41,6 +41,9 @@ "public_copy": "OpenAdaptAI/OpenAdapt:benchmarks/public-runs/osharm_live_v2_results.json", "sha256": "967d271227171a6b5327e8bda4e64970436ae701b8245d7f7461b52e5faa561a" }, + "osworld_desktop_dim_share_runs.json": { + "sha256": "c930abe3389db45cc36a9c115a5486ee6b5e24c5579db06dae0d18ec40e7d233" + }, "pixel_only_osharm_veto4b_results.json": { "sha256": "7cbfa5cf385fa2b43162955c2d6e2f414b548ab5d1b514e41b6dbad85a864142" }, @@ -113,6 +116,149 @@ }, "benchmark": "DesktopChaosBench v0.1, 25 single-button tasks" }, + "desktop_dimming_osworld_unseen_apps": { + "after_frame": { + "max_pct": 93.4, + "median_pct": 75.1, + "min_pct": 9.8, + "n": 160 + }, + "after_frame_click": { + "max_pct": 93.4, + "median_pct": 78.9, + "min_pct": 75.1, + "n": 102 + }, + "after_frame_last_action_is_click": { + "k": 102, + "n": 160, + "pct": 63.8 + }, + "after_frame_no_click": { + "max_pct": 9.8, + "median_pct": 9.8, + "min_pct": 9.8, + "n": 58 + }, + "archives_sha256": { + "autoglm_15steps.zip": "5a5dd328721dd81085b912888bf97f9174699b987de94a70abc93ff557ef78fe", + "results_agent_s2_o3_15steps.zip": "ba903a669e76f530b736fccccd50b0e7d1fbbbe611d948eec8b1716f9ce3b01c", + "results_opus4p5_single_agent.zip": "5a35efde68e09d4289227b97e22ea174898e27dca30f59f987a5117dc3a32509" + }, + "before_frame": { + "max_pct": 9.8, + "median_pct": 9.8, + "min_pct": 9.8, + "n": 160 + }, + "benchmark": "OSWorld-Verified, held-out apps gimp, libreoffice_calc, thunderbird, vlc", + "by_app": { + "gimp": { + "after_frame": { + "max_pct": 93.1, + "median_pct": 75.1, + "min_pct": 9.8, + "n": 40 + }, + "after_frame_click": { + "max_pct": 93.1, + "median_pct": 80.4, + "min_pct": 75.1, + "n": 25 + }, + "after_frame_last_action_is_click": { + "k": 25, + "n": 40, + "pct": 62.5 + }, + "before_frame": { + "max_pct": 9.8, + "median_pct": 9.8, + "min_pct": 9.8, + "n": 40 + } + }, + "libreoffice_calc": { + "after_frame": { + "max_pct": 90.2, + "median_pct": 9.8, + "min_pct": 9.8, + "n": 40 + }, + "after_frame_click": { + "max_pct": 90.2, + "median_pct": 78.7, + "min_pct": 75.1, + "n": 18 + }, + "after_frame_last_action_is_click": { + "k": 18, + "n": 40, + "pct": 45.0 + }, + "before_frame": { + "max_pct": 9.8, + "median_pct": 9.8, + "min_pct": 9.8, + "n": 40 + } + }, + "thunderbird": { + "after_frame": { + "max_pct": 92.2, + "median_pct": 77.0, + "min_pct": 9.8, + "n": 40 + }, + "after_frame_click": { + "max_pct": 92.2, + "median_pct": 77.7, + "min_pct": 75.1, + "n": 35 + }, + "after_frame_last_action_is_click": { + "k": 35, + "n": 40, + "pct": 87.5 + }, + "before_frame": { + "max_pct": 9.8, + "median_pct": 9.8, + "min_pct": 9.8, + "n": 40 + } + }, + "vlc": { + "after_frame": { + "max_pct": 93.4, + "median_pct": 75.1, + "min_pct": 9.8, + "n": 40 + }, + "after_frame_click": { + "max_pct": 93.4, + "median_pct": 80.7, + "min_pct": 75.1, + "n": 24 + }, + "after_frame_last_action_is_click": { + "k": 24, + "n": 40, + "pct": 60.0 + }, + "before_frame": { + "max_pct": 9.8, + "median_pct": 9.8, + "min_pct": 9.8, + "n": 40 + } + } + }, + "frame_sizes": [ + "1920x1080" + ], + "n_runs": 160 + }, "desktop_verifier_osworld_unseen_apps": { "auroc": 0.7905, "auroc_before_training": 0.6272, diff --git a/scripts/build_paper_headline_counts.py b/scripts/build_paper_headline_counts.py index 8f280ca..24c2f14 100644 --- a/scripts/build_paper_headline_counts.py +++ b/scripts/build_paper_headline_counts.py @@ -5,7 +5,8 @@ Agents" reports its results as counts over runs. This script reads the raw result ledgers those counts were computed from (most are named in the paper's reproducibility appendix; dim_chrome_metrics, exp_hitl_cold_to_warm_n60, -osharm_live_v2 and agentdojo_results are not), recomputes each count from +osharm_live_v2, agentdojo_results and osworld_desktop_dim_share_runs are not; +the last is written by scripts/measure_desktop_dim_share.py), recomputes each count from per-run rows where the ledger has them, checks every recomputed count against the aggregate the ledger itself recorded, and writes one small JSON file of counts and denominators: @@ -73,6 +74,7 @@ "osharm_live_v2_results.json", "agentdojo_results.json", "wave2_health_admin_v4_ehr_results.json", + "osworld_desktop_dim_share_runs.json", ) @@ -212,6 +214,55 @@ def desktop_verifier(doc: dict, dim: dict) -> dict: } +def _share_stats(values: list[float]) -> dict: + ordered = sorted(values) + n = len(ordered) + + def as_pct(x: float) -> float: + return float((Decimal(str(x)) * 100).quantize(Decimal("0.1"), rounding=ROUND_HALF_UP)) + + return { + "n": n, + "median_pct": as_pct(statistics.median(ordered)), + "min_pct": as_pct(ordered[0]), + "max_pct": as_pct(ordered[-1]), + } + + +def desktop_dimming(measured: dict, verifier_ledger_sha: str) -> dict: + """Share of each frame the desktop verifier's dimming darkens, 160 held-out runs. + + Measured by scripts/measure_desktop_dim_share.py with the runner's own + dim_the_chrome, on the first and last frame of each run. + """ + agree("dim-share runs ledger", measured["runs_ledger_sha256"], verifier_ledger_sha) + runs = measured["runs"] + clicked = [run for run in runs if run["after_has_click"]] + unclicked = [run for run in runs if not run["after_has_click"]] + out: dict[str, Any] = { + "benchmark": "OSWorld-Verified, held-out apps gimp, libreoffice_calc, thunderbird, vlc", + "archives_sha256": measured["archives_sha256"], + "n_runs": len(runs), + "frame_sizes": sorted({"x".join(map(str, run["after_size"])) for run in runs}), + "before_frame": _share_stats([run["before_dimmed_share"] for run in runs]), + "after_frame": _share_stats([run["after_dimmed_share"] for run in runs]), + "after_frame_last_action_is_click": ratio(len(clicked), len(runs)), + "after_frame_click": _share_stats([run["after_dimmed_share"] for run in clicked]), + "after_frame_no_click": _share_stats([run["after_dimmed_share"] for run in unclicked]), + "by_app": {}, + } + for app in sorted({run["app"] for run in runs}): + rows = [run for run in runs if run["app"] == app] + app_clicked = [run for run in rows if run["after_has_click"]] + out["by_app"][app] = { + "before_frame": _share_stats([run["before_dimmed_share"] for run in rows]), + "after_frame": _share_stats([run["after_dimmed_share"] for run in rows]), + "after_frame_last_action_is_click": ratio(len(app_clicked), len(rows)), + "after_frame_click": _share_stats([run["after_dimmed_share"] for run in app_clicked]), + } + return out + + def desktop_chaos(gen1: dict, gen2: dict) -> dict: """DesktopChaosBench unwrapped success across a model upgrade.""" out: dict[str, Any] = { @@ -534,6 +585,10 @@ def build(paths: dict[str, Path]) -> dict: "desktop_verifier_osworld_unseen_apps": desktop_verifier( docs["veto4b_r6_desktop_results.json"], docs["dim_chrome_metrics.json"] ), + "desktop_dimming_osworld_unseen_apps": desktop_dimming( + docs["osworld_desktop_dim_share_runs.json"], + sha256(paths["veto4b_r6_desktop_results.json"]), + ), "desktop_chaos_model_upgrade": desktop_chaos( docs["upstream_desktop_chaos_v2_results.json"], docs["upstream_desktop_chaos_v3_6series_results.json"], diff --git a/scripts/measure_desktop_dim_share.py b/scripts/measure_desktop_dim_share.py new file mode 100644 index 0000000..9e47cd1 --- /dev/null +++ b/scripts/measure_desktop_dim_share.py @@ -0,0 +1,222 @@ +#!/usr/bin/env python3 +"""Measure how much of each desktop frame the 2-frame verifier's dimming darkens. + +The desktop verifier in arXiv:2611.39728 (Veto-4B-r6) is shown a +[Dim(first frame) | Dim(last frame)] pair. ``dim_the_chrome`` below is copied +unchanged from the evaluation runner. On the last ("after") frame it keeps a box +around the final click at full brightness and dims everything else. On the first +("before") frame it keeps everything but a thin border. This script replays that +dimming on the exact frames the verifier saw for the 160 held-out OSWorld-Verified +runs, and reports the dimmed share of each frame. + +Inputs, passed as paths: + --archives DIR the three xlangai/ubuntu_osworld_verified_trajs archives + (results_opus4p5_single_agent.zip, autoglm_15steps.zip, + results_agent_s2_o3_15steps.zip) + --runs FILE veto4b_r6_desktop_results.json, whose per_item_predictions + name the 160 runs by archive, app and task id + --output FILE per-run measurement JSON + +Archives are read in place. Only each run's first and last screenshot, +result.txt and traj.jsonl are read, and nothing from an archive is executed or +written to disk. The output holds per-run shares and frame sizes, no pixels. +""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import re +import sys +import zipfile +from io import BytesIO +from pathlib import Path + +import numpy as np +from PIL import Image, ImageDraw, ImageEnhance + +SCHEMA = "openadapt-evals.desktop-dim-share-runs.v1" + +# --- copied unchanged from the evaluation runner -------------------------------- + +_COORD_RE = re.compile( + r"(?:click|moveTo|doubleClick|rightClick|dragTo)\s*\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)", + re.IGNORECASE, +) + + +def _extract_last_xy(action_text: str, width: int, height: int) -> tuple[int, int] | None: + m = _COORD_RE.search(action_text or "") + if not m: + return None + x, y = float(m.group(1)), float(m.group(2)) + if x <= 1.0 and y <= 1.0: + x, y = x * width, y * height + return int(max(0, min(width - 1, x))), int(max(0, min(height - 1, y))) + + +def dim_the_chrome(img: Image.Image, last_xy: tuple[int, int] | None = None) -> Image.Image: + rgb = img.convert("RGB") + w, h = rgb.size + dimmed = ImageEnhance.Brightness(rgb).enhance(0.25) + mask = Image.new("L", (w, h), 0) + draw = ImageDraw.Draw(mask) + if last_xy is not None: + cx, cy = last_xy + hw, hh = max(320, int(w * 0.24)), max(240, int(h * 0.26)) + draw.rectangle( + [max(72, cx - hw), max(32, cy - hh), min(w - 16, cx + hw), min(h - 16, cy + hh)], + fill=255, + ) + else: + draw.rectangle([72, 32, max(73, w - 24), max(33, h - 24)], fill=255) + return Image.composite(rgb, dimmed, mask) + + +# -------------------------------------------------------------------------------- + +_STEP_NUM_RE = re.compile(r"(\d+)") + + +def dimmed_share(img: Image.Image, last_xy: tuple[int, int] | None) -> float: + """Fraction of pixels dim_the_chrome darkens, read from its own output. + + A pixel is dimmed when the output differs from the input, or when it is a + pixel the output would have darkened but that is already black. To count + both, the frame is replaced by a constant white image of the same size, + which every dimmed pixel changes. + """ + white = Image.new("RGB", img.size, (255, 255, 255)) + out = np.asarray(dim_the_chrome(white, last_xy)) + return float(np.mean(np.any(out != 255, axis=2))) + + +def index_archive(zf: zipfile.ZipFile) -> dict[str, dict]: + """Same episode grouping as the runner's _load_strict_app_split.""" + episodes: dict[str, dict] = {} + for name in zf.namelist(): + if name.endswith("/"): + continue + parts = name.split("/") + if len(parts) < 3: + continue + base = parts[-1] + ep_dir = "/".join(parts[:-1]) + slot = episodes.setdefault(ep_dir, {"pngs": [], "traj": None, "result": None}) + if base == "result.txt": + slot["result"] = name + elif base == "traj.jsonl": + slot["traj"] = name + elif base.endswith(".png") and ("step_" in base or base[0].isdigit()): + slot["pngs"].append(name) + # The runner keeps only folders with a result.txt whose first line parses as + # a float and at least 3 frames. This drops macOS resource-fork copies + # (__MACOSX/...) that mirror real folders. + kept = {} + for ep_dir, info in episodes.items(): + if not info["result"] or len(info["pngs"]) < 3: + continue + try: + first = zf.read(info["result"]).decode("utf-8", errors="ignore").strip().splitlines()[0] + float(first.strip()) + except (ValueError, IndexError): + continue + kept[ep_dir] = info + return kept + + +def read_actions(zf: zipfile.ZipFile, traj: str | None) -> list[str]: + """Same action parsing as the runner (actions truncated to 220 chars).""" + actions: list[str] = [] + if not traj: + return actions + for line in zf.read(traj).decode("utf-8", errors="ignore").splitlines(): + if not line.strip(): + continue + rec = json.loads(line) + act = rec.get("action") or rec.get("response") or "" + if isinstance(act, (list, dict)): + act = json.dumps(act) + actions.append(str(act)[:220]) + return actions + + +def measure(archives: Path, runs_path: Path) -> dict: + runs = json.loads(runs_path.read_text(encoding="utf-8"))["per_item_predictions"] + zips: dict[str, zipfile.ZipFile] = {} + indexes: dict[str, dict[str, dict]] = {} + archive_sha: dict[str, str] = {} + for name in sorted({run["archive"] for run in runs}): + path = archives / name + archive_sha[name] = hashlib.sha256(path.read_bytes()).hexdigest() + zips[name] = zipfile.ZipFile(path, "r") + indexes[name] = index_archive(zips[name]) + + rows = [] + for run in sorted(runs, key=lambda r: r["idx"]): + zf = zips[run["archive"]] + matches = [ + ep_dir + for ep_dir in indexes[run["archive"]] + if ep_dir.split("/")[-1] == run["task_id"] + and ep_dir.split("/")[-2] == run["app_domain"] + ] + if len(matches) != 1: + raise SystemExit(f"run {run['idx']}: {len(matches)} episode folders match") + info = indexes[run["archive"]][matches[0]] + pngs = sorted( + info["pngs"], + key=lambda p: [int(x) for x in _STEP_NUM_RE.findall(p.split("/")[-1])] or [0], + ) + if len(pngs) != run["n_steps"]: + raise SystemExit(f"run {run['idx']}: {len(pngs)} frames, ledger says {run['n_steps']}") + score = float( + zf.read(info["result"]).decode("utf-8", errors="ignore").strip().splitlines()[0] + ) + if score != run["ground_truth_score"]: + raise SystemExit(f"run {run['idx']}: score {score} != {run['ground_truth_score']}") + actions = read_actions(zf, info["traj"]) + before = Image.open(BytesIO(zf.read(pngs[0]))) + after = Image.open(BytesIO(zf.read(pngs[-1]))) + last_act = actions[-1] if actions else "DONE" + click_text = actions[-2] if len(actions) >= 2 else last_act + last_xy = _extract_last_xy(click_text, after.width, after.height) + rows.append( + { + "idx": run["idx"], + "archive": run["archive"], + "app": run["app_domain"], + "task_id": run["task_id"], + "is_failure": run["is_failure"], + "before_size": list(before.size), + "after_size": list(after.size), + "after_has_click": last_xy is not None, + "before_dimmed_share": round(dimmed_share(before, None), 6), + "after_dimmed_share": round(dimmed_share(after, last_xy), 6), + } + ) + return { + "schema": SCHEMA, + "dataset": "xlangai/ubuntu_osworld_verified_trajs", + "archives_sha256": archive_sha, + "runs_ledger": runs_path.name, + "runs_ledger_sha256": hashlib.sha256(runs_path.read_bytes()).hexdigest(), + "runs": rows, + } + + +def main(argv: list[str]) -> int: + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("--archives", type=Path, required=True) + parser.add_argument("--runs", type=Path, required=True) + parser.add_argument("--output", type=Path, required=True) + args = parser.parse_args(argv) + result = measure(args.archives, args.runs) + args.output.write_text(json.dumps(result, indent=2, sort_keys=True) + "\n", encoding="utf-8") + print(f"wrote {len(result['runs'])} runs to {args.output}") + return 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/tests/test_paper_headline_counts.py b/tests/test_paper_headline_counts.py index cac26ac..c274ff0 100644 --- a/tests/test_paper_headline_counts.py +++ b/tests/test_paper_headline_counts.py @@ -61,3 +61,14 @@ def test_file_is_canonical_and_carries_no_paths(): assert sorted(summary["inputs"]) == sorted(builder.LEDGERS) for entry in summary["inputs"].values(): assert len(entry["sha256"]) == 64 + + +def test_desktop_dimming_geometry(): + import measure_desktop_dim_share as dim + from PIL import Image + + frame = Image.new("RGB", (1920, 1080), (0, 0, 0)) + # No click: only a border is dimmed. + assert round(dim.dimmed_share(frame, None), 4) == 0.0979 + # A click in the middle keeps a 921 x 561 box bright. + assert round(dim.dimmed_share(frame, (960, 540)), 4) == round(1 - 921 * 561 / (1920 * 1080), 4) From 7e0bc154b5b6c59070a1a0c37c67736e1cc8ed4a Mon Sep 17 00:00:00 2001 From: abrichr Date: Tue, 1 Dec 2026 11:15:54 -0500 Subject: [PATCH 5/5] docs: name the dimming click field for the action it is read from The runner places the bright box at the click in the next-to-last action, so say so in the summary key. --- .../screenshots_are_not_state/headline_counts.json | 10 +++++----- scripts/build_paper_headline_counts.py | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/eval_results/screenshots_are_not_state/headline_counts.json b/docs/eval_results/screenshots_are_not_state/headline_counts.json index f136583..372f4f1 100644 --- a/docs/eval_results/screenshots_are_not_state/headline_counts.json +++ b/docs/eval_results/screenshots_are_not_state/headline_counts.json @@ -129,7 +129,7 @@ "min_pct": 75.1, "n": 102 }, - "after_frame_last_action_is_click": { + "after_frame_click_in_next_to_last_action": { "k": 102, "n": 160, "pct": 63.8 @@ -166,7 +166,7 @@ "min_pct": 75.1, "n": 25 }, - "after_frame_last_action_is_click": { + "after_frame_click_in_next_to_last_action": { "k": 25, "n": 40, "pct": 62.5 @@ -191,7 +191,7 @@ "min_pct": 75.1, "n": 18 }, - "after_frame_last_action_is_click": { + "after_frame_click_in_next_to_last_action": { "k": 18, "n": 40, "pct": 45.0 @@ -216,7 +216,7 @@ "min_pct": 75.1, "n": 35 }, - "after_frame_last_action_is_click": { + "after_frame_click_in_next_to_last_action": { "k": 35, "n": 40, "pct": 87.5 @@ -241,7 +241,7 @@ "min_pct": 75.1, "n": 24 }, - "after_frame_last_action_is_click": { + "after_frame_click_in_next_to_last_action": { "k": 24, "n": 40, "pct": 60.0 diff --git a/scripts/build_paper_headline_counts.py b/scripts/build_paper_headline_counts.py index 24c2f14..9228397 100644 --- a/scripts/build_paper_headline_counts.py +++ b/scripts/build_paper_headline_counts.py @@ -233,7 +233,8 @@ def desktop_dimming(measured: dict, verifier_ledger_sha: str) -> dict: """Share of each frame the desktop verifier's dimming darkens, 160 held-out runs. Measured by scripts/measure_desktop_dim_share.py with the runner's own - dim_the_chrome, on the first and last frame of each run. + dim_the_chrome, on the first and last frame of each run. As in the runner, + the click that places the bright box is read from the next-to-last action. """ agree("dim-share runs ledger", measured["runs_ledger_sha256"], verifier_ledger_sha) runs = measured["runs"] @@ -246,7 +247,7 @@ def desktop_dimming(measured: dict, verifier_ledger_sha: str) -> dict: "frame_sizes": sorted({"x".join(map(str, run["after_size"])) for run in runs}), "before_frame": _share_stats([run["before_dimmed_share"] for run in runs]), "after_frame": _share_stats([run["after_dimmed_share"] for run in runs]), - "after_frame_last_action_is_click": ratio(len(clicked), len(runs)), + "after_frame_click_in_next_to_last_action": ratio(len(clicked), len(runs)), "after_frame_click": _share_stats([run["after_dimmed_share"] for run in clicked]), "after_frame_no_click": _share_stats([run["after_dimmed_share"] for run in unclicked]), "by_app": {}, @@ -257,7 +258,7 @@ def desktop_dimming(measured: dict, verifier_ledger_sha: str) -> dict: out["by_app"][app] = { "before_frame": _share_stats([run["before_dimmed_share"] for run in rows]), "after_frame": _share_stats([run["after_dimmed_share"] for run in rows]), - "after_frame_last_action_is_click": ratio(len(app_clicked), len(rows)), + "after_frame_click_in_next_to_last_action": ratio(len(app_clicked), len(rows)), "after_frame_click": _share_stats([run["after_dimmed_share"] for run in app_clicked]), } return out