Skip to content

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

Python

Remove /pr-acceptance: a draft PR completes as an unverified handoff

justrachfcc1d31e51e0
diff --git a/docs/adr/0120-draft-publication-does-not-complete-verification.md b/docs/adr/0120-draft-publication-does-not-complete-verification.md
index 0de5aa3c..cadf316e 100644
--- a/docs/adr/0120-draft-publication-does-not-complete-verification.md
+++ b/docs/adr/0120-draft-publication-does-not-complete-verification.md
@@ -1,6 +1,6 @@
# 0120. Draft publication does not complete verification
-Status: accepted 2026-09-15
+Status: accepted 2026-09-15; draft authorization removed 2026-09-27
## Context
@@ -16,20 +16,19 @@ Every completion attempt reads fresh head evidence. A draft is insufficient
by default, even if its checks pass; failing base-branch checks explain a
blocker but do not waive the task's requirements.
-The user may explicitly choose `/pr-acceptance draft` in the terminal or ACP
-client, or `prAcceptance: "draft"` on a JSON user request. This permits only an
-unverified draft handoff. `/pr-acceptance verified` or the matching JSON value
-revokes it. The choice belongs to the current conversation and goal epoch;
-it is not saved, inherited by workers, or reconstructed from model prose.
-Resume and new conversations clear it. A new goal cannot reuse it.
-
-Authorized draft handoffs remain labelled unverified and cannot count as
-verified recipe success. Ready PRs still require passing checks. This tightens
-ADR 0104's distinction between a draft handoff and verified task completion.
+A draft PR at completion ends the run as an unverified handoff. No user
+command is needed; the `/pr-acceptance` control and the JSON `prAcceptance`
+option were removed on 2026-09-27. Stopping a run to ask the user to type a
+command only to hand back a draft cost more than it protected. The result
+text starts with "Draft handoff — CI is not verified.", and the draft never
+counts as verified task success (`taskVerified` stays false). A stale local
+head still defers completion. Ready PRs still require passing current-head
+checks. This keeps ADR 0104's distinction between a draft handoff and
+verified task completion.
## Verification
Offline production-dispatch cases publish through a local GitHub CLI fixture,
replace todos, and repeat completion attempts. They cover failing head/base
-checks, user authorization and revocation, and successful verified completion.
+checks, draft handoff completion, and successful verified completion.
The failure cases reproduce on the preceding release build.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index 33243a3b..7e998859 100644
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@ -128,7 +128,7 @@ record only when you need the evidence or the edge cases.
| [0116](0116-informational-turns-have-bounded-scope.md) | Summary turns gather bounded evidence; coding completion requirements apply to requested changes. |
| [0118](0118-file-edits-check-target-worktree.md) | File edits checkpoint the target Git worktree; unresolved paths retain the caller checkpoint. |
| [0119](0119-computer-tools-receive-caller-context.md) | Computer-use MCP requests receive opaque caller-owned session and turn context. |
-| [0120](0120-draft-publication-does-not-complete-verification.md) | Draft PRs cannot satisfy verified completion; only a user control scoped to this conversation and goal permits an unverified draft handoff. |
+| [0120](0120-draft-publication-does-not-complete-verification.md) | Draft PRs cannot satisfy verified completion. A draft completes as a labeled, unverified handoff with no user command; ready PRs need passing current-head checks. |
| [0121](0121-claims-include-repository-identity.md) | Claims include repository identity; literal PR mutations compare the observed repository, PR number and branch, while unknown scopes stay conservative. |
| [0122](0122-one-session-navigation-surface.md) | Open chats use the expanded sidebar or collapsed top tabs, preserving drafts and groups; focused mode keeps a compact composer and accessible settings. |
diff --git a/evals/harness_behavior.jsonl b/evals/harness_behavior.jsonl
index 92d0d68e..c4fd6c4d 100644
--- a/evals/harness_behavior.jsonl
+++ b/evals/harness_behavior.jsonl
@@ -97,11 +97,11 @@
{"id": "peer-checkpoint-file-target-worktree", "why": "File edits in a nested linked worktree must not inherit parent-checkout peer warnings; actual file changes still land.", "live_peer": true, "args": [], "prompt": "Create an isolated nested worktree, write its notes.txt, and change hello to updated.", "script": [{"tool": "write_file", "arguments": {"path": "nested/notes.txt", "content": "hello"}}, {"tool": "edit_file", "arguments": {"path": "nested/notes.txt", "old_string": "hello", "new_string": "updated"}}, {"tool": "read_file", "arguments": {"path": "nested/notes.txt"}}, {"text": "Updated the isolated worktree file."}], "assert": [{"event": {"type": "tool_call_finished", "name": "write_file", "is_error": false}}, {"event": {"type": "tool_call_finished", "name": "edit_file", "is_error": false}}, {"events_at_most": {"match": {"type": "tool_call_finished", "name": "write_file", "is_error": true}, "count": 0}}, {"events_at_most": {"match": {"type": "tool_call_finished", "name": "edit_file", "is_error": true}, "count": 0}}, {"request_contains": {"index": 3, "text": "updated"}}], "nested_worktree": true, "env": {"GRAFF_AUTO_ISOLATE": "off"}}
{"id": "peer-checkpoint-file-target-owner", "why": "An edit targeting a nested linked worktree must checkpoint that target worktree owner even when the caller uses the parent checkout.", "nested_worktree": true, "live_peer": true, "peer_in_nested_worktree": true, "args": [], "prompt": "Write hello to nested/notes.txt; acknowledge any shared-tree checkpoint before retrying.", "script": [{"tool": "write_file", "arguments": {"path": "nested/notes.txt", "content": "hello"}}, {"tool": "write_file", "arguments": {"path": "nested/notes.txt", "content": "hello"}}, {"text": "Created after the target-owner checkpoint."}], "assert": [{"events_at_least": {"match": {"type": "tool_call_finished", "name": "write_file", "is_error": true}, "count": 1}}, {"events_at_most": {"match": {"type": "tool_call_finished", "name": "write_file", "is_error": true}, "count": 1}}, {"event": {"type": "tool_call_finished", "name": "write_file", "is_error": false}}, {"request_contains": {"index": 1, "text": "shared-tree checkpoint"}}]}
{"id": "computer-tool-turn-context", "why": "Computer-use MCP calls require stable caller session and turn context, with a new turn identifier on the next user turn.", "env": {"GRAFF_MCP_SCHEMA_BUDGET": "0", "GRAFF_MCP_PROBE": "0", "GRAFF_LEARN_AUTO": "off"}, "workspace_seed": {".mcp.json": "{\"mcpServers\": {\"cua_repl\": {\"command\": \"python3\", \"args\": [\"context_mcp.py\"]}}}", "context_mcp.py": "import json, sys\nfirst = None\ncalls = 0\nfor line in sys.stdin:\n r = json.loads(line)\n if 'id' not in r: continue\n method = r.get('method')\n if method == 'initialize':\n result = {'protocolVersion':'2025-06-18','capabilities':{'tools':{}},'serverInfo':{'name':'fixture','version':'1'}}\n elif method == 'tools/list':\n result = {'tools':[{'name':'js','description':'Check caller context','inputSchema':{'type':'object','properties':{'code':{'type':'string'}}}}]}\n elif method == 'tools/call':\n calls += 1\n meta = r['params'].get('_meta', {}).get('x-codex-turn-metadata', {})\n if isinstance(meta, str): meta = json.loads(meta)\n valid = all(isinstance(meta.get(key), str) and meta[key] for key in ('session_id','turn_id'))\n if calls == 1:\n first = meta\n valid = valid\n elif calls == 2: valid = valid and meta == first\n else: valid = valid and meta['session_id'] == first.get('session_id') and meta['turn_id'] != first.get('turn_id')\n text = ('initial context received' if calls == 1 else 'same-turn context preserved' if calls == 2 else 'next-turn context rotated') if valid else 'context missing or incorrectly scoped'\n result = {'content':[{'type':'text','text':text}], 'isError':not valid}\n else: result = {}\n print(json.dumps({'jsonrpc':'2.0','id':r['id'],'result':result}),flush=True)\n"}, "prompt": "Load the context-check tool and call it twice.", "second_prompt": "Call the context-check tool once more.", "script": [{"tool": "load_tool_schemas", "arguments": {"server": "cua_repl"}}, {"tool": "mcp__cua_repl__js", "arguments": {"code": "first"}}, {"tool": "mcp__cua_repl__js", "arguments": {"code": "same"}}, {"text": "Both calls completed."}, {"tool": "mcp__cua_repl__js", "arguments": {"code": "next"}}, {"text": "Context verified."}], "assert": [{"request_contains": {"index": 2, "text": "initial context received"}}, {"request_contains": {"index": 3, "text": "same-turn context preserved"}}, {"request_contains": {"index": 5, "text": "next-turn context rotated"}}, {"events_at_most": {"match": {"type": "tool_call_finished", "name": "mcp__cua_repl__js", "is_error": true}, "count": 0}}]}
-{"id":"draft-cannot-waive-pr-completion","why":"#931: real publication arms an obligation that survives draft status, rewritten todos and repeated completion attempts.","args":["--old","--goal","Deliver a PR with passing current-head CI"],"env":{"GRAFF_NO_CODEDB_GUARD":"1"},"github_fixture":{"checks":"FAILURE","runs":"failure"},"prompt":"Run the local publication fixture and fulfill the objective.","script":[{"tool":"todo_write","arguments":{"todos":[{"content":"inspect exact-head CI","status":"pending"}]}},{"tool":"bash","arguments":{"command":"gh pr create --draft --title fixture --body-file notes.md"}},{"tool":"todo_write","arguments":{"todos":[{"content":"provide draft handoff","status":"completed"}]}},{"tool":"attempt_completion","arguments":{"result":"Draft handoff; the base checks also fail."}},{"tool":"attempt_completion","arguments":{"result":"Draft handoff; the base checks also fail."}},{"text":"CI is unresolved."}],"assert":[{"events_at_least":{"match":{"type":"tool_call_finished","name":"attempt_completion","is_error":true},"count":2}},{"no_event":{"type":"tool_call_finished","name":"attempt_completion","is_error":false}},{"request_contains":{"text":"Draft publication and base-branch failures do not waive verification."}},{"request_contains":{"text":"provide draft handoff"}}]}
-{"id":"base-failure-cannot-waive-pr-completion","why":"#931: observing failing CI on the base explains a blocker but cannot authorize task completion.","args":["--old","--goal","Deliver a PR with passing current-head CI"],"env":{"GRAFF_NO_CODEDB_GUARD":"1"},"github_fixture":{"checks":"FAILURE","runs":"failure"},"prompt":"Run the local publication fixture and fulfill the objective.","script":[{"tool":"todo_write","arguments":{"todos":[{"content":"inspect exact-head CI","status":"pending"}]}},{"tool":"bash","arguments":{"command":"git -c user.name=Fixture -c [email protected] commit --allow-empty -m change"}},{"tool":"bash","arguments":{"command":"gh run list --commit \"$(git rev-parse HEAD^)\" --json status,conclusion"}},{"tool":"bash","arguments":{"command":"gh pr create --draft --title fixture --body-file notes.md"}},{"tool":"todo_write","arguments":{"todos":[{"content":"provide draft handoff","status":"completed"}]}},{"tool":"attempt_completion","arguments":{"result":"Draft handoff; the base checks also fail."}},{"tool":"attempt_completion","arguments":{"result":"Draft handoff; the base checks also fail."}},{"text":"CI is unresolved."}],"assert":[{"events_at_least":{"match":{"type":"tool_call_finished","name":"attempt_completion","is_error":true},"count":2}},{"no_event":{"type":"tool_call_finished","name":"attempt_completion","is_error":false}},{"request_contains":{"text":"Draft publication and base-branch failures do not waive verification."}},{"request_contains":{"text":"provide draft handoff"}},{"request_contains":{"text":"failure"}}]}
-{"id":"user-authorized-draft-handoff","why":"#931: the user-owned JSON control permits a draft-only outcome without claiming verified CI.","args":["--old","--goal","Create an unverified draft handoff"],"env":{"GRAFF_NO_CODEDB_GUARD":"1"},"github_fixture":{"checks":"FAILURE","runs":"failure"},"prompt":"Run the local publication fixture and fulfill the objective.","script":[{"tool":"todo_write","arguments":{"todos":[{"content":"inspect exact-head CI","status":"pending"}]}},{"tool":"bash","arguments":{"command":"gh pr create --draft --title fixture --body-file notes.md"}},{"tool":"todo_write","arguments":{"todos":[{"content":"provide draft handoff","status":"completed"}]}},{"tool":"attempt_completion","arguments":{"result":"Draft handoff; the base checks also fail."}}],"assert":[{"event":{"type":"tool_call_finished","name":"attempt_completion","is_error":false}},{"final_text_contains":"Draft handoff \u2014 CI is not verified."}],"prompt_options":{"prAcceptance":"draft"}}
-{"id": "draft-scope-does-not-waive-ready-pr-ci", "why": "#931: draft-only permission does not turn failed ready-PR checks into verified completion.", "args": ["--old", "--goal", "Deliver a PR with passing current-head CI"], "env": {"GRAFF_NO_CODEDB_GUARD": "1"}, "github_fixture": {"checks": "FAILURE", "runs": "none", "review_files": ["notes.md"]}, "prompt": "Run the local publication fixture and fulfill the objective.", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "inspect exact-head CI", "status": "pending"}]}}, {"tool": "bash", "arguments": {"command": "gh pr create --title fixture --body-file notes.md"}}, {"text": "{\"verdict\": \"supported\", \"reason\": \"Controlled committed fixture review.\"}"}, {"tool": "todo_write", "arguments": {"todos": [{"content": "provide draft handoff", "status": "completed"}]}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}, {"text": "CI is unresolved."}], "assert": [{"events_at_least": {"match": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": true}, "count": 2}}, {"no_event": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": false}}, {"request_contains": {"text": "Draft publication and base-branch failures do not waive verification."}}, {"request_contains": {"text": "provide draft handoff"}}], "prompt_options": {"prAcceptance": "draft"}}
-{"id":"user-can-require-verified-pr-again","why":"#931: explicit verified scope revokes draft-only permission before the next user turn.","args":["--old","--goal","Deliver a PR with passing current-head CI"],"env":{"GRAFF_NO_CODEDB_GUARD":"1"},"github_fixture":{"checks":"FAILURE","runs":"failure"},"prompt":"Run the local publication fixture and fulfill the objective.","script":[{"text":"Draft scope selected."},{"tool":"todo_write","arguments":{"todos":[{"content":"inspect exact-head CI","status":"pending"}]}},{"tool":"bash","arguments":{"command":"gh pr create --draft --title fixture --body-file notes.md"}},{"tool":"todo_write","arguments":{"todos":[{"content":"provide draft handoff","status":"completed"}]}},{"tool":"attempt_completion","arguments":{"result":"Draft handoff; the base checks also fail."}},{"tool":"attempt_completion","arguments":{"result":"Draft handoff; the base checks also fail."}},{"text":"CI is unresolved."}],"assert":[{"events_at_least":{"match":{"type":"tool_call_finished","name":"attempt_completion","is_error":true},"count":2}},{"no_event":{"type":"tool_call_finished","name":"attempt_completion","is_error":false}},{"request_contains":{"text":"Draft publication and base-branch failures do not waive verification."}},{"request_contains":{"text":"provide draft handoff"}}],"prompt_options":{"prAcceptance":"verified"},"controls_before_prompt":[{"type":"user","text":"Allow a draft-only scope.","prAcceptance":"draft"}]}
+{"id": "passing-draft-is-still-unverified", "why": "#931: a draft never counts as verified completion, even with passing checks; it completes only as a labeled unverified handoff.", "args": ["--old", "--goal", "Deliver a PR with passing current-head CI"], "env": {"GRAFF_NO_CODEDB_GUARD": "1"}, "github_fixture": {"checks": "SUCCESS", "runs": "success"}, "prompt": "Run the local publication fixture and fulfill the objective.", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "inspect exact-head CI", "status": "pending"}]}}, {"tool": "bash", "arguments": {"command": "gh pr create --draft --title fixture --body-file notes.md"}}, {"tool": "todo_write", "arguments": {"todos": [{"content": "provide draft handoff", "status": "completed"}]}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}, {"text": "CI is unresolved."}], "assert": [{"event": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": false}}, {"final_text_contains": "Draft handoff \u2014 CI is not verified."}]}
+{"id": "base-failure-cannot-waive-pr-completion", "why": "#931: observing failing CI on the base explains a blocker but cannot authorize completion of a ready PR.", "args": ["--old", "--goal", "Deliver a PR with passing current-head CI"], "env": {"GRAFF_NO_CODEDB_GUARD": "1"}, "github_fixture": {"checks": "FAILURE", "runs": "failure", "review_files": ["notes.md"]}, "prompt": "Run the local publication fixture and fulfill the objective.", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "inspect exact-head CI", "status": "pending"}]}}, {"tool": "bash", "arguments": {"command": "git -c user.name=Fixture -c [email protected] commit --allow-empty -m change"}}, {"tool": "bash", "arguments": {"command": "gh run list --commit \"$(git rev-parse HEAD^)\" --json status,conclusion"}}, {"tool": "bash", "arguments": {"command": "gh pr create --title fixture --body-file notes.md"}}, {"text": "{\"verdict\": \"supported\", \"reason\": \"Controlled committed fixture review.\"}"}, {"tool": "todo_write", "arguments": {"todos": [{"content": "provide draft handoff", "status": "completed"}]}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}, {"text": "CI is unresolved."}], "assert": [{"events_at_least": {"match": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": true}, "count": 2}}, {"no_event": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": false}}, {"request_contains": {"text": "Base-branch failures do not waive verification"}}, {"request_contains": {"text": "provide draft handoff"}}, {"request_contains": {"text": "failure"}}]}
+{"id": "draft-handoff-needs-no-user-command", "why": "A draft PR completes as a labeled, unverified handoff; no /pr-acceptance or prAcceptance control is required (ADR 0120, 2026-09-27).", "args": ["--old", "--goal", "Create an unverified draft handoff"], "env": {"GRAFF_NO_CODEDB_GUARD": "1"}, "github_fixture": {"checks": "FAILURE", "runs": "failure"}, "prompt": "Run the local publication fixture and fulfill the objective.", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "inspect exact-head CI", "status": "pending"}]}}, {"tool": "bash", "arguments": {"command": "gh pr create --draft --title fixture --body-file notes.md"}}, {"tool": "todo_write", "arguments": {"todos": [{"content": "provide draft handoff", "status": "completed"}]}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}], "assert": [{"event": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": false}}, {"final_text_contains": "Draft handoff \u2014 CI is not verified."}]}
+{"id": "ready-pr-failing-ci-defers", "why": "#931: a ready PR with failing current-head checks cannot complete, even when the result text calls it a handoff.", "args": ["--old", "--goal", "Deliver a PR with passing current-head CI"], "env": {"GRAFF_NO_CODEDB_GUARD": "1"}, "github_fixture": {"checks": "FAILURE", "runs": "none", "review_files": ["notes.md"]}, "prompt": "Run the local publication fixture and fulfill the objective.", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "inspect exact-head CI", "status": "pending"}]}}, {"tool": "bash", "arguments": {"command": "gh pr create --title fixture --body-file notes.md"}}, {"text": "{\"verdict\": \"supported\", \"reason\": \"Controlled committed fixture review.\"}"}, {"tool": "todo_write", "arguments": {"todos": [{"content": "provide draft handoff", "status": "completed"}]}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}, {"text": "CI is unresolved."}], "assert": [{"events_at_least": {"match": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": true}, "count": 2}}, {"no_event": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": false}}, {"request_contains": {"text": "Base-branch failures do not waive verification"}}, {"request_contains": {"text": "provide draft handoff"}}]}
+{"id": "legacy-pr-acceptance-option-is-ignored", "why": "The removed prAcceptance request field is ignored: a client that still sends \"verified\" does not block a draft handoff.", "args": ["--old", "--goal", "Create an unverified draft handoff"], "env": {"GRAFF_NO_CODEDB_GUARD": "1"}, "github_fixture": {"checks": "FAILURE", "runs": "failure"}, "prompt": "Run the local publication fixture and fulfill the objective.", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "inspect exact-head CI", "status": "pending"}]}}, {"tool": "bash", "arguments": {"command": "gh pr create --draft --title fixture --body-file notes.md"}}, {"tool": "todo_write", "arguments": {"todos": [{"content": "provide draft handoff", "status": "completed"}]}}, {"tool": "attempt_completion", "arguments": {"result": "Draft handoff; the base checks also fail."}}], "assert": [{"event": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": false}}, {"final_text_contains": "Draft handoff \u2014 CI is not verified."}], "prompt_options": {"prAcceptance": "verified"}}
{"id": "current-head-passing-pr-completes", "why": "#931: default verified acceptance still permits a ready PR with fresh passing head checks.", "args": ["--old", "--goal", "Deliver a PR with passing current-head CI"], "env": {"GRAFF_NO_CODEDB_GUARD": "1"}, "github_fixture": {"checks": "SUCCESS", "runs": "success", "review_files": ["notes.md"]}, "prompt": "Run the local publication fixture and fulfill the objective.", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "inspect exact-head CI", "status": "pending"}]}}, {"tool": "bash", "arguments": {"command": "gh pr create --title fixture --body-file notes.md"}}, {"text": "{\"verdict\": \"supported\", \"reason\": \"Controlled committed fixture review.\"}"}, {"tool": "todo_write", "arguments": {"todos": [{"content": "provide draft handoff", "status": "completed"}]}}, {"tool": "attempt_completion", "arguments": {"result": "Verified PR complete."}}], "assert": [{"event": {"type": "tool_call_finished", "name": "attempt_completion", "is_error": false}}, {"final_text_contains": "Verified PR complete."}]}
{"id":"repository-scoped-claim-release","why":"#925: production claim dispatch and persisted records must distinguish identical PR numbers in different repositories; releasing one must preserve the other.","args":["--old"],"github_fixture":{},"prompt":"Acquire the two repository claims, release the first, and inspect the second.","script":[{"tool":"peer_message","arguments":{"action":"claim","kind":"pull_request","key":"1","repo":"fixture/first"}},{"tool":"peer_message","arguments":{"action":"claim","kind":"pull_request","key":"1","repo":"fixture/second"}},{"tool":"peer_message","arguments":{"action":"release","kind":"pull_request","key":"1","repo":"fixture/first"}},{"tool":"peer_message","arguments":{"action":"status","kind":"pull_request","key":"1","repo":"fixture/second"}},{"text":"The second repository claim remains held."}],"assert":[{"request_contains":{"text":"claim pull_request 1: mine"}},{"events_at_most":{"match":{"type":"tool_call_finished","name":"peer_message","is_error":true},"count":0}},{"final_text_contains":"The second repository claim remains held."}]}
{"id":"human-workflow-clarify-edit-recover-followup","why":"#106: a two-file task preserves user clarification, recovers from a failed edit, and handles a follow-up; independent checks reject a plausible but absent result.","args":["--old"],"env":{"GRAFF_NO_CODEDB_GUARD":"1"},"workspace_seed":{"normalize.py":"def normalize(text):\n return text.lower()\n","client.py":"def render(items):\n return \",\".join(items)\n","README.md":"Keep this documentation unchanged.\n"},"prompt":"Make render trim labels using the existing normalizer. Clarify whether to preserve case before editing. Keep the README unchanged, and verify the actual result.","controls_after_turn":[{"type":"answer","text":"Preserve case exactly; trim surrounding whitespace only."}],"second_prompt":"Now skip empty and whitespace-only labels too. Keep the earlier case behavior, and test that input lists stay unchanged.","script":[{"tool":"read_file","arguments":{"path":"normalize.py"}},{"tool":"read_file","arguments":{"path":"client.py"}},{"tool":"ask_user","arguments":{"question":"Should label case be preserved or normalized?","options":["Preserve case","Lowercase"]}},{"tool":"bash","arguments":{"command":"python3 -c 'from client import render; assert render([\" A \", \"B \"]) == \"A,B\"; print(\"render checks passed\")'"}},{"tool":"edit_file","arguments":{"path":"normalize.py","old_string":" return text.upper()","new_string":" return text.strip()"}},{"tool":"read_file","arguments":{"path":"normalize.py"}},{"tool":"edit_file","arguments":{"path":"normalize.py","old_string":" return text.lower()","new_string":" return text.strip()"}},{"tool":"edit_file","arguments":{"path":"client.py","old_string":"def render(items):\n return \",\".join(items)\n","new_string":"from normalize import normalize\n\ndef render(items):\n return \",\".join(normalize(item) for item in items)\n"}},{"tool":"bash","arguments":{"command":"python3 -c 'from client import render; assert render([\" A \", \"B \"]) == \"A,B\"; print(\"render checks passed\")'"}},{"text":"Both files now trim labels while preserving case. The render checks passed; README is unchanged."},{"tool":"read_file","arguments":{"path":"client.py"}},{"tool":"edit_file","arguments":{"path":"client.py","old_string":"from normalize import normalize\n\ndef render(items):\n return \",\".join(normalize(item) for item in items)\n","new_string":"from normalize import normalize\n\ndef render(items):\n return \",\".join(normalize(item) for item in items if normalize(item))\n"}},{"tool":"bash","arguments":{"command":"python3 -c 'from client import render; x=[\" A \",\" \",\"B\",\"\"]; before=x.copy(); assert render(x)==\"A,B\"; assert x==before; assert render([])==\"\"; print(\"follow-up checks passed\")'"}},{"text":"Blank labels are skipped. Case and input lists are preserved; follow-up checks passed."}],"verify_command":["python3","-c","from client import render; from normalize import normalize; x=[\" Ab \",\" \",\"cD\",\"\"]; before=x.copy(); assert render(x)==\"Ab,cD\"; assert x==before; assert render([])==\"\"; assert normalize(\" X \")==\"X\"; print(\"independent outcomes passed\")"],"assert":[{"event":{"type":"ask_user","question":"Should label case be preserved or normalized?"}},{"event":{"type":"tool_result","name":"ask_user","is_error":false,"text":"Preserve case exactly; trim surrounding whitespace only."}},{"event":{"type":"tool_call_finished","name":"edit_file","is_error":true}},{"event":{"type":"tool_call_finished","name":"bash","is_error":true}},{"events_at_least":{"match":{"type":"turn"},"count":2}},{"request_contains":{"text":"Preserve case exactly"}},{"final_text_contains":"follow-up checks passed"},{"file_equals":{"path":"normalize.py","content":"def normalize(text):\n return text.strip()\n"}},{"file_equals":{"path":"client.py","content":"from normalize import normalize\n\ndef render(items):\n return \",\".join(normalize(item) for item in items if normalize(item))\n"}},{"file_equals":{"path":"README.md","content":"Keep this documentation unchanged.\n"}},{"request_contains":{"index":3,"text":"Preserve case exactly"}},{"request_tool_calls_at_most":{"index":3,"name":"edit_file","count":0}}]}
diff --git a/scripts/test-pr-completion-acp.py b/scripts/test-pr-completion-acp.py
index 58bef4ab..ef030113 100644
--- a/scripts/test-pr-completion-acp.py
+++ b/scripts/test-pr-completion-acp.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-"""Real ACP user controls, publication and goal state against local-only fixtures."""
+"""Real ACP publication and goal state against local-only fixtures: a draft PR completes as an unverified handoff."""
import argparse
import json
import os
@@ -32,10 +32,7 @@ def main():
tool('todo_write', todos=[{'content': 'inspect exact-head CI', 'status': 'pending'}]),
tool('bash', command='gh pr create --draft --title fixture --body-file notes.md'),
tool('todo_write', todos=[{'content': 'provide draft handoff', 'status': 'completed'}]),
- attempt, attempt, {'text': 'CI remains unresolved.'},
- attempt,
- tool('todo_write', todos=[{'content': 'provide another handoff', 'status': 'completed'}]),
- attempt, {'text': 'New goal still requires verified CI.'},
+ attempt, {'text': 'Draft handoff.'},
])
with tempfile.TemporaryDirectory(prefix='graff-pr-acp-') as temp:
work = Path(temp)
@@ -85,35 +82,17 @@ def main():
return json.loads(current.read_text())['goal']
prompt('/goal Deliver a PR with passing current-head CI')
assert not model.requests, 'Slash goal command was sent to the model'
- prompt('Run the publication fixture and complete the task.')
- assert saved_goal()['status'] == 'active', saved_goal()
- assert 'completion deferred: current-head PR verification' in json.dumps(model.requests[-1])
- print('PASS ACP default: failed draft, replaced checklist, repeated completion leave the goal active', flush=True)
+ _, updates = prompt('Run the publication fixture and complete the task.')
+ assert saved_goal()['status'] == 'complete', saved_goal()
+ assert 'Draft handoff \u2014 CI is not verified.' in json.dumps(updates) or 'Draft handoff — CI is not verified.' in json.dumps(updates, ensure_ascii=False), updates
+ assert 'completion deferred' not in json.dumps(model.requests), 'a draft handoff was deferred'
+ print('PASS ACP default: a draft PR completes as a labeled unverified handoff with no user command', flush=True)
if args.only_default:
return
before = len(model.requests)
- _, updates = prompt('/pr-acceptance draft')
- assert len(model.requests) == before, 'Scope command was sent to the model'
- assert 'draft handoff authorized' in json.dumps(updates), updates
- prompt('Complete the explicitly authorized draft-only handoff.')
- assert saved_goal()['status'] == 'complete', saved_goal()
- print('PASS ACP explicit draft scope permits only the authorized goal to complete', flush=True)
- prompt('/goal Deliver another verified PR')
- prompt('Complete this new task.')
- assert saved_goal()['status'] == 'active', saved_goal()
- _, updates = prompt('/pr-acceptance')
- assert 'PR acceptance: verified.' in json.dumps(updates), updates
- print('PASS ACP new goal cannot reuse the prior draft scope', flush=True)
- prompt('/save acceptance-fixture')
- prompt('/pr-acceptance draft')
- prompt('/resume acceptance-fixture')
- _, updates = prompt('/pr-acceptance')
- assert 'PR acceptance: verified.' in json.dumps(updates), updates
prompt('/pr-acceptance draft')
- prompt('/new')
- _, updates = prompt('/pr-acceptance')
- assert 'PR acceptance: verified.' in json.dumps(updates), updates
- print('PASS ACP resume and new conversation reset draft-only scope', flush=True)
+ assert len(model.requests) == before, 'removed /pr-acceptance was sent to the model'
+ print('PASS ACP /pr-acceptance is gone and never reaches the model', flush=True)
finally:
if args.evidence:
args.evidence.mkdir(parents=True, exist_ok=True)
diff --git a/src/agent.zig b/src/agent.zig
index 1a777b29..f1f9d881 100644
--- a/src/agent.zig
+++ b/src/agent.zig
@@ -120,7 +120,6 @@ pub const Agent = struct {
sys_override: ?[]const u8 = null, // per-child custom prompt or transient isolated-review base
task_prompt: ?[]const u8 = null, // a subagent's mandate, pinned once before the first history rewrite so compaction can restate it verbatim (recentContextStart can keep no verbatim suffix for a child - its only clean user turn is index 0)
pr_verification: @import("pr_verify.zig").State = .unused,
- pr_draft_scope: ?@import("pr_acceptance.zig").Scope = null,
agent_cwd: ?[]const u8 = null, // subagent-only (#276 P0-1): absolute path of this agent's isolated git worktree, threaded through ToolCtx per tool call instead of a process-wide chdir — parallel siblings each keep their own
tools_used: trace.ToolSink = .{}, // external tool calls this agent made (per turn for the root)
tool_calls_this_turn: u64 = 0,
diff --git a/src/command_catalog.zig b/src/command_catalog.zig
index 604bf834..ed0bdbf8 100644
--- a/src/command_catalog.zig
+++ b/src/command_catalog.zig
@@ -66,7 +66,6 @@ pub const commands = [_]Item{
.{ .name = "/new", .desc = "start a fresh autosaved session" },
.{ .name = "/rename", .usage = "/rename <title>", .desc = "set the current session title" },
.{ .name = "/goal", .usage = "/goal [30m] [text|pause|resume|status|clear]", .desc = "set a standing objective and work it autonomously; an optional 30s/30m/2h budget paces the run; pause/resume steering, status shows state, clear removes it" },
- .{ .name = "/pr-acceptance", .usage = "/pr-acceptance [verified|draft]", .desc = "choose whether this conversation and goal requires verified PR checks or permits an unverified draft handoff" },
.{ .name = "/loop", .usage = "/loop [30m] <prompt>", .desc = "the same autonomous run as /goal, without adopting a standing objective" },
.{ .name = "/goals", .desc = "show the current goal without changing it (alias for /goal status)" },
.{ .name = "/schedule", .usage = "/schedule <30s|5m|2h> <prompt>", .desc = "fire a prompt later; delay tokens match /loop (not a standing goal)" },
@@ -173,7 +172,7 @@ test "suggest (#1275): typos find the command, unrelated words do not" {
test "commandWord (#1275): paths and prose are not commands" {
try std.testing.expectEqualStrings("/resuem", commandWord("/resuem").?);
try std.testing.expectEqualStrings("/resuem", commandWord(" /resuem last ").?);
- try std.testing.expectEqualStrings("/pr-acceptance", commandWord("/pr-acceptance draft").?);
+ try std.testing.expectEqualStrings("/import-claude", commandWord("/import-claude now").?);
try std.testing.expectEqualStrings("/foo", commandWord("/foo\nsecond line").?);
try std.testing.expect(commandWord("/usr/bin/foo") == null);
try std.testing.expect(commandWord("/usr/bin/foo explain this") == null);
diff --git a/src/commands_session.zig b/src/commands_session.zig
index 8132c6fa..170b4302 100644
--- a/src/commands_session.zig
+++ b/src/commands_session.zig
@@ -67,7 +67,6 @@ const setTerminalTitle = title_mod.setTerminalTitle;
/// after "context cleared" (#178).
pub fn resetConversationSteering(root: *Agent) void {
root.goal = null;
- root.pr_draft_scope = null;
root.completion_gate_armed = false; // a dropped goal re-arms the completion double-check (#318)
root.todos_dirty = false; // the conversation's checklist dies with it; nothing survives as /loop evidence (#318)
root.ultracode_mode = false;
@@ -92,7 +91,6 @@ pub fn tryHandle(root: *Agent, keys: *Keys, arena: Allocator, line: []const u8,
_ = keys; // unused in this file's command set; kept for a uniform tryHandle signature
// #554: claims /snapshot, and /rewind ONLY when its argument is a snapshot
// id — a numeric /rewind falls through to the conversation rewind below.
- if (try @import("pr_acceptance.zig").slash(root, line, out)) return true;
if (try commands_sandbox.tryHandle(root, arena, line, out)) return true;
if (try commands_trajectory.tryHandle(root, arena, line, out)) return true;
if (try @import("commands_experiment.zig").tryHandle(root, arena, line, out)) return true;
@@ -182,7 +180,6 @@ pub fn tryHandle(root: *Agent, keys: *Keys, arena: Allocator, line: []const u8,
}
const open = goal_state.openCount(root.todos.items, goal_state.currentEpoch(root.goal));
root.goal = null; // the checklist parks with its old epoch
- root.pr_draft_scope = null;
goal_state.resetCompletionGate(root);
root.goal_note_fp = 0;
prompts.pinStandingGoal(root, arena);
diff --git a/src/help.zig b/src/help.zig
index 01e10399..53024031 100644
--- a/src/help.zig
+++ b/src/help.zig
@@ -30,7 +30,7 @@ const peers_blurb =
pub const sections = [_]Section{
.{ .title = "getting around", .names = &.{ "/new", "/clear", "/resume", "/save", "/sessions", "/workspace", "/experiment", "/rename", "/rewind", "/edit", "/snapshot", "/teleport" } },
.{ .title = "the model", .names = &.{ "/model", "/models", "/effort", "/reasoning", "/fast", "/thinking", "/keepcontext", "/fallback", "/routes" } },
- .{ .title = "working autonomously", .names = &.{ "/goal", "/goals", "/pr-acceptance", "/loop", "/schedule", "/review", "/issue", "/plan", "/todo", "/jobs", "/ultracode", "/strict", "/yolo", "/never" } },
+ .{ .title = "working autonomously", .names = &.{ "/goal", "/goals", "/loop", "/schedule", "/review", "/issue", "/plan", "/todo", "/jobs", "/ultracode", "/strict", "/yolo", "/never" } },
.{ .title = "talking to other graffs", .names = &.{ "/tell", "/daddy", "/peek", "/adapter" }, .blurb = peers_blurb },
.{ .title = "your setup", .names = &.{ "/login", "/key", "/cost", "/usage", "/version", "/update", "/privacy", "/mcp", "/import-claude", "/skills", "/plugins", "/agents", "/hooks", "/tools", "/fleet" } },
.{ .title = "context & history", .names = &.{ "/compact", "/btw", "/doctor", "/debug", "/cache", "/trace", "/trajectory" } },
diff --git a/src/json_controls.zig b/src/json_controls.zig
index c4a43754..72906a46 100644
--- a/src/json_controls.zig
+++ b/src/json_controls.zig
@@ -68,20 +68,10 @@ pub fn applyToolKnobs(obj: std.json.ObjectMap) void {
}
}
-/// User-request options: tool ceilings, native images, and explicit PR scope.
+/// User-request options: tool ceilings and native images.
/// False means validation already emitted the request error.
pub fn applyTurnOptions(root: *Agent, obj: std.json.ObjectMap) bool {
if (!remote_images.stage(root, obj)) return false;
- if (obj.get("prAcceptance")) |value| {
- if (value != .string) {
- root.emit(.{ .type = "error", .message = "prAcceptance must be verified or draft" });
- return false;
- }
- @import("pr_acceptance.zig").set(root, value.string) catch {
- root.emit(.{ .type = "error", .message = "prAcceptance must be verified or draft" });
- return false;
- };
- }
applyToolKnobs(obj);
return true;
}
diff --git a/src/main.zig b/src/main.zig
index 448a6f04..83b774de 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -53,7 +53,7 @@ test {
_ = .{ @import("http2_buffered.zig"), @import("clipboard_native.zig"), @import("clipboard_edge_tests.zig"), @import("clipboard_failure_tests.zig"), @import("process_runner_clipboard_tests.zig") };
_ = @import("server_orphan.zig");
_ = @import("repo_transaction.zig");
- _ = .{ @import("pr_command.zig"), @import("pr_evidence.zig"), @import("pr_verify.zig"), @import("pr_acceptance.zig"), @import("artifact_repository.zig"), @import("artifact_claim_ledger.zig"), @import("artifact_claim_store.zig"), @import("artifact_claim_stale.zig") };
+ _ = .{ @import("pr_command.zig"), @import("pr_evidence.zig"), @import("pr_verify.zig"), @import("artifact_repository.zig"), @import("artifact_claim_ledger.zig"), @import("artifact_claim_store.zig"), @import("artifact_claim_stale.zig") };
_ = @import("argstream_citation_tests.zig"); // unit_tests' root is main.zig only, so reference every split-out module or its tests silently never run
_ = @import("codex_node_repl.zig");
_ = pricing;
diff --git a/src/pr_acceptance.zig b/src/pr_acceptance.zig
deleted file mode 100644
index 5097a2f8..00000000
--- a/src/pr_acceptance.zig
+++ /dev/null
@@ -1,58 +0,0 @@
-//! Draft-only completion is an explicit user control, never a model claim.
-//! Permission belongs to this conversation and goal; it is not persisted.
-const std = @import("std");
-const Agent = @import("agent.zig").Agent;
-const goals = @import("goal_state.zig");
-const headers = @import("http_headers.zig");
-
-pub const Scope = struct {
- session: []const u8,
- epoch: u64,
-
- pub fn matches(self: Scope, session: []const u8, epoch: u64) bool {
- return self.epoch == epoch and std.mem.eql(u8, self.session, session);
- }
-};
-
-pub fn allowsDraft(root: *const Agent) bool {
- const scope = root.pr_draft_scope orelse return false;
- return scope.matches(headers.sessionId(root.io), goals.currentEpoch(root.goal));
-}
-
-/// Called only by the user-facing slash / JSON input paths, not tool dispatch.
-pub fn set(root: *Agent, mode: []const u8) !void {
- if (std.mem.eql(u8, mode, "verified")) {
- root.pr_draft_scope = null;
- } else if (std.mem.eql(u8, mode, "draft")) {
- root.pr_draft_scope = .{
- .session = try root.arena.dupe(u8, headers.sessionId(root.io)),
- .epoch = goals.currentEpoch(root.goal),
- };
- } else return error.InvalidPrAcceptance;
- goals.resetCompletionGate(root);
-}
-
-pub fn slash(root: *Agent, line: []const u8, out: *std.Io.Writer) !bool {
- const prefix = "/pr-acceptance";
- if (!std.mem.startsWith(u8, line, prefix) or (line.len > prefix.len and line[prefix.len] != ' ' and line[prefix.len] != '\t')) return false;
- const mode = std.mem.trim(u8, line[prefix.len..], " \t");
- if (mode.len != 0) set(root, mode) catch {
- try out.writeAll("usage: /pr-acceptance [verified|draft]\n");
- try out.flush();
- return true;
- };
- try out.writeAll(if (allowsDraft(root))
- "PR acceptance: draft handoff authorized for this conversation and goal. CI remains unverified. This choice resets on resume, a new conversation, or a new goal.\n"
- else
- "PR acceptance: verified. Draft publication does not fulfill the task; current-head checks must pass.\n");
- try out.flush();
- return true;
-}
-
-test "draft acceptance cannot transfer to another conversation or goal" {
- const scope = Scope{ .session = "first", .epoch = 7 };
- try std.testing.expect(scope.matches("first", 7));
- try std.testing.expect(!scope.matches("second", 7));
- try std.testing.expect(!scope.matches("first", 8));
- try std.testing.expect(!scope.matches("first", 0));
-}
diff --git a/src/pr_verify.zig b/src/pr_verify.zig
index 6f980ce7..8ef1abd7 100644
--- a/src/pr_verify.zig
+++ b/src/pr_verify.zig
@@ -43,9 +43,11 @@ pub fn arm(agent: *Agent, target: evidence.Target, match_local: bool) !void {
agent.pr_verification = .pending;
}
-pub fn decision(receipt: evidence.Receipt, local: ?[]const u8, draft_authorized: bool) State {
+/// A draft PR is an honest handoff: completion proceeds, and the result is
+/// labeled unverified (agent_tools). A ready PR still needs passing checks.
+pub fn decision(receipt: evidence.Receipt, local: ?[]const u8) State {
if (local) |sha| if (!std.mem.eql(u8, sha, receipt.head)) return .pending;
- if (receipt.draft) return if (draft_authorized) .draft else .pending;
+ if (receipt.draft) return .draft;
return if (receipt.status == .passed) .passed else .pending;
}
@@ -83,7 +85,7 @@ fn deferred(a: A, receipt: evidence.Receipt, local: ?[]const u8) ![]const u8 {
// flooding the model context when repositories have hundreds of checks.
var limit = @min(receipt.checks_json.len, 16 * 1024);
while (limit < receipt.checks_json.len and limit > 0 and receipt.checks_json[limit] & 0xc0 == 0x80) limit -= 1;
- return std.fmt.allocPrint(a, "completion deferred: current-head PR verification is {s}. Remote head: {s}. Observed checks: {s}{s}. Repeating attempt_completion or completing todos cannot waive verification. Draft publication and base-branch failures do not waive verification. Only the user can authorize a draft-only scope with /pr-acceptance draft.", .{ reason, receipt.head, receipt.checks_json[0..limit], if (limit < receipt.checks_json.len) " [truncated; full checks retained in local receipt]" else "" });
+ return std.fmt.allocPrint(a, "completion deferred: current-head PR verification is {s}. Remote head: {s}. Observed checks: {s}{s}. Repeating attempt_completion or completing todos cannot waive verification. Base-branch failures do not waive verification; to hand off without verified CI, leave the PR as a draft.", .{ reason, receipt.head, receipt.checks_json[0..limit], if (limit < receipt.checks_json.len) " [truncated; full checks retained in local receipt]" else "" });
}
pub fn completionGate(agent: *Agent) ?[]const u8 {
@@ -100,10 +102,10 @@ pub fn completionGate(agent: *Agent) ?[]const u8 {
for (records) |record| {
if (!std.mem.eql(u8, record.session, @import("http_headers.zig").sessionId(agent.io))) continue;
observe(agent, record, null, null) catch return "completion deferred: unable to retire previous PR observation";
- const receipt = evidence.pr(agent.gpa, agent.io, agent.arena, record.target) catch return "completion deferred: current-head PR checks could not be observed. Local tests and completed todos are not remote CI evidence; retry the lookup. Draft-only completion requires explicit user authorization.";
+ const receipt = evidence.pr(agent.gpa, agent.io, agent.arena, record.target) catch return "completion deferred: current-head PR checks could not be observed. Local tests and completed todos are not remote CI evidence; retry the lookup.";
const local = if (record.match_local) evidence.localHead(agent.gpa, agent.io, agent.arena, record.target) catch return "completion deferred: local publication head could not be resolved" else null;
observe(agent, record, receipt, local) catch return "completion deferred: unable to retain current PR observation";
- switch (decision(receipt, local, @import("pr_acceptance.zig").allowsDraft(agent))) {
+ switch (decision(receipt, local)) {
.pending, .unused => return deferred(agent.arena, receipt, local) catch "completion deferred: unable to describe PR verification evidence",
.draft => result = .draft,
.passed => {},
@@ -115,10 +117,13 @@ pub fn completionGate(agent: *Agent) ?[]const u8 {
test "#853 a changed head or a second completion attempt cannot reuse a passing receipt" {
const receipt = evidence.Receipt{ .head = "new", .status = .passed };
- try std.testing.expectEqual(State.pending, decision(receipt, "old", false));
- try std.testing.expectEqual(State.passed, decision(receipt, "new", false));
- for (0..2) |_| try std.testing.expectEqual(State.pending, decision(.{ .head = "new", .status = .pending }, "new", false));
- try std.testing.expectEqual(State.draft, decision(.{ .head = "new", .status = .failed, .draft = true }, "new", true));
+ try std.testing.expectEqual(State.pending, decision(receipt, "old"));
+ try std.testing.expectEqual(State.passed, decision(receipt, "new"));
+ for (0..2) |_| try std.testing.expectEqual(State.pending, decision(.{ .head = "new", .status = .pending }, "new"));
+ // A draft completes as an unverified handoff without a user command; a
+ // stale local head still defers it.
+ try std.testing.expectEqual(State.draft, decision(.{ .head = "new", .status = .failed, .draft = true }, "new"));
+ try std.testing.expectEqual(State.pending, decision(.{ .head = "new", .status = .failed, .draft = true }, "old"));
}
pub fn hasObligation(agent: *const Agent) bool {
@@ -148,12 +153,11 @@ test "PR obligations isolate conversations and cannot use restored IDs as paths"
try std.testing.expectEqualStrings(std.fs.path.dirname(first).?, std.fs.path.dirname(hostile).?);
}
-test "draft PRs require user-authorized scope even with passing or base-failing checks" {
+test "a draft PR is a draft handoff whatever its checks; a ready PR still needs a pass" {
for ([_]@import("pr_publish.zig").HeadStatus{ .passed, .failed, .pending, .none, .unknown }) |status| {
const receipt = evidence.Receipt{ .head = "new", .status = status, .draft = true };
- try std.testing.expectEqual(State.pending, decision(receipt, "new", false));
- try std.testing.expectEqual(State.draft, decision(receipt, "new", true));
- try std.testing.expectEqual(State.pending, decision(receipt, "old", true));
+ try std.testing.expectEqual(State.draft, decision(receipt, "new"));
+ try std.testing.expectEqual(State.pending, decision(receipt, "old"));
}
- try std.testing.expectEqual(State.pending, decision(.{ .head = "new", .status = .failed }, "new", true));
+ try std.testing.expectEqual(State.pending, decision(.{ .head = "new", .status = .failed }, "new"));
}
diff --git a/src/schema_protocol.zig b/src/schema_protocol.zig
index 37ff4f98..eb822f7a 100644
--- a/src/schema_protocol.zig
+++ b/src/schema_protocol.zig
@@ -37,7 +37,7 @@ pub const flags =
pub const json =
\\{
\\ "transport": "newline-delimited JSON over stdin/stdout (--json)",
- \\ "request": "one JSON object per line: {\"type\":\"user\",\"text\":\"...\",\"images\":[{\"type\":\"image_url\",\"url\":\"https://...\"},{\"type\":\"image_base64\",\"media_type\":\"image/png\",\"data\":\"...\"}]} sends a native multimodal user turn (images optional, max 16). Optional prAcceptance is verified (default) or draft: an explicit user choice for the current conversation and goal, reset by resume/new conversation/new goal; draft permits an unverified handoff, never passing CI. Only user input may set this field; {\"type\":\"review\",\"text\":\"target or instructions\"} runs one isolated read-only review turn with fresh model-visible history and no edits, delegation, workflows, or web access; {\"type\":\"answer\",\"text\":\"...\",\"cancelled\":false,\"call_id\":\"optional\"} answers an active ask_user event; {\"type\":\"cancel\"} interrupts an active turn; {\"type\":\"set_system_prompt\",\"text\":\"...\",\"append\":false} replaces (or with append=true extends) the system prompt between turns and acks with a system_prompt event; {\"type\":\"set_model\",\"model\":\"gpt-5.5\",\"provider\":\"codex\"}, {\"type\":\"compact\"}, {\"type\":\"set_mode\",\"mode\":\"plan|normal\"}, and {\"type\":\"set_agent\",\"id\":\"reviewer\"}, {\"type\":\"set_effort\",\"level\":\"low|medium|high|xhigh|max|ultra\"}, {\"type\":\"set_fast\",\"on\":true}, and {\"type\":\"set_ultracode\",\"on\":true} are live control requests acked by model/compact/mode/agent/effort/fast/ultracode events. For compatibility, set_model also accepts legacy {\"name\":\"provider model|model\"}. NOTE: the system prompt heads the KV-cached prefix, so any mutation invalidates the cache for the whole conversation (per Manus context-engineering lessons) — set it at spawn when possible and mutate only at task boundaries",
+ \\ "request": "one JSON object per line: {\"type\":\"user\",\"text\":\"...\",\"images\":[{\"type\":\"image_url\",\"url\":\"https://...\"},{\"type\":\"image_base64\",\"media_type\":\"image/png\",\"data\":\"...\"}]} sends a native multimodal user turn (images optional, max 16). Only user input may set this field; {\"type\":\"review\",\"text\":\"target or instructions\"} runs one isolated read-only review turn with fresh model-visible history and no edits, delegation, workflows, or web access; {\"type\":\"answer\",\"text\":\"...\",\"cancelled\":false,\"call_id\":\"optional\"} answers an active ask_user event; {\"type\":\"cancel\"} interrupts an active turn; {\"type\":\"set_system_prompt\",\"text\":\"...\",\"append\":false} replaces (or with append=true extends) the system prompt between turns and acks with a system_prompt event; {\"type\":\"set_model\",\"model\":\"gpt-5.5\",\"provider\":\"codex\"}, {\"type\":\"compact\"}, {\"type\":\"set_mode\",\"mode\":\"plan|normal\"}, and {\"type\":\"set_agent\",\"id\":\"reviewer\"}, {\"type\":\"set_effort\",\"level\":\"low|medium|high|xhigh|max|ultra\"}, {\"type\":\"set_fast\",\"on\":true}, and {\"type\":\"set_ultracode\",\"on\":true} are live control requests acked by model/compact/mode/agent/effort/fast/ultracode events. For compatibility, set_model also accepts legacy {\"name\":\"provider model|model\"}. NOTE: the system prompt heads the KV-cached prefix, so any mutation invalidates the cache for the whole conversation (per Manus context-engineering lessons) — set it at spawn when possible and mutate only at task boundaries",
\\ "score_request": "{\"type\":\"score\",\"prompt_sha\":\"<16 hex>\",\"score\":0.7,\"notes\":\"...\",\"parent_sha\":\"<16 hex, optional>\"} appends an evaluation record for an agent/prompt variant to this run's file under .graff/trajectories (the aggregate append-only DGM-style archive; prompt_sha = first 8 bytes of SHA-256 of the system prompt, hex; parent_sha records which prompt this variant was mutated from — the lineage edge DGM parent selection counts children with) and acks with a score event",
\\ "sequencing": "every event object below carries a monotonic per-session \"seq\" as its FIRST field: 1-based, gap-free, one id per emitted line. It survives a resume - the counter is persisted with the conversation as event_seq and restored by --resume, so a REPLACEMENT process continues the numbering instead of reissuing ids a consumer already saw. `graff serve` forwards the child's seq unchanged and uses it for ?from=N replay",
\\ "events": [
diff --git a/src/session.zig b/src/session.zig
index 89646eb2..8dfd04ef 100644
--- a/src/session.zig
+++ b/src/session.zig
@@ -498,7 +498,6 @@ pub fn loadSession(root: *Agent, keys: *Keys, arena: Allocator, name: []const u8
try root.publication_checks.restore(arena, obj);
try root.ensureRootTools(root.provider.kind);
const compaction_window = try @import("compaction_window.zig").State.restore(arena, obj, msgs.items);
- root.pr_draft_scope = null; // draft-only scope must be authorized again after resume
root.messages = msgs;
root.compaction_window = compaction_window;
@import("history_wire.zig").prepare(arena, root.provider.kind, &root.messages);