diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/Cargo.lock b/docs/evaluation/dev-tasks/dev-echo/lang/rust/Cargo.lock new file mode 100644 index 0000000..78338c7 --- /dev/null +++ b/docs/evaluation/dev-tasks/dev-echo/lang/rust/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "echo" +version = "0.1.0" diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/.rustc_info.json b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/.rustc_info.json new file mode 100644 index 0000000..3ded6b8 --- /dev/null +++ b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/.rustc_info.json @@ -0,0 +1 @@ +{"rustc_fingerprint":12138803327433613668,"outputs":{"17276427787476938915":{"success":true,"status":"","code":0,"stdout":"rustc 1.99.0 (b940084d7 2026-09-28)\nbinary: rustc\ncommit-hash: b940084d7eb6a299eb4bfeb8e34901bc051e7ac4\ncommit-date: 2026-09-28\nhost: x86_64-unknown-linux-gnu\nrelease: 1.99.0\nLLVM version: 23.1.1\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/shkmv/.rustup/toolchains/1.99.0-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_primitive_alignment=\"16\"\ntarget_has_atomic_primitive_alignment=\"32\"\ntarget_has_atomic_primitive_alignment=\"64\"\ntarget_has_atomic_primitive_alignment=\"8\"\ntarget_has_atomic_primitive_alignment=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/CACHEDIR.TAG b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/CACHEDIR.TAG new file mode 100644 index 0000000..20d7c31 --- /dev/null +++ b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/CACHEDIR.TAG @@ -0,0 +1,3 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by cargo. +# For information about cache directory tags see https://bford.info/cachedir/ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.cargo-artifact-lock b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.cargo-artifact-lock new file mode 100644 index 0000000..e69de29 diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.cargo-build-lock b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.cargo-build-lock new file mode 100644 index 0000000..e69de29 diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.cargo-lock b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.cargo-lock new file mode 100644 index 0000000..e69de29 diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/bin-echo b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/bin-echo new file mode 100644 index 0000000..d95eb3b --- /dev/null +++ b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/bin-echo @@ -0,0 +1 @@ +22f82d773cfb6ce9 \ No newline at end of file diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/bin-echo.json b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/bin-echo.json new file mode 100644 index 0000000..7e02a1d --- /dev/null +++ b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/bin-echo.json @@ -0,0 +1 @@ +{"rustc":5244445300240561903,"features":"[]","declared_features":"[]","target":12538796586915257791,"profile":7333259681545804295,"path":4942398508502643691,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/echo-cd02f4ae2050300b/dep-bin-echo","checksum":false}}],"rustflags":[],"config":9396254390672932401,"compile_kind":0} \ No newline at end of file diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/dep-bin-echo b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/dep-bin-echo new file mode 100644 index 0000000..5c54f74 Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/dep-bin-echo differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/invoked.timestamp b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/.fingerprint/echo-cd02f4ae2050300b/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/deps/echo-cd02f4ae2050300b b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/deps/echo-cd02f4ae2050300b new file mode 100755 index 0000000..1868f83 Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/deps/echo-cd02f4ae2050300b differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/deps/echo-cd02f4ae2050300b.d b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/deps/echo-cd02f4ae2050300b.d new file mode 100644 index 0000000..7f69c0f --- /dev/null +++ b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/deps/echo-cd02f4ae2050300b.d @@ -0,0 +1,5 @@ +/home/shkmv/Work/aji/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/deps/echo-cd02f4ae2050300b.d: src/main.rs + +/home/shkmv/Work/aji/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/deps/echo-cd02f4ae2050300b: src/main.rs + +src/main.rs: diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/echo b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/echo new file mode 100755 index 0000000..1868f83 Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/echo differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/echo.d b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/echo.d new file mode 100644 index 0000000..293cbde --- /dev/null +++ b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/echo.d @@ -0,0 +1 @@ +/home/shkmv/Work/aji/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/echo: /home/shkmv/Work/aji/docs/evaluation/dev-tasks/dev-echo/lang/rust/src/main.rs diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/183uhm7nrwyhir20ic7uymg4m.o b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/183uhm7nrwyhir20ic7uymg4m.o new file mode 100644 index 0000000..e1be60d Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/183uhm7nrwyhir20ic7uymg4m.o differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/1eujd3scfsl858m1zuitj9bgs.o b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/1eujd3scfsl858m1zuitj9bgs.o new file mode 100644 index 0000000..45da154 Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/1eujd3scfsl858m1zuitj9bgs.o differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/2utio9jy4n33966e6kbas1dlb.o b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/2utio9jy4n33966e6kbas1dlb.o new file mode 100644 index 0000000..a337bf4 Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/2utio9jy4n33966e6kbas1dlb.o differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/8cj2c89oo8gq2emn1p14ack8z.o b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/8cj2c89oo8gq2emn1p14ack8z.o new file mode 100644 index 0000000..fd89f4f Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/8cj2c89oo8gq2emn1p14ack8z.o differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/a8rkc5amsxwt5v4ehv705ngb6.o b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/a8rkc5amsxwt5v4ehv705ngb6.o new file mode 100644 index 0000000..e9c8312 Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/a8rkc5amsxwt5v4ehv705ngb6.o differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/dep-graph.bin b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/dep-graph.bin new file mode 100644 index 0000000..556876c Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/dep-graph.bin differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/query-cache.bin b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/query-cache.bin new file mode 100644 index 0000000..d5644f6 Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/query-cache.bin differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/work-products.bin b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/work-products.bin new file mode 100644 index 0000000..1dd60de Binary files /dev/null and b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj-7n9btzvhynq6mn69ey2x6jtlv/work-products.bin differ diff --git a/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj.lock b/docs/evaluation/dev-tasks/dev-echo/lang/rust/target/debug/incremental/echo-0gfed495edl5j/s-hmwio2daht-1aqy6nj.lock new file mode 100644 index 0000000..e69de29 diff --git a/docs/evaluation/harness.md b/docs/evaluation/harness.md index f438823..49ebdc4 100644 --- a/docs/evaluation/harness.md +++ b/docs/evaluation/harness.md @@ -93,7 +93,28 @@ The harness calls `CMD WORKSPACE LANGUAGE TASK_DIR` outside the agent's sandbox. {"accepted": true, "gates": {"verifier": true, "public_tests": true, "hidden_functional": true, "hidden_regression": true, "fuzz": true, "resources": true, "deterministic_runs": true, "schedule_exploration": true}} ``` -`accepted` follows protocol §13: all mandatory gates pass, with no partial success. The evaluator runs untrusted code, so it must sandbox that code itself. The record stores the hash of the evaluator, or of `--evaluator-hash-path`, and the full verdict. +`accepted` follows protocol §13: all mandatory gates pass, with no partial success. + +**Evaluator environment.** The harness calls the evaluator with the caller's environment plus three variables that describe the language toolchain exactly as the agent's sandbox had it: + +| Variable | Contents | +|---|---| +| `AJIEVAL_LANGUAGE` | `aji_air`, `rust` or `zig` | +| `AJIEVAL_TOOLCHAIN_PATH` | the toolchain's PATH entries, `:`-separated | +| `AJIEVAL_TOOLCHAIN_DIRS` | the directories to bind read-only, one per line | + +An evaluator that sandboxes the code it builds and runs should: + +- bind `AJIEVAL_TOOLCHAIN_DIRS` read-only and put `AJIEVAL_TOOLCHAIN_PATH` first on PATH, rather than relying on shims such as `~/.cargo/bin` or mise, which need the real HOME; +- set a private `CARGO_HOME` and build with `--offline` (Rust); +- build in a copy of the workspace without `target/`, `.zig-cache/` or `zig-out/`, which the agent built under `/work`; +- report infrastructure failures distinctly from solution failures. + +The evaluator's full output is stored in the run directory as `evaluator.log`; the record keeps only the verdict. To debug an evaluator without an agent run, call it exactly as the harness does: + +```sh +python3 -m ajieval evaluate --task TASK_DIR --language rust --workspace DIR --evaluator CMD --log evaluator.log +``` The evaluator runs untrusted code, so it must sandbox that code itself. The record stores the hash of the evaluator, or of `--evaluator-hash-path`, and the full verdict. ## Run record (`RUN/run.json`, protocol §28) diff --git a/tools/eval/ajieval/cli.py b/tools/eval/ajieval/cli.py index 820f502..899a6b6 100644 --- a/tools/eval/ajieval/cli.py +++ b/tools/eval/ajieval/cli.py @@ -94,6 +94,17 @@ def cmd_matrix(a): report.print_report([out]) +def cmd_evaluate(a): + """Runs an evaluator on a workspace exactly as the harness does (same + arguments and environment), to debug evaluator integration without an + agent run.""" + from . import task as task_mod + t = task_mod.Task(a.task) + lim = t.limits + verdict = record.evaluate(shlex.split(a.evaluator), os.path.realpath(a.workspace), a.language, t.dir, lim["command_timeout"] * 4, a.log) + print(json.dumps(verdict, indent=2)) + + def cmd_freeze(a): path, frozen = freeze.write(a.plan, a.order_seed) print(json.dumps({"freeze": path, "cells": len(frozen["order"]), "order_seed": frozen["order_seed"], "aji_commit": frozen["state"]["aji_commit"]})) @@ -161,6 +172,14 @@ def main(argv=None): m.add_argument("plan") m.set_defaults(fn=cmd_matrix) + ev = sub.add_parser("evaluate", help="run an evaluator on a workspace exactly as the harness does") + ev.add_argument("--task", required=True) + ev.add_argument("--language", required=True, choices=languages.available()) + ev.add_argument("--workspace", required=True) + ev.add_argument("--evaluator", required=True) + ev.add_argument("--log", help="write the evaluator's full stdout/stderr here") + ev.set_defaults(fn=cmd_evaluate) + fz = sub.add_parser("freeze", help="freeze a plan: record its state and a random cell order") fz.add_argument("plan") fz.add_argument("--order-seed", type=int) diff --git a/tools/eval/ajieval/native.py b/tools/eval/ajieval/native.py index 70b3c10..5e73ebb 100644 --- a/tools/eval/ajieval/native.py +++ b/tools/eval/ajieval/native.py @@ -455,7 +455,7 @@ def run_native(task_dir, lang_name, agent_name, model, out_dir, effort=None, see cyc = cycles(profile, lang.get("test"), command_events(agent_name, transcript)) with open(os.path.join(run_dir, "patch.diff"), "w") as f: f.write(diff_tree(pristine, workspace)) - verdict = record.evaluate(evaluator, workspace, lang_name, task.dir, lim["command_timeout"] * 4) if evaluator else None + verdict = record.evaluate(evaluator, workspace, lang_name, task.dir, lim["command_timeout"] * 4, os.path.join(run_dir, "evaluator.log")) if evaluator else None rec = { "schema": "aji-eval-native/1", diff --git a/tools/eval/ajieval/record.py b/tools/eval/ajieval/record.py index c123868..3cef530 100644 --- a/tools/eval/ajieval/record.py +++ b/tools/eval/ajieval/record.py @@ -47,12 +47,36 @@ def file_hashes(root): return out -def evaluate(evaluator, workspace, lang, task_dir, timeout): - """Runs the (external, hidden) evaluator; returns its JSON verdict.""" +def evaluator_env(lang): + """Environment for the evaluator: the caller's environment plus the + language toolchain exactly as the agent's sandbox had it, so an + evaluator that sandboxes the code it runs can bind the same directories. + + AJIEVAL_LANGUAGE language id (aji_air, rust, zig) + AJIEVAL_TOOLCHAIN_PATH PATH entries of the toolchain (`:`-separated) + AJIEVAL_TOOLCHAIN_DIRS directories to bind read-only (newline-separated) + """ + env = dict(os.environ) try: - p = subprocess.run(evaluator + [workspace, lang, task_dir], capture_output=True, text=True, timeout=timeout) + _, binds = languages.resolve_binaries(languages.load(lang)) + except SystemExit: + binds = [] + env["AJIEVAL_LANGUAGE"] = lang + env["AJIEVAL_TOOLCHAIN_PATH"] = ":".join(languages.sandbox_path(binds)) + env["AJIEVAL_TOOLCHAIN_DIRS"] = "\n".join(binds) + return env + + +def evaluate(evaluator, workspace, lang, task_dir, timeout, log_path=None): + """Runs the (external, hidden) evaluator; returns its JSON verdict. Its + full output goes to `log_path` (the run directory), not to the record.""" + try: + p = subprocess.run(evaluator + [workspace, lang, task_dir], capture_output=True, text=True, timeout=timeout, env=evaluator_env(lang)) except subprocess.TimeoutExpired: return {"accepted": False, "error": "evaluator timed out"} + if log_path: + with open(log_path, "w") as f: + f.write(f"$ {' '.join(evaluator)} WORKSPACE {lang} TASK_DIR\nexit {p.returncode}\n--- stdout ---\n{p.stdout}\n--- stderr ---\n{p.stderr}") try: verdict = json.loads(p.stdout) except json.JSONDecodeError: @@ -110,9 +134,9 @@ def run_one(task_dir, lang_name, provider_name, model, out_dir, model_class=None verdict = first_verdict = None if evaluator: - verdict = evaluate(evaluator, workspace, lang_name, task.dir, lim["command_timeout"] * 4) + verdict = evaluate(evaluator, workspace, lang_name, task.dir, lim["command_timeout"] * 4, os.path.join(run_dir, "evaluator.log")) if a.first_snapshot: - first_verdict = evaluate(evaluator, a.first_snapshot, lang_name, task.dir, lim["command_timeout"] * 4) + first_verdict = evaluate(evaluator, a.first_snapshot, lang_name, task.dir, lim["command_timeout"] * 4, os.path.join(run_dir, "evaluator.first.log")) metrics["first_hidden_test_passed"] = None if first_verdict is None else first_verdict["accepted"] record = {