Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

fix(eval): make three checks that could not fail actually fail

Rach Pradhan2e5f9b05f0a7
diff --git a/evals/harness_behavior.jsonl b/evals/harness_behavior.jsonl
index e9df36d4..9e0082d6 100644
--- a/evals/harness_behavior.jsonl
+++ b/evals/harness_behavior.jsonl
@@ -3,4 +3,4 @@
{"id": "todo-empty-write-noop", "why": "6300514: a todo_write with no usable items must leave the list untouched. It used to wipe the checklist, and an empty list read as completion.", "args": [], "prompt": "plan two steps, then send an empty checklist", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "survey the call sites", "status": "pending"}, {"content": "land the fix", "status": "pending"}]}}, {"tool": "todo_write", "arguments": {"todos": []}}, {"tool": "todo_read", "arguments": {}}, {"text": "the plan is unchanged"}], "assert": [{"events_at_least": {"match": {"type": "tool_call", "name": "todo_read"}, "count": 1}}, {"request_contains": {"index": -1, "text": "survey the call sites"}}, {"request_contains": {"index": -1, "text": "land the fix"}}]}
{"id": "todo-preserves-completed", "why": "2896b32: a replace that omits an already-completed item must keep it. Omitting finished work used to delete it, erasing the record of what was done.", "args": [], "prompt": "finish one step then replace the list without it", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "migrate the schema", "status": "completed"}, {"content": "backfill the rows", "status": "pending"}]}}, {"tool": "todo_write", "arguments": {"todos": [{"content": "backfill the rows", "status": "in_progress"}]}}, {"tool": "todo_read", "arguments": {}}, {"text": "still on the backfill"}], "assert": [{"request_contains": {"index": -1, "text": "migrate the schema"}}, {"request_contains": {"index": -1, "text": "backfill the rows"}}]}
{"id": "compaction-keeps-completed", "why": "#318: compaction mid-run must not lose the goal or the items already completed under it. The summary used to drop them and the run restarted work it had finished.", "args": ["--goal", "ship the migration"], "prompt": "start the work", "controls_after_turn": [{"type": "compact"}], "second_prompt": "keep going", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "write the migration", "status": "completed"}, {"content": "run it against staging", "status": "pending"}]}}, {"text": "migration written"}, {"text": "summary of the session so far: the migration is written"}, {"text": "running it against staging now"}], "assert": [{"event": {"type": "compact", "ok": true}}, {"request_contains": {"index": -1, "text": "write the migration"}}, {"request_contains": {"index": -1, "text": "ship the migration"}}]}
-{"id": "tool-budget-stops-the-run", "why": "A run that will not stop is worse than one that stops early. --max-tool-calls has to be enforced against the root agent, not just advertised.", "args": ["--max-tool-calls", "2"], "prompt": "keep calling the todo tool", "script": [{"tool": "todo_read", "arguments": {}}, {"tool": "todo_read", "arguments": {}}, {"tool": "todo_read", "arguments": {}}, {"tool": "todo_read", "arguments": {}}, {"text": "stopping"}], "assert": [{"events_at_most": {"match": {"type": "tool_call_started"}, "count": 2}}]}
+{"id": "tool-budget-stops-the-run", "why": "A run that will not stop is worse than one that stops early. --max-tool-calls has to be enforced against the root agent, not just advertised.", "args": ["--max-tool-calls", "2"], "prompt": "keep calling the todo tool", "script": [{"tool": "todo_read", "arguments": {}}, {"tool": "todo_read", "arguments": {}}, {"tool": "todo_read", "arguments": {}}, {"tool": "todo_read", "arguments": {}}, {"text": "stopping"}], "assert": [{"events_at_least": {"match": {"type": "tool_call_started"}, "count": 2}}, {"events_at_most": {"match": {"type": "tool_call_started"}, "count": 2}}, {"event": {"type": "turn"}}]}
diff --git a/scripts/eval-tier1.sh b/scripts/eval-tier1.sh
old mode 100644
new mode 100755
index 251ba29d..b9dab9d5
--- a/scripts/eval-tier1.sh
+++ b/scripts/eval-tier1.sh
@@ -180,7 +180,15 @@ if wanted sdk; then
skip_dependent sdk
else
announce sdk "the committed SDKs match \`graff --schema\`"
- if python3 sdk/generate.py --harness ./zig-out/bin/graff >/dev/null; then
+ # The generator rewrites sdk/ IN PLACE, so running it over uncommitted work
+ # there destroys it silently. Refuse instead: the check cannot tell a stale
+ # commit from an edit in progress, and only one of those is safe to clobber.
+ if [ -n "$(git status --porcelain -- sdk/)" ]; then
+ printf ' sdk/ has uncommitted changes; skipping rather than overwriting them:\n'
+ git status --porcelain -- sdk/ | sed 's/^/ /'
+ printf ' commit or stash them, then rerun: scripts/eval-tier1.sh --only sdk\n'
+ record_fail sdk
+ elif python3 sdk/generate.py --harness ./zig-out/bin/graff >/dev/null; then
if git diff --exit-code --stat -- sdk/; then
printf ' sdk/ is in sync with the schema\n'
else
diff --git a/scripts/eval-tier2.py b/scripts/eval-tier2.py
old mode 100755
new mode 100644
index b51d336b..a2402dc6
--- a/scripts/eval-tier2.py
+++ b/scripts/eval-tier2.py
@@ -238,6 +238,14 @@ def main() -> None:
indent=2))
return
problems = evaluate(case, run)
+ # A harness that crashed, hung, or died instantly must FAIL the case on
+ # its own, not merely annotate someone else's failure. Without this a
+ # case whose assertions are all upper bounds passes against a binary
+ # that never ran at all.
+ if run.exit_code not in (0, None):
+ problems.append(f"graff exited {run.exit_code}")
+ elif run.exit_code is None:
+ problems.append("graff did not exit (timed out)")
if problems:
failed.append(case["id"])
print(f" FAIL {case['id']}")