Skip to content

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

Python

Merge remote-tracking branch 'origin/main' into batch/harness-learnings

justrach2dfd3112d08e
diff --cc CHANGELOG.md
index 81bbb8c0,bad39f64..aba2e546
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -10,32 -10,24 +10,50 @@@ The release workflow uses a tag's secti
hand-written `docs/releases/<tag>.md` wins if present), so keeping this file
current is part of cutting a release.
- ## v0.0.302.6
++## Unreleased
+
+### Safety
+
+- Shell commands called by the tool's current name (`shell`) now go through the approval prompt, the subagent destructive-git block and the publish gate. Only the legacy `bash` name was gated before; plan mode was already enforced separately. (#1292)
+- Commands the agent runs no longer inherit provider API keys from graff's environment, so `env` in a tool call can't copy them into transcripts. `GRAFF_TOOL_ENV_PASS` keeps named variables when a tool genuinely needs one. (#1267)
+- Tool shells get non-interactive editor, pager and prompt defaults, so `git commit` without `-m`, `rebase -i` or a pager can't hang a call until its deadline. (#1268)
+- The destructive-git check tokenizes commands instead of matching substrings, catching spellings such as `git clean -df`, `git restore -- .`, `git checkout -f`, `git -C dir reset --hard` and forced push refspecs. (#1269)
+- A shell command containing a NUL byte is refused instead of silently running only the part before it. (#1270)
+- `.graff/` gets its own `.gitignore` when graff creates it, so sessions and traces never show up in `git status` or a model-run `git add -A`; project config such as `workspace.toml` and `tools/` stays committable. (#1273)
+
+### Model and tool reliability
+
+- Tool calls whose arguments a server lost (empty, `{}` or cut off) are rebuilt from the call markup in the same reply and the markup is removed from the message. The affected model family gets plain parameter types instead of nullable unions, and a turn whose last three tool batches all failed on unusable arguments ends instead of looping. (#1276)
+- Over-cap tool output keeps its head and tail around a truncation marker, so test summaries and final errors survive. (#1271)
+- Images read with `read_file` are downscaled to the provider-safe size, or refused with a reason, instead of failing the next request. (#1272)
+- When a reasoning model spends its whole reply reasoning without answering, the retry asks for brief thinking and a direct answer instead of repeating the identical request. (#1293)
+- Retry backoff adds bounded jitter so parallel workers don't retry in lockstep; a server's Retry-After is never shortened. (#1274)
+
+### ACP
+
+- File tools report `locations`, edits carry ACP `diff` content that the completion keeps, the shell tool is kind `execute`, and each call sends one terminal update instead of two. (#1287, #1288)
+- Permission requests include the tool's kind, input, locations and diff, so clients show what is being approved. (#1289)
+- A mistyped slash command is answered locally with a suggestion ("did you mean /resume?") in the terminal, the TUI and over ACP, instead of going to the model. (#1275)
+- An image block's `uri` no longer becomes a bare line in the prompt text.
+
+ ## v0.0.302.6
+
+ ### ACP
+
+ - `ask_user` no longer freezes clients that cannot show a question. A client that advertises `clientCapabilities.elicitation.form` gets a standard `elicitation/create` form request; the desktop app opts in to Graff's own question update; any other client gets an immediate result so the model continues instead of waiting for an answer that cannot arrive.
+ - A running subagent streams its work onto the parent's tool call as ordinary `tool_call_update` content: a bounded log of its tool calls, failures and the tail of its message. Any ACP client shows it without changes. `GRAFF_ACP_SUBAGENT_PROGRESS=0` turns it off.
+ - ACP v2 draft preview: with `GRAFF_ACP_V2=1` and a client that asks for protocol version 2, prompts are acknowledged with a `messageId` on insertion and the outcome arrives as `state_update`, chunks carry message IDs, tool rows are created by `tool_call_update`, and `session/close` and `session/resume` are available. Every other connection keeps v1 unchanged.
+ - An empty JSON-RPC result (for example `session/cancel` with an id) is now `{}` rather than `[]`.
+
+ ### Agents on one device
+
+ - `graff peer list|send|inbox|read` lets any agent on the machine, not only graff sessions, list live agents, post to a worktree room, or send a direct message.
+
+ ### Logins
+
+ - `graff keys` syncs provider logins between your devices through an end-to-end encrypted vault: `status`, `enable`, `devices`, `approve`, `remove`, `push`, `pull`, `put` and `get`. Rotating logins refresh under a vault lease so two devices cannot race a refresh.
+ - Kimi requests identify graff as the platform, and Kimi console keys are billed as plan usage.
+
## v0.0.302.5
### Session and transport fixes
diff --cc src/acp_stream.zig
index 33f45e6d,95529a3b..81f4ee30
--- a/src/acp_stream.zig
+++ b/src/acp_stream.zig
@@@ -8,7 -8,8 +8,9 @@@ const Allocator = std.mem.Allocator
const Value = std.json.Value;
const util = @import("util.zig");
const proto = @import("acp_protocol.zig");
+const view = @import("acp_tool_view.zig");
+ const v2 = @import("acp_v2.zig");
+ const acp_elicit = @import("acp_elicit.zig");
pub fn kindFor(name: []const u8) []const u8 {
if (std.mem.eql(u8, name, "read_file") or std.mem.eql(u8, name, "codedb") or std.mem.eql(u8, name, "skill"))
@@@ -65,21 -68,17 +68,24 @@@ pub fn writeMessage(w: *Io.Writer, sess
}
pub fn writeToolCall(w: *Io.Writer, session_id: []const u8, id: []const u8, name: []const u8, input: Value) !void {
+ var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator);
+ defer arena_state.deinit();
+ const a = arena_state.allocator();
+ const kind = kindFor(name);
+ const cwd = @import("main.zig").g_cwd_display;
+ // v2 removed `tool_call`: the first `tool_call_update` for an ID creates it,
+ // and text after a tool row is a new message.
+ v2.breakMessage();
try proto.writeNotification(w, "session/update", .{
.sessionId = session_id,
.update = .{
- .sessionUpdate = "tool_call",
+ .sessionUpdate = if (v2.on()) "tool_call_update" else "tool_call",
.toolCallId = id,
.title = titleFor(name, input),
- .kind = kindFor(name),
+ .kind = kind,
.status = "in_progress",
+ .locations = try view.locations(a, kind, input, cwd),
+ .content = try view.diffs(a, name, input, cwd),
.rawInput = input,
._meta = .{ .@"graff/toolName" = name },
},