graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Prepare v0.302.42 with current main and release fixes
justrach7b61d4f3d00e
diff --cc CHANGELOG.mdindex 7c978fcc,9e295551..8f48107d--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -10,32 -10,6 +10,40 @@@ The release workflow uses a tag's sectihand-written `docs/releases/<tag>.md` wins if present), so keeping this filecurrent is part of cutting a release.++## v0.302.42++++- Keeps reasoning-only output-limit replies out of subsequent requests and saved history while preserving partial answers and valid tool-call reasoning.++- Shows each subagent's resolved worker model in ACP activity, including fallback selections, without breaking older activity records.++- Retains large-session loading, bounded MCP task deadlines, streamed progress, oversized tool results and parked-command outcomes.++- Reports compaction failures without ending the session and bounds repeated runaway replies.++- Integrates current main with the existing release fixes; release builds verify cached artifact restoration before packaging.+++## v0.302.41++- Adds native subscription browser sign-in with shared CLI, REPL and ACP credential recovery; metered-key access remains separate.+- Preserves independent MCP structured results, displays resource links and embedded text, and answers inbound pings during initialization and tool waits.+- Gives loopback inference request-local deadline allowances without extending unrelated remote requests.+- Adds repeatable isolated native-CLI fixture comparisons with explicit routing checks and separately labeled task subsets.+- Retains all changes from v0.302.40 and current main.++## v0.302.40++- Integrates the pending stream recovery, claim inventory, workspace skills, stored conversation, MCP configuration, companion update and typed ACP sign-in recovery changes.+- Preserves partial replies and unread tool results, secret-free configuration listings, and atomic installer replacement.+- Hosted compaction remains explicitly opt-in; existing local-summary and provider-owned compaction defaults are unchanged.+- Includes the unattended-run recovery and one-shot result contracts from the unpublished v0.302.39 draft.++See `docs/releases/v0.302.40.md` for the release summary.++## v0.302.39++### Unattended runs++- Output limits continue with bounded recovery and incremental file writes; incomplete tool calls are never executed.+- Empty replies retry with cancellable, jittered backoff. Account-limit and sign-in failures stop with distinct exit codes instead of wasting retries.+- `-p --output-format stream-json` emits a session handle at startup and a final result with status, usage, cost completeness and checkpoint status. Forced budget landings report partial work, not completion.+- Buffered generation gets request-local silence allowances, and raw MCP startup exceptions are debug-only. Recovery still uses session checkpoints, not exactly-once journal replay.+## v0.302.38### Windowsdiff --cc docs/releases/v0.302.42.mdindex 00000000,00000000..fb739e37new file mode 100644--- /dev/null+++ b/docs/releases/v0.302.42.md@@@ -1,0 -1,0 +1,8 @@@++# v0.302.42++++- Reasoning-only replies that reach the output limit no longer leave empty assistant messages in later requests or saved history. Valid partial answers and tool-call reasoning remain intact.++- ACP subagent activity shows the resolved worker model before child activity starts, including fallback selections. Older activity records remain readable.++- Large saved sessions load correctly, MCP task deadlines match bounded execution, and streamed progress and oversized tool results are preserved.++- Parked commands retain their outcomes across continuation, compaction failures are reported without ending the session, and repeated runaway replies have bounded recovery.++++This release integrates current main with the existing release fixes. Release builds verify cached artifact restoration before packaging.diff --cc scripts/eval/tier1-manifest.jsonindex 77167433,3f17b5d5..00d086a8--- a/scripts/eval/tier1-manifest.json+++ b/scripts/eval/tier1-manifest.json@@@ -14,7 -14,7 +14,7 @@@"src/main.zig","src/repl.zig"],- "test_count_baseline": 3373,- "test_count_baseline": 3254,++ "test_count_baseline": 3389,"test_count_slack": 25,"required_invariants": [{diff --cc src/agent_length_cutoff.zigindex 16e131b3,4573c2d2..c6c8b7d6--- a/src/agent_length_cutoff.zig+++ b/src/agent_length_cutoff.zig@@@ -251,3 -285,51 +285,54 @@@ test "ReplySize: text past the limit stvar raw: ReplySize = .{};try std.testing.expect(!raw.feed(&agent, reason_ev, 0));}++ test "empty length reply cleanup keeps recovery notes and valid prior tool reasoning on both chat routes" {+ var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);+ defer arena_state.deinit();+ const a = arena_state.allocator();+ for ([_][]const u8{ "deepseek", "codegraff" }) |provider| {+ for ([_][]const u8{ "null", "\"\"", "\" \\n\"" }) |content| {+ for ([_]bool{ false, true }) |retries_spent| {+ var agent: Agent = .{+ .gpa = std.testing.allocator,+ .arena = a,+ .io = std.testing.io,+ .client = undefined,+ .provider = .{ .id = provider, .kind = .openai, .auth = .bearer, .url = "", .api_key = "", .model = "deepseek-flash", .context = 100_000 },+ .messages = .init(a),+ .sub = true,+ .label = "test",+ .out = null,+ };+ try agent.messages.append(try messages.textMessage(a, "user", "Write the artifact"));+ const prior = try parse(a, "{\"role\":\"assistant\",\"content\":null,\"reasoning_content\":\"keep tool reasoning\",\"tool_calls\":[{\"id\":\"c\",\"type\":\"function\",\"function\":{\"name\":\"read_file\",\"arguments\":\"{}\"}}]}");+ try agent.messages.append(prior);+ try agent.messages.append(try messages.toolResultMessage(a, .openai, "c", "saved work", false));+ const start = agent.messages.items.len;+ const root = (try parse(a, try std.fmt.allocPrint(a, "{{\"choices\":[{{\"finish_reason\":\"length\",\"message\":{{\"role\":\"assistant\",\"content\":{s},\"reasoning_content\":\"unfinished thought\",\"tool_calls\":[]}}}}]}}", .{content}))).object;- _ = try agent.stepOpenAI(root);++ // Exercise cleanup independently of the stepper's early exclusion.++ try agent.messages.append(root.get("choices").?.array.items[0].object.get("message").?);+ // Exhaustion used to leave an invalid assistant in saved history.+ if (retries_spent) agent.empty_completion_retries = @import("agent_empty_completion.zig").max_consecutive;- try std.testing.expectEqual(!retries_spent, try @import("agent_empty_completion.zig").handle(&agent, "", start));++ if (retries_spent) {++ try std.testing.expectError(error.EmptyCompletion, @import("agent_empty_completion.zig").handle(&agent, "", start));++ } else try std.testing.expect(try @import("agent_empty_completion.zig").handle(&agent, "", start));+ discardEmptyReply(&agent, root, start);+ try std.testing.expectEqual(start + @as(usize, if (retries_spent) 0 else 1), agent.messages.items.len);+ const body = try agent.buildBody(null, false, false, false);+ defer std.testing.allocator.free(body);+ try std.testing.expect(std.mem.indexOf(u8, body, "unfinished thought") == null);+ try std.testing.expect(std.mem.indexOf(u8, body, "keep tool reasoning") != null);+ try std.testing.expect(std.mem.indexOf(u8, body, "\"tool_call_id\":\"c\"") != null);+ if (!retries_spent) try std.testing.expect(std.mem.indexOf(u8, body, "Think briefly") != null);+ // Cleanup is not a blanket reasoning filter or a partial-answer rewind.+ try agent.messages.append(prior);+ discardEmptyReply(&agent, root, agent.messages.items.len - 1);+ try std.testing.expectEqualStrings("keep tool reasoning", agent.messages.items[agent.messages.items.len - 1].object.get("reasoning_content").?.string);+ try agent.messages.append(try messages.textMessage(a, "assistant", "partial document"));+ discardEmptyReply(&agent, root, agent.messages.items.len - 1);+ try std.testing.expectEqualStrings("partial document", agent.messages.items[agent.messages.items.len - 1].object.get("content").?.string);+ }+ }+ }+ }diff --cc src/agent_turn.zigindex 7ad45209,31df5ed1..09666286--- a/src/agent_turn.zig+++ b/src/agent_turn.zig@@@ -16,9 -16,7 +16,9 @@@ pub fn run(self: *Agent, root_turn_prepdefer if (!self.sub) @import("peer_idle.zig").noteTurnEnd();var pending_work = empty_completion.PendingWork.begin(self);var bounced_answer: empty_completion.BounceAnswer = .{};+ var length: @import("agent_length.zig").State = .{};+ self.empty_completion_retries = 0;- self.length_cutoff_used = false; // agent_length_cutoff.zig: once per turn+ self.length_cutoffs = 0; // agent_length_cutoff.zig: rewinds this turnself.completed = null;self.yielded = null;self.read_miss.reset();@@@ -81,7 -79,12 +81,12 @@@if (try @import("agent_length_cutoff.zig").recoverRunaway(self, err, hist_len)) continue;return review_deadline.finish(try @import("agent_model_loop.zig").finishError(self, err));};+ // request() may compact history; capture this reply's actual boundary.+ // Keep reasoning available to recovery, then exclude non-replayable+ // empty length replies on every exit before another call or save.+ const reply_start = self.messages.items.len;+ defer @import("agent_length_cutoff.zig").discardEmptyReply(self, root, reply_start);- const done = try @import("agent_steps.zig").stepForWire(self, root);+ const done = try length.step(self, root);if (done) |final_text| {if (self.yielded != null) return review_deadline.finish(final_text);if (@import("tool_call_repair.zig").endsTurn(self, final_text)) return review_deadline.finish(final_text); // final: no retry/nudgediff --cc src/cli.zigindex 2510a2e8,1c1b0d93..c27d3860--- a/src/cli.zig+++ b/src/cli.zig@@@ -24,22 -24,6 +24,27 @@@ const update_target = @import("update_tpub const changelog_text =\\What's new\\──────────++ \\0.302.42++ \\ • output-limit recovery keeps later requests and saved history valid++ \\ • ACP subagent activity shows the resolved worker model++ \\ • current main plus session, MCP, compaction and parked-command fixes++ \\+ \\0.302.41+ \\ • native subscription sign-in across terminal and ACP clients+ \\ • MCP structured results, resource content and inbound ping handling+ \\ • request-local loopback deadlines and repeatable fixture comparisons+ \\+ \\0.302.40+ \\ • stream recovery preserves partial replies across ACP and resume+ \\ • workspace skills in headless runs; actionable claim inventory+ \\ • MCP off-lists and JSON configuration listing; atomic companion updates+ \\ • stored conversation continuation and typed sign-in recovery+ \\+ \\0.302.39+ \\ • unattended runs recover from output limits and empty replies+ \\ • one-shot stream-json reports a resume handle, outcome and usage+ \\ • exhausted budgets and account limits stop with distinct exit codes+ \\\\0.302.38\\ • Windows: faster start, and the companion is found on PATH\\