Repository navigation
Description
Summary
Repository evaluation can bypass required task field validation, leading to a traceback or a cell started with invalid metadata.
Scenarios (3)
1. repo run and the full eval check end in a KeyError traceback, exit 5, for a task.json with no base
Input: .agent-eval/tasks/fix_add/task.json of a regular task with the base key removed.
python cli.py eval check <repo> --schema-only refuses it with missing or empty required key 'base' and exit 1. python cli.py repo run <repo> --task fix_add ... ends in KeyError: 'base' raised from repos/workspace.py:225 (Task.base, reached through repos/bases.py:73), exit 5. The full python cli.py eval check <repo> --task fix_add raises the same KeyError: 'base' from repos/selfcheck.py:174 via prepare_workspace, exit 5. Expected: a one-line message naming base and exit 1 or 2 from both commands, as --schema-only gives.
Tests are attached in tests/test_run_task_without_base.py and tests/test_check_task_without_base.py; both fail on 50ea6312. They build the toy repository from tests/repo_eval_fixture.py, delete base from fix_add/task.json and run the CLI with --docker /bin/true.
python cli.py repo run <repo> --arm guidance:none --model m --name n --out-dir out --task fix_add --bin /bin/true --docker /bin/true --agent-network bridge
tests/test_run_task_without_base.py
import json
import subprocess
import sys
from pathlib import Path
from repo_eval_fixture import make_repo
ROOT = Path(__file__).resolve().parents[1]
def test_run_refuses_task_without_base(tmp_path: Path) -> None:
root, _base = make_repo(tmp_path / "fx")
task_json = root / ".agent-eval/tasks/fix_add/task.json"
data = json.loads(task_json.read_text())
data.pop("base", None)
task_json.write_text(json.dumps(data))
run = subprocess.run(
[sys.executable, "cli.py", "repo", "run", str(root), "--arm", "guidance:none", "--model", "m",
"--name", "n", "--out-dir", str(tmp_path / "run"), "--task", "fix_add", "--bin", "/bin/true",
"--docker", "/bin/true", "--agent-network", "bridge"],
capture_output=True, text=True, cwd=ROOT,
)
out = run.stdout + run.stderr
assert ("Traceback" in out) is False, out
assert run.returncode in (1, 2), outtests/test_check_task_without_base.py
import json
import subprocess
import sys
from pathlib import Path
from repo_eval_fixture import make_repo
ROOT = Path(__file__).resolve().parents[1]
def test_check_task_without_base_is_refused_not_a_traceback(tmp_path: Path) -> None:
dest = tmp_path / "fx"
dest.mkdir()
root, _base = make_repo(dest)
task_json = root / ".agent-eval/tasks/fix_add/task.json"
data = json.loads(task_json.read_text())
data.pop("base", None)
task_json.write_text(json.dumps(data))
run = subprocess.run(
[sys.executable, "cli.py", "eval", "check", str(root), "--docker", "/bin/true",
"--task", "fix_add", "--out-dir", str(tmp_path / "chk")],
capture_output=True, text=True, cwd=ROOT,
)
out = run.stdout + run.stderr
assert "Traceback" not in out, out
assert run.returncode in (1, 2), out2. repo run ends in a KeyError traceback, exit 5, for a task.json with no prompt
Input: .agent-eval/tasks/fix_add/task.json of a regular task with the prompt key removed.
python cli.py eval check <repo> --schema-only reports missing or empty required key 'prompt' and exits 1. python cli.py repo run <repo> --task fix_add ... prepares the workspace, then ends in KeyError: 'prompt' from repos/runner.py:281 (task.raw["prompt"] in run_cell), exit 5. Expected: a one-line message naming prompt before any cell starts, exit 1 or 2.
A test is attached in tests/test_run_task_without_prompt.py; it fails on 50ea6312.
python cli.py repo run <repo> --arm guidance:none --model m --name n --out-dir out --task fix_add --bin /bin/true --docker /bin/true --agent-network bridge
tests/test_run_task_without_prompt.py
import json
import subprocess
import sys
from pathlib import Path
from repo_eval_fixture import make_repo
ROOT = Path(__file__).resolve().parents[1]
def test_run_refuses_task_without_prompt(tmp_path: Path) -> None:
root, _base = make_repo(tmp_path / "fx")
tj = root / ".agent-eval/tasks/fix_add/task.json"
d = json.loads(tj.read_text())
d.pop("prompt", None)
tj.write_text(json.dumps(d))
run = subprocess.run(
[sys.executable, "cli.py", "repo", "run", str(root), "--arm", "guidance:none", "--model", "m",
"--name", "n", "--out-dir", str(tmp_path / "run"), "--task", "fix_add", "--bin", "/bin/true",
"--docker", "/bin/true", "--agent-network", "bridge"],
capture_output=True, text=True, cwd=ROOT,
)
out = run.stdout + run.stderr
assert "Traceback" not in out, out
assert run.returncode in (1, 2), out3. repo run starts a cell for a task.json with no id or a numeric prompt that eval check --schema-only refuses
Input: .agent-eval/tasks/fix_add/task.json with the id key removed. The same happens with "prompt": 5.
python cli.py eval check <repo> --schema-only exits 1 with missing or empty required key 'id' (for the numeric prompt, missing or empty required key 'prompt'). python cli.py repo run <repo> --task fix_add ... on the same tree prints 1 ran, 0 already done, 0 crashed and exits 0, with no refusal. load_tasks in repos/workspace.py reads task.json without the checks of _check_task in repos/manifest.py. Expected: repo run refuses the task naming the key and runs 0 cells.
Tests are attached in tests/test_run_task_without_id.py and tests/test_run_task_numeric_prompt.py; both fail on 50ea6312.
python cli.py repo run <repo> --arm guidance:none --model m --name n --out-dir out --task fix_add --bin /bin/true --docker /bin/true --agent-network bridge
tests/test_run_task_without_id.py
# Copyright (C) 2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import json
import subprocess
import sys
from pathlib import Path
from repo_eval_fixture import make_repo
ROOT = Path(__file__).resolve().parents[1]
def test_repo_run_refuses_task_without_id(tmp_path: Path) -> None:
root, _base = make_repo(tmp_path / "fx")
task_json = root / ".agent-eval/tasks/fix_add/task.json"
data = json.loads(task_json.read_text())
data.pop("id", None)
task_json.write_text(json.dumps(data))
run = subprocess.run(
[sys.executable, "cli.py", "repo", "run", str(root), "--arm", "guidance:none", "--model", "m",
"--name", "n", "--out-dir", str(tmp_path / "run"), "--task", "fix_add", "--bin", "/bin/true",
"--docker", "/bin/true", "--agent-network", "bridge"],
capture_output=True, text=True, cwd=ROOT,
)
out = run.stdout + run.stderr
assert "1 ran" not in out, outtests/test_run_task_numeric_prompt.py
import json
import subprocess
import sys
from pathlib import Path
from repo_eval_fixture import make_repo
ROOT = Path(__file__).resolve().parents[1]
def test_repo_run_refuses_numeric_prompt(tmp_path: Path) -> None:
dest = tmp_path / "fx"
dest.mkdir()
root, _base = make_repo(dest)
tj = root / ".agent-eval/tasks/fix_add/task.json"
data = json.loads(tj.read_text())
data["prompt"] = 5
tj.write_text(json.dumps(data))
run = subprocess.run(
[sys.executable, "cli.py", "repo", "run", str(root), "--arm", "guidance:none", "--model", "m",
"--name", "n", "--out-dir", str(tmp_path / "run"), "--task", "fix_add", "--bin", "/bin/true",
"--docker", "/bin/true", "--agent-network", "bridge"],
capture_output=True, text=True, cwd=ROOT,
)
out = run.stdout + run.stderr
assert "1 ran" not in out, outRelated
- eval check mishandles setup_patch symlink boundaries #1275: same code
repos/manifest.pyandrepos/workspace.py - repo validate exits 5 with a traceback when task.json links to itself or to a directory, in a tree and at <dir>@rev #910: same code
repos/manifest.pyand_check_task(closed by fix(repo): repo validate reports a task.json link that loops or is a directory (#910) #952) - repo: require regular patch files in revision checks #1300: same code
repos/manifest.py - repo: report unsearchable directories in eval check #1293: same code
repos/manifest.py - repo validate handles escaping eval_dir links differently by source #1279: same code
repos/manifest.py
Activity