Skip to content

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

Python

fix(trace): record transport-flake retries in the session trace

Rach Pradhan58521d0f7723
diff --git a/src/agent_request.zig b/src/agent_request.zig
index d4d45091..03f13038 100644
--- a/src/agent_request.zig
+++ b/src/agent_request.zig
@@ -172,6 +172,10 @@ pub fn request(self: *Agent, tools: ?[]const u8) !std.json.ObjectMap {
// (#86). 250ms·2ⁿ, capped at 4s over 6 tries; Esc cancels.
const delay_ms = RetryPlan.delayMs(throttled, attempt);
try self.say("[network error: {t} — retrying in {d}ms ({d}/{d})]\n", .{ err, delay_ms, attempt + 1, max_attempts });
+ // Same trace breadcrumb the 429/5xx branch leaves: a
+ // transport-flake retry is otherwise invisible in the
+ // session trace, hiding how flaky a provider really is.
+ if (self.tracer) |tr| tr.note("retry", @errorName(err));
self.sleepInterruptible(delay_ms) catch return error.Interrupted;
}
continue;