Skip to content

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

Python

codegraff: send graff/<version> as the User-Agent on HTTP/2 streams too

justrach0c473de54882
diff --git a/src/agent_stream_h2.zig b/src/agent_stream_h2.zig
index 1ee1baab..903d241b 100644
--- a/src/agent_stream_h2.zig
+++ b/src/agent_stream_h2.zig
@@ -54,9 +54,14 @@ pub fn postStream(self: *Agent, body: []const u8, poll_stdin: bool) !?[]u8 {
var n: usize = 0;
extras[n] = .{ .name = "content-type", .value = "application/json" };
n += 1;
- if (std.mem.eql(u8, provider.id, "kimi")) {
- extras[n] = .{ .name = "user-agent", .value = main_mod.kimi_user_agent };
- n += 1;
+ // The same User-Agent choice as the HTTP/1.1 path (kimi's identity, the
+ // gateway's graff/<version>); the rest keep http_zig's default.
+ switch (http_headers.userAgent(provider)) {
+ .override => |ua| {
+ extras[n] = .{ .name = "user-agent", .value = ua };
+ n += 1;
+ },
+ else => {},
}
for (extra, 0..) |h, i| {
if (i >= name_store.len or n >= extras.len) break;