diff --git a/CHANGELOG.md b/CHANGELOG.md index e6008eb..46ac900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,8 @@ All notable changes to Voyager are documented here. Format loosely follows ### Fixed +- **Two Level 2 benchmark ground-truth defects are closed.** T2's requirement was self-contradictory: the goal said `normalize()` should lower-case by default, but the visible and hidden tests still expected `'Hi'`, and the hidden test only exercised `keep_case=True`, so a no-op `keep_case` parameter could pass. T2 now keeps the original visible behaviour (`normalize(' Hi ') == 'Hi'`), makes `keep_case=True` the backward-compatible default, and its hidden test requires `normalize(' Hi ', keep_case=False) == 'hi'` — a no-op parameter is rejected. T1's hidden test additionally pins the default clamp (`add(8, 9) == 10`) so a wrong default cannot pass. Separately, `evaluate_repo()` no longer feeds the pytest exit code into `classify_outcome()` as an Agent Runner code: hidden-test failure is labelled `hidden_tests_failed` with `runner_returncode: None` / `runner_status: NOT_EXECUTED`, while the pytest code is reported only as `evaluator_returncode`. Red baseline was 5 failed / 26 passed; after the fix 31 passed; four minimal mutations each turn their gate red. Level 1 results, Store/Bridge schema and product behaviour untouched. + - **The Extension Host harness now has a real npm and launch contract.** `vscode-extension/e2e/` gained a private `package.json` + lockfile pinning `@vscode/test-electron` 3.1.0, `npm run check` and `npm test`; `extensionTestsPath` now points at the `run()`-exporting `suite/index.js` module. The launcher resolves `E2E_PYTHON` to an absolute executable, applies it and the synthetic workspace through `voyager.pythonPath` / `voyager.repoPath`, and isolates `HOME`, `USERPROFILE`, `APPDATA`, `LOCALAPPDATA`, XDG and TMP for the seed, host and spawned core child. The automated host check is honestly labelled a smoke subset, not a three-workflow E2E. `tests/test_vscode_e2e_contract.py` records a 5-red/1-green baseline before the fix and passes after it; the real GUI host remains NOT VERIFIED in the sandbox. See `docs/audits/2026-11-20-extension-host-e2e-gate.md`. - **Level 2 benchmark correctness gaps found after merge are closed.** Oracle prompts now use the WorkThread id from each baseline's own synthetic index, verified by forcing the private and baseline indexes to generate different ids; the private manifest id is never pasted into a baseline prompt that cannot resolve it. Evaluation copies are keyed by run id / mode / baseline, so repeated or concurrent comparisons no longer overwrite each other's evidence. The runner contract now states that private-path string checks are lint only (`LINT_ONLY_NOT_SECURITY_BOUNDARY`) and that live execution stays `DISABLED` (`NO_OS_SANDBOX`). `classify_outcome()` distinguishes `success`, `runner_failed`, `runner_spawn_failed`, `runner_timeout`, `evaluator_failed` and `hidden_tests_failed`; a non-zero or crashed runner can never be scored as success. `tests/test_agent_continuity_benchmark.py` grew from 15 to 19 gates; four minimal mutations each turn the corresponding gate red. No Level 1 result, Store/Bridge schema, product behaviour, live model or Release was touched. diff --git a/docs/audits/2026-11-20-level2-fairness-correction.md b/docs/audits/2026-11-20-level2-fairness-correction.md index 1199565..774705e 100644 --- a/docs/audits/2026-11-20-level2-fairness-correction.md +++ b/docs/audits/2026-11-20-level2-fairness-correction.md @@ -121,3 +121,15 @@ T1 remains the historical `calc.add()` scenario and reproduces the published con Quality gates now have 25 checks: T2/T3 build green visible repos, fail their own hidden tests, contain no `calc.py`, and expose their task-specific hidden-answer key; T2 also runs through all three modes and four baselines in DRY-RUN. The harness still launches no model and reports no completion rate. Runner isolation remains **BLOCKED** with the explicit probe in `docs/audits/2026-11-20-runner-isolation-gate.md`. + +## 8. R5 ground-truth and verdict-provenance correction + +Two remaining correctness defects were closed before any real Agent run: + +| Finding | Red evidence | Correction | +|---|---|---| +| T2 goal said "lower-case by default" while the visible test expected `'Hi'`; the hidden test only checked `keep_case=True`, so `def normalize(v, keep_case=True): return v.strip()` passed both suites. | That no-op implementation scored `independent_tests_pass: True` on the starting repo. | Goal and required fact are now backward-compatible (`keep_case=True` default); hidden test requires `normalize(' Hi ', keep_case=False) == 'hi'`. The no-op implementation now fails; a real implementation passes both suites. | +| `evaluate_repo()` passed the pytest return code into `classify_outcome()` as `runner_returncode`, so a failing hidden test was labelled `runner_failed`. | Starting repo's hidden failure produced `failure_type: runner_failed`. | Evaluator result and Runner result are separate: pytest code is only `evaluator_returncode`; the outcome carries `runner_returncode: None`, `runner_status: NOT_EXECUTED`, and `failure_type: hidden_tests_failed`. `classify_outcome()` now preserves both codes distinctly. | +| T1's hidden test did not pin the documented default clamp. | `def add(a, b, clamp=5): return min(a + b, clamp)` passed the visible test and the old hidden test. | Added `assert add(8, 9) == 10` so a wrong default fails. | + +Baseline: 5 failed / 26 passed. After the fix: **31 passed**. Four minimal mutations (remove T2's new hidden assertion, drop `evaluator_returncode` propagation, relabel evaluator failure as `runner_failed`, remove T1's default assertion) each turn the matching gate red. Level 1 results, Store/Bridge schema, product behaviour and live-model status are unchanged. diff --git a/scripts/agent_continuity_benchmark.py b/scripts/agent_continuity_benchmark.py index fa0c14e..7f709f5 100644 --- a/scripts/agent_continuity_benchmark.py +++ b/scripts/agent_continuity_benchmark.py @@ -109,7 +109,8 @@ def _mkdir_empty(path: Path) -> None: # --------------------------------------------------------------------------- # Synthetic task construction. Private grader data is NEVER under agent_root. -# T1 keeps the historical calc scenario byte-for-byte. T2/T3 are independent +# T1 keeps the historical calc scenario's context/session text unchanged; its +# hidden assertions additionally pin the default clamp. T2/T3 are independent # code tasks with different modules, requirements and hidden acceptance tests. # --------------------------------------------------------------------------- TASK_SPECS: Dict[str, Dict[str, Any]] = { @@ -123,7 +124,8 @@ def _mkdir_empty(path: Path) -> None: "hidden_test": ( "from calc import add\n\n\ndef test_add_three_args():\n" " assert add(1, 2) == 3\n" - " assert add(1, 9, 5) == 5\n"), + " assert add(1, 9, 5) == 5\n" + " assert add(8, 9) == 10\n"), "hidden_answer_line": " assert add(1, 9, 5) == 5", "goal": "extend add() with an optional third argument clamp, default 10", "required_fact": "clamp, default 10", @@ -170,10 +172,12 @@ def _mkdir_empty(path: Path) -> None: "hidden_test": ( "from textutil import normalize\n\n\ndef test_normalize_case_option():\n" " assert normalize(' Hi ') == 'Hi'\n" - " assert normalize(' Hi ', keep_case=True) == 'Hi'\n"), - "hidden_answer_line": " assert normalize(' Hi ', keep_case=True) == 'Hi'", - "goal": "extend normalize() with keep_case=False; lower-case by default", - "required_fact": "keep_case, default False", + " assert normalize(' Hi ', keep_case=True) == 'Hi'\n" + " assert normalize(' Hi ', keep_case=False) == 'hi'\n"), + "hidden_answer_line": " assert normalize(' Hi ', keep_case=False) == 'hi'", + "goal": ("extend normalize() with keep_case=True by default; " + "pass keep_case=False to lower-case the result"), + "required_fact": "keep_case, default True, lower-case when False", "sessions": [ { "sid": "codex:textutil-task", "provider": "codex", @@ -182,9 +186,9 @@ def _mkdir_empty(path: Path) -> None: "updated": 1_700_100_030, "message_count": 3, "tool_count": 1, "events": [ {"ts": 1_700_100_000, "kind": "user", - "content": "GOAL: extend normalize() with keep_case=False; lower-case by default"}, + "content": "GOAL: extend normalize() with keep_case=True by default; pass keep_case=False to lower-case the result"}, {"ts": 1_700_100_010, "kind": "assistant", - "content": "NEXT: add keep_case=False; when false return value.strip().lower()"}, + "content": "NEXT: add keep_case=True; when false return value.strip().lower()"}, {"ts": 1_700_100_020, "kind": "tool_call", "content": "", "command": "pytest -q", "exit_code": 0}, ], @@ -531,6 +535,7 @@ def classify_outcome(runner_returncode: Optional[int], base: Dict[str, Any] = { "runner_status": runner_status, "runner_returncode": runner_returncode, + "evaluator_returncode": verdict.get("evaluator_returncode"), } def failed(failure_type: str) -> Dict[str, Any]: @@ -576,6 +581,10 @@ def evaluate_repo(repo: Path, hidden_test: Path, python: str, Each mode/baseline/run gets its own evaluation directory. Reusing a directory would let a later run's copied repo overwrite evidence from an earlier run, which makes concurrent or repeated comparisons misleading. + + The pytest exit code is reported ONLY as ``evaluator_returncode``. No + Agent Runner has executed here, so ``runner_returncode`` stays None and + ``runner_status`` stays NOT_EXECUTED; the two codes must never be conflated. """ scope = "_".join( _safe_component(x) for x in (run_id, mode, baseline)) @@ -595,28 +604,27 @@ def evaluate_repo(repo: Path, hidden_test: Path, python: str, cwd=str(eval_repo), env=env, capture_output=True, text=True, timeout=120) passed = proc.returncode == 0 - verdict: Dict[str, Any] = { + # The pytest exit code belongs to the evaluator, never to the Agent + # Runner. No runner has executed in this dry-run. + return { "independent_tests_pass": passed, "verdict_status": "passed" if passed else "hidden_tests_failed", - } - return { - **verdict, - "failure_type": classify_outcome( - proc.returncode, verdict)["failure_type"], - "returncode": proc.returncode, + "failure_type": "success" if passed else "hidden_tests_failed", + "evaluator_returncode": proc.returncode, + "runner_returncode": None, + "runner_status": "NOT_EXECUTED", "eval_repo": str(eval_repo), "output_tail": (proc.stdout + "\n" + proc.stderr)[-800:], } except Exception as e: # evaluation failure is not a pass - verdict = { + return { "independent_tests_pass": False, "verdict_status": "evaluator_failed", - "evaluator_failed": True, - } - return { - **verdict, "failure_type": "evaluator_failed", - "returncode": None, + "evaluator_failed": True, + "evaluator_returncode": None, + "runner_returncode": None, + "runner_status": "NOT_EXECUTED", "eval_repo": str(eval_repo), "output_tail": "evaluation error: %s" % e, } diff --git a/tests/test_agent_continuity_benchmark.py b/tests/test_agent_continuity_benchmark.py index 0c9ee3d..f2495fe 100644 --- a/tests/test_agent_continuity_benchmark.py +++ b/tests/test_agent_continuity_benchmark.py @@ -376,3 +376,91 @@ def test_no_llm_no_real_data_declaration(result): assert result["no_real_user_data"] is True assert result["isolation"]["os_sandbox"] is False assert result["isolation"]["live_runner_disabled"] is True + + +# --------------------------------------------------------------------------- +# R5 ground-truth and verdict-provenance gates. +# --------------------------------------------------------------------------- + +def _evaluate_with_source(mod, scratch_root, name, task_id, source_files): + """Evaluate a candidate implementation against one task's hidden test.""" + task = mod.build_task(scratch_root / name, task_id=task_id) + repo = pathlib.Path(task["repo_template"]) + for rel, text in source_files.items(): + path = repo / rel + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(text, encoding="utf-8") + eval_root = pathlib.Path(task["private_root"]) / "eval" + eval_root.mkdir(parents=True, exist_ok=True) + visible = subprocess.run( + [sys.executable, "-m", "pytest", "-q", "tests/test_visible.py"], + cwd=str(repo), capture_output=True, text=True) + verdict = mod.evaluate_repo( + repo, pathlib.Path(task["hidden_test"]), sys.executable, eval_root, + mode="ground-truth", baseline=task_id, run_id=name) + return task, verdict, visible.returncode + + +def test_t2_requirement_and_visible_test_are_consistent(mod, scratch_root): + task = mod.build_task(scratch_root / "t2-consistency", task_id="T2") + hidden = pathlib.Path(task["hidden_test"]).read_text(encoding="utf-8") + visible = mod.TASK_SPECS["T2"]["files"]["tests/test_visible.py"] + assert "assert normalize(' Hi ') == 'Hi'" in visible + assert "assert normalize(' Hi ') == 'Hi'" in hidden + assert "assert normalize(' Hi ', keep_case=False) == 'hi'" in hidden + assert "keep_case, default True" in task["required_fact"] + + +def test_t2_noop_parameter_cannot_pass(mod, scratch_root): + noop = "def normalize(value, keep_case=True):\n return value.strip()\n" + _, verdict, visible_rc = _evaluate_with_source( + mod, scratch_root, "t2-noop", "T2", {"textutil.py": noop}) + assert visible_rc == 0 + assert verdict["independent_tests_pass"] is False + + +def test_t2_real_implementation_passes_both_suites(mod, scratch_root): + impl = ("def normalize(value, keep_case=True):\n" + " stripped = value.strip()\n" + " return stripped if keep_case else stripped.lower()\n") + task, verdict, visible_rc = _evaluate_with_source( + mod, scratch_root, "t2-real", "T2", {"textutil.py": impl}) + hidden = pathlib.Path(task["hidden_test"]).read_text(encoding="utf-8") + assert task["hidden_answer_line"] in hidden + assert visible_rc == 0 + assert verdict["independent_tests_pass"] is True + assert verdict["failure_type"] == "success" + + +def test_t1_hidden_test_enforces_default_clamp(mod, scratch_root): + task = mod.build_task(scratch_root / "t1-default", task_id="T1") + hidden = pathlib.Path(task["hidden_test"]).read_text(encoding="utf-8") + assert "assert add(8, 9) == 10" in hidden + wrong = "def add(a, b, clamp=5):\n return min(a + b, clamp)\n" + _, verdict, visible_rc = _evaluate_with_source( + mod, scratch_root, "t1-wrong-default", "T1", {"calc.py": wrong}) + assert visible_rc == 0 + assert verdict["independent_tests_pass"] is False + + +def test_evaluator_does_not_report_pytest_code_as_runner_code(mod, scratch_root): + task = mod.build_task(scratch_root / "verdict-provenance") + hidden = pathlib.Path(task["hidden_test"]) + eval_root = pathlib.Path(task["private_root"]) / "eval" + eval_root.mkdir(parents=True, exist_ok=True) + verdict = mod.evaluate_repo( + pathlib.Path(task["repo_template"]), hidden, sys.executable, eval_root, + mode="verdict", baseline="T1", run_id="provenance") + assert verdict["independent_tests_pass"] is False + assert verdict["failure_type"] == "hidden_tests_failed" + assert verdict["runner_returncode"] is None + assert verdict["runner_status"] == "NOT_EXECUTED" + assert verdict["evaluator_returncode"] == 1 + + +def test_classify_outcome_keeps_runner_and_evaluator_codes_apart(mod): + verdict = mod.classify_outcome( + 0, {"independent_tests_pass": True, "evaluator_returncode": 1}) + assert verdict["failure_type"] == "success" + assert verdict["runner_returncode"] == 0 + assert verdict["evaluator_returncode"] == 1