graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
fix: mint the tab title with the session model, off the thinking row
Cursor Agent97fcb504cd51
diff --git a/docs/releases/v0.0.279-continuation.md b/docs/releases/v0.0.279-continuation.mdindex b6bc04c7..036c33a9 100644--- a/docs/releases/v0.0.279-continuation.md+++ b/docs/releases/v0.0.279-continuation.md@@ -10,4 +10,3 @@ This branch is **not** a retag and is **not** merged back.| #613 ACP Registry | **Docs only.** Submit recipe in [acp-registry.md](../acp-registry.md). Listing + auth check live in `agentclientprotocol/registry`. #612 streaming already shipped. Blocker: `initialize` has no `authMethods`. No registry client here. || yxlyx doctor / cube / governed / localhost | **Inventory.** [yxlyx-leftovers.md](../yxlyx-leftovers.md). `/doctor` goal/todo slice and `--max-model-calls` already exist. Lease/job/listener doctor, idle localhost supervisor, cube NDJSON ingress, protected verifiers, review-cycle caps: parked. No new product mode. || WASM / libgraff / in-process embed | **Started (ADR 0038).** `graff-core.wasm` + `libgraff` + `@codegraff/sdk/embed` `createGraffAgent()`. ACP handshake in-process; first-slice turn is `echo:`. Live tools stay `graff acp`. |-| Tab title on grok-4.6 | **Fixed.** AI title uses the session model on chat when the catalog has it (xAI / Codegraff). Failures stay off the `thinking…` row. Responses-kind errors name the provider, not "codex". |diff --git a/src/agent_output.zig b/src/agent_output.zigindex 7c4c757c..51cd80c5 100644--- a/src/agent_output.zig+++ b/src/agent_output.zig@@ -15,6 +15,9 @@ const protocol_seq = @import("protocol_seq.zig"); // #330: monotonic `seq` on evconst tick_gate = @import("tick_gate.zig"); // #tui-tick: child ticks wait for a foreground line boundarypub fn say(self: *Agent, comptime fmt: []const u8, args: anytype) !void {+ // Tab-title jobs are cosmetic and overlap the root thinking spinner.+ // Their `[title] …` worker line must not splice onto `thinking…`.+ if (self.call_kind == .title) return;// stdout is a strict JSONL transport in --json mode. Human-facing// notices are represented by their structured terminal/error events;// never leak an unframed line that breaks SDK parsers.@@ -58,6 +61,7 @@ fn endsLine(comptime fmt: []const u8) bool {/// rule — only the line-ending test moves from the format to the last byte./// Errors are swallowed: an event sink's emit path has nowhere to return them.pub fn sayText(self: *Agent, text: []const u8) void {+ if (self.call_kind == .title) return;if (main_mod.json_mode and !self.sub) return;if (self.out) |w| {w.print("{s}", .{text}) catch return;diff --git a/src/agent_request.zig b/src/agent_request.zigindex 377325dd..7cd03bf2 100644--- a/src/agent_request.zig+++ b/src/agent_request.zig@@ -468,7 +468,7 @@ pub fn request(self: *Agent, tools_in: ?[]const u8) !std.json.ObjectMap {// overload retry path as SSE and JSON error envelopes.if (try retryTransientServerError(self, "", failure.code, msg, &server_retries)) continue :rebuild;if (self.tracer) |tr| tr.api(self.label, self.sub, self.provider.model, ms, body.len, resp_body.len, 0, 0, true);- try self.sayApiError("codex api error: {s}", .{msg});+ try self.sayApiError("{s} api error: {s}", .{ self.provider.id, msg });return error.ApiError;},}diff --git a/src/agent_ws_test.zig b/src/agent_ws_test.zigindex fbc00b64..52dfb8c6 100644--- a/src/agent_ws_test.zig+++ b/src/agent_ws_test.zig@@ -79,7 +79,7 @@ test "codexWsIdleExpired: fires only strictly past the idle limit (codex-ws)" {test "the codex .responses arm refreshes auth and re-anchors before resending (#402)" {const src = @embedFile("agent_request.zig");const arm_start = std.mem.indexOf(u8, src, "unparseable codex response").?;- const arm_end = std.mem.indexOf(u8, src, "codex api error: {s}").?;+ const arm_end = std.mem.indexOf(u8, src, "{s} api error: {s}").?;const arm = src[arm_start..arm_end];const call = std.mem.indexOf(u8, arm, "retryAfterAuthRefresh(self, msg, &auth_refreshed)") orelsediff --git a/src/title.zig b/src/title.zigindex 2bc6b0e3..46569949 100644--- a/src/title.zig+++ b/src/title.zig@@ -323,6 +323,52 @@ test "cleanTitle: normalizes a model reply into a tab label, else null (/title)"try std.testing.expect(cleanTitle("\"\"") == null);}+/// Same model the turn is on. If the session is riding Responses on top of a+/// chat-completions catalog (xAI, Codegraff), mint the tab title on chat so+/// a Responses-only host (Codex / gateway `/v1/responses`) cannot reject+/// `grok-4.6` with "use /v1/chat/completions".+pub fn titleProvider(base: Provider) Provider {+ if (base.kind != .responses) return base;+ const spec = provider_mod.specFor(base.id) orelse return base;+ if (spec.kind != .openai) return base;+ if (std.mem.indexOf(u8, spec.url, "chat/completions") == null) return base;+ var out = base;+ out.kind = .openai;+ out.url = spec.url;+ return out;+}++test "titleProvider keeps the session model and prefers chat when the catalog has it" {+ const xai: Provider = .{+ .id = "xai",+ .kind = .responses,+ .auth = .bearer,+ .url = provider_mod.xai_responses_url,+ .api_key = "k",+ .model = "grok-4.6",+ .context = 500_000,+ };+ const titled = titleProvider(xai);+ try std.testing.expectEqualStrings("xai", titled.id);+ try std.testing.expectEqualStrings("grok-4.6", titled.model);+ try std.testing.expectEqual(Provider.Kind.openai, titled.kind);+ try std.testing.expect(std.mem.indexOf(u8, titled.url, "chat/completions") != null);++ const codex: Provider = .{+ .id = "codex",+ .kind = .responses,+ .auth = .bearer,+ .url = "https://chatgpt.com/backend-api/codex/responses",+ .api_key = "k",+ .model = "gpt-5.6-sol",+ .context = 272_000,+ };+ const same = titleProvider(codex);+ try std.testing.expectEqual(Provider.Kind.responses, same.kind);+ try std.testing.expectEqualStrings(codex.url, same.url);+ try std.testing.expectEqualStrings("gpt-5.6-sol", same.model);+}+/// Generate a terse tab-label title for the turn's first prompt — runs on its/// own arena + a throwaway one-message sub-Agent, so it can be spawned via/// io.async and overlap the real turn instead of blocking after it. Returns a@@ -336,7 +382,7 @@ pub fn titleTask(gpa: std.mem.Allocator, io: Io, client: *std.http.Client, provi.arena = arena,.io = io,.client = client,- .provider = provider,+ .provider = titleProvider(provider),.messages = std.json.Array.init(arena),.sub = true, // pool thread: never touches stdout or the main agent's state.label = "title",