Skip to content

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

Python

fix: keep the old login key on session-arena OOM instead of aliasing scratch

Rach Pradhan5da414a7b142
diff --git a/src/agent_request.zig b/src/agent_request.zig
index 7372639b..5dfee99e 100644
--- a/src/agent_request.zig
+++ b/src/agent_request.zig
@@ -298,7 +298,7 @@ pub fn request(self: *Agent, tools: ?[]const u8) !std.json.ObjectMap {
auth_refreshed = true;
// #124: dupe off the scratch refresh internals — the key must
// survive every later request of the session.
- self.provider.api_key = self.arena.dupe(u8, fresh) catch fresh;
+ self.provider.api_key = self.arena.dupe(u8, fresh) catch self.provider.api_key;
if (self.tracer) |tr| tr.note("oauth_refresh", "auth error — refreshed login token, retrying");
continue;
}