Skip to content

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

Python

test(compact): a tier-2 eval that proves compact() pins a child's task

Rach Pradhan1fca5c561b39
diff --git a/evals/harness_behavior.jsonl b/evals/harness_behavior.jsonl
index 263f0bea..189a629a 100644
--- a/evals/harness_behavior.jsonl
+++ b/evals/harness_behavior.jsonl
@@ -7,3 +7,4 @@
{"id": "ambiguous-asks-instead-of-guessing", "why": "#106: an ambiguous request has to reach the human as an ask_user event and come back carrying THEIR words. The regression is a harness that buries the question in an ordinary tool_call the client cannot answer, or that answers it itself and lets the run continue on the guess.", "args": [], "prompt": "add caching", "controls_after_turn": [{"type": "answer", "text": "an external store, and cap it at 500 entries"}], "script": [{"tool": "ask_user", "arguments": {"question": "Should the cache live in process memory or in an external store?", "options": ["process memory", "external store"]}}, {"text": "using the external store, capped as you asked"}], "assert": [{"event": {"type": "ask_user", "question": "Should the cache live in process memory or in an external store?"}}, {"events_at_most": {"match": {"type": "tool_call", "name": "ask_user"}, "count": 0}}, {"event": {"type": "tool_result", "name": "ask_user", "is_error": false, "text": "an external store, and cap it at 500 entries"}}, {"request_contains": {"index": -1, "text": "cap it at 500 entries"}}, {"no_event": {"type": "tool_call", "name": "write_file"}}, {"final_text_contains": "using the external store"}]}
{"id": "two-file-edit-lands-both", "why": "#106: a two-file change has to land on disk, not merely be reported. The second edit_file only matches if the first write really happened, and the closing bash check prints its marker only when both files hold the new text - a reported-but-absent edit fails the case instead of passing it.", "args": [], "env": {"GRAFF_NO_CODEDB_GUARD": "1"}, "prompt": "raise the timeout to 60 and mark the import in the client", "script": [{"tool": "write_file", "arguments": {"path": "settings.py", "content": "TIMEOUT = 30\n"}}, {"tool": "write_file", "arguments": {"path": "client.py", "content": "from settings import TIMEOUT\n"}}, {"tool": "edit_file", "arguments": {"path": "settings.py", "old_string": "TIMEOUT = 30", "new_string": "TIMEOUT = 60"}}, {"tool": "edit_file", "arguments": {"path": "client.py", "old_string": "from settings import TIMEOUT", "new_string": "from settings import TIMEOUT # noqa"}}, {"tool": "bash", "arguments": {"command": "grep -q 'TIMEOUT = 60' settings.py && grep -q noqa client.py && echo both-edits-on-disk"}}, {"text": "both files are updated"}], "assert": [{"events_at_least": {"match": {"type": "tool_call", "name": "edit_file"}, "count": 2}}, {"events_at_most": {"match": {"type": "tool_call_finished", "is_error": true}, "count": 0}}, {"event": {"type": "tool_result", "name": "bash", "text": "both-edits-on-disk\n"}}, {"request_contains": {"index": -1, "text": "settings.py"}}, {"request_contains": {"index": -1, "text": "client.py"}}, {"final_text_contains": "both files are updated"}]}
{"id": "failed-bash-is-not-reported-as-success", "why": "#106: a command that fails must come back marked is_error with its exit status and stderr intact, so the next turn cannot mistake it for success. The regression is a swallowed failure - a non-zero exit finishing as an ok tool_call, or output trimmed away before the model sees why it broke.", "args": [], "prompt": "run the config check", "script": [{"tool": "bash", "arguments": {"command": "ls missing_config.yaml; exit 7"}}, {"text": "the config check failed, so I am not claiming it passed"}], "assert": [{"event": {"type": "tool_call_finished", "name": "bash", "is_error": true}}, {"events_at_most": {"match": {"type": "tool_call_finished", "name": "bash", "is_error": false}, "count": 0}}, {"request_contains": {"index": -1, "text": "[exit code 7]"}}, {"request_contains": {"index": -1, "text": "No such file or directory"}}, {"final_text_contains": "the config check failed"}]}
+{"id": "subagent-compaction-pins-task", "why": "G2/H2: compact() must call pinChildTask before it summarizes a subagent's history, or a compacted child loses its own mandate. No unit test can prove the wiring (compact() hits the network right after the prelude), so this drives a real child through auto-compaction against the scripted model and checks the request sent right after: it must still carry the child's task, restated verbatim, not just the model's summary.", "args": [], "env": {"GRAFF_COMPACT_PCT": "5"}, "prompt": "spawn a subagent to survey the payments module", "script": [{"tool": "subagent", "arguments": {"description": "survey payments", "prompt": "SENTINEL-TASK-9f2c: read every file under payments/ and list the exported functions"}}, {"tool": "bash", "arguments": {"command": "python3 -c \"print('c0'*2000)\""}}, {"tool": "bash", "arguments": {"command": "python3 -c \"print('c1'*2000)\""}}, {"tool": "bash", "arguments": {"command": "python3 -c \"print('c2'*2000)\""}}, {"tool": "bash", "arguments": {"command": "python3 -c \"print('c3'*2000)\""}}, {"text": "the payments module has been surveyed so far"}, {"text": "functions listed: chargeCard, refund, listInvoices"}, {"text": "the subagent found chargeCard, refund, and listInvoices"}], "assert": [{"event": {"type": "tool_call", "name": "subagent"}}, {"event": {"type": "tool_result", "name": "subagent", "is_error": false}}, {"request_contains": {"index": 6, "text": "SENTINEL-TASK-9f2c"}}, {"request_contains": {"index": 6, "text": "restated verbatim"}}, {"final_text_contains": "the subagent found chargeCard, refund, and listInvoices"}]}