Skip to content

Lightpanda: the headless browser designed for AI and automation

codex: use std.json.fmt for poll body

Adrià Arrufat0035d31fc99a
diff --git a/src/agent/auth/codex.zig b/src/agent/auth/codex.zig
index d2eb67a58..b25882341 100644
--- a/src/agent/auth/codex.zig
+++ b/src/agent/auth/codex.zig
@@ -148,7 +148,10 @@ fn deviceLogin(allocator: std.mem.Allocator, interrupt: ?*zenai.http.Interrupt)
.{ verify_url, dc.user_code },
);
- const poll_body = try std.fmt.allocPrint(a, "{{\"device_auth_id\":\"{s}\",\"user_code\":\"{s}\"}}", .{ dc.device_auth_id, dc.user_code });
+ const poll_body = try std.fmt.allocPrint(a, "{f}", .{std.json.fmt(
+ .{ .device_auth_id = dc.device_auth_id, .user_code = dc.user_code },
+ .{},
+ )});
const dt: DeviceToken = while (true) {
// The REPL's Ctrl-C only fires the interrupt (it never kills the
// process), so the wait must poll it.