graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
acp: a loaded or forked chat is a peer under its own session id (#1803)
justrach2401b3c74eb0
diff --git a/scripts/test-acp-session-load.py b/scripts/test-acp-session-load.pyindex ca959925..1dc6d89b 100644--- a/scripts/test-acp-session-load.py+++ b/scripts/test-acp-session-load.py@@ -264,6 +264,15 @@ def plan_login_restore(binary):print("ACP session/load restores a plan-login save after a cross-provider --model respawn: ok")+def peer_session(binary, cwd, home, pid):+ """The session id `graff peer list` shows for the graff process `pid`."""+ env = {k: v for k, v in os.environ.items() if not k.startswith(("GRAFF_", "HARNESS_"))}+ env.update(HOME=str(home), GRAFF_NO_TELEMETRY="1", NO_COLOR="1")+ out = subprocess.run([str(binary), "peer", "list", "--json"], cwd=cwd, env=env, capture_output=True, text=True, timeout=30)+ rows = json.loads(out.stdout or "[]")+ return next((r.get("session_id") for r in rows if r.get("pid") == pid), None)++def run(binary):claude_import(binary)plan_login_restore(binary)@@ -335,6 +344,8 @@ def run(binary):assert wrong["error"]["code"] == -32602before = len(b.events)loaded = b.request("session/load", {"sessionId": sid, "cwd": str(cwd), "mcpServers": []})+ # Peers (and Harness's send_message) address a chat by its ACP session id.+ assert peer_session(binary, cwd, home, b.proc.pid) == sidselected = b.request("graff/models")["result"]["current"]assert selected["provider"] == "vercel", selectedassert selected["model"] == "alibaba/qwen3.8-27b", selecteddiff --git a/src/acp_session_fork.zig b/src/acp_session_fork.zigindex f63373f6..f1228fe2 100644--- a/src/acp_session_fork.zig+++ b/src/acp_session_fork.zig@@ -67,6 +67,8 @@ pub fn handle(live: *LiveTurn, arena: Allocator, w: *Io.Writer, req: proto.Requelive.session_id = root.session_name;d.session_id = live.session_id;d.durable_session_id = live.session_id;+ // Peers address this chat by its session id: re-register under the loaded one.+ @import("presence.zig").noteLabelsFrom(root.io, root.gpa, arena, root.session_title, root.session_name);if (load.replayFromStart(params)) try load.replayHistory(arena, root, w, live.session_id);const options = engine.configOptions(d, arena) catch |err| {try proto.writeError(w, req.id, engine.err_internal, @errorName(err));diff --git a/src/acp_session_load.zig b/src/acp_session_load.zigindex 36e17f42..5e84fc66 100644--- a/src/acp_session_load.zig+++ b/src/acp_session_load.zig@@ -87,6 +87,8 @@ pub fn load(ctx: *anyopaque, arena: Allocator, w: *Io.Writer, req: proto.Requestlive.session_id = live.root.session_name;d.session_id = live.session_id;d.durable_session_id = live.session_id;+ // Peers address this chat by its session id: re-register under the loaded one.+ @import("presence.zig").noteLabelsFrom(live.root.io, live.root.gpa, arena, live.root.session_title, live.root.session_name);// v2 session/resume replays only when asked (`replayFrom: {type: start}`).if (!v2.on() or replayFromStart(params)) try replayHistory(arena, live.root, w, live.session_id);const options = engine.configOptions(d, arena) catch |err| return proto.writeError(w, req.id, engine.err_internal, @errorName(err));