graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Fix two unit-suite blockers.
justrach784716380f5b
diff --git a/src/agent_stream_h2.zig b/src/agent_stream_h2.zigindex 1ae27495..3b079fb0 100644--- a/src/agent_stream_h2.zig+++ b/src/agent_stream_h2.zig@@ -1,6 +1,7 @@//! HTTPS SSE over http-zig. Returns null to keep the std.http/1.1 path.const std = @import("std");+const builtin = @import("builtin");const Io = std.Io;const Agent = @import("agent.zig").Agent;const main_mod = @import("main.zig");@@ -18,6 +19,10 @@ const ssePayload = Agent.ssePayload;const isStreamEnd = @import("agent_stream.zig").isStreamEnd;pub fn postStream(self: *Agent, body: []const u8) !?[]u8 {+ // Unit tests stay on HTTP/1.1: real H2 sessions would open live sockets+ // (and extra redial connections) against count-limited localhost mocks,+ // hanging the suite. Live coverage comes from the http-zig probes.+ if (builtin.is_test) return null;if (!http2_pool.want(self.provider.url)) return null;const origin = http2_pool.parseOrigin(self.provider.url) catch return null;const gpa = self.gpa;diff --git a/src/http_headers.zig b/src/http_headers.zigindex 0e0d600e..ea81b002 100644--- a/src/http_headers.zig+++ b/src/http_headers.zig@@ -144,7 +144,9 @@ pub fn adoptSessionId(id: []const u8) void {while (session_id_lock.cmpxchgWeak(false, true, .acquire, .monotonic) != null) std.atomic.spinLoopHint();defer session_id_lock.store(false, .release);if (session_id_len != 0) return;- @memcpy(session_id_buf[0..36], id[0..36]);+ // copyForwards, not @memcpy: a caller may hand back a slice of the+ // static buffer itself (round-trip restore), which aliases dest.+ std.mem.copyForwards(u8, session_id_buf[0..36], id[0..36]);session_id_len = 36;}@@ -154,7 +156,7 @@ pub fn restoreSessionId(id: []const u8) void {if (id.len != 36) return;while (session_id_lock.cmpxchgWeak(false, true, .acquire, .monotonic) != null) std.atomic.spinLoopHint();defer session_id_lock.store(false, .release);- @memcpy(session_id_buf[0..36], id[0..36]);+ std.mem.copyForwards(u8, session_id_buf[0..36], id[0..36]);session_id_len = 36;}@@ -164,7 +166,7 @@ pub fn restoreProjectRootId(id: []const u8) void {if (id.len != 36) return;while (project_id_lock.cmpxchgWeak(false, true, .acquire, .monotonic) != null) std.atomic.spinLoopHint();defer project_id_lock.store(false, .release);- @memcpy(project_id_buf[0..36], id[0..36]);+ std.mem.copyForwards(u8, project_id_buf[0..36], id[0..36]);project_id_len = 36;}