Skip to content

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

Python

fix: alias-safe prompt-cache restore and the Xiaomi catalog row

Cursor Agentffd8e01c9d6a
diff --git a/lean-proofs/Graff/Provider.lean b/lean-proofs/Graff/Provider.lean
index 85939dff..642c6b48 100644
--- a/lean-proofs/Graff/Provider.lean
+++ b/lean-proofs/Graff/Provider.lean
@@ -51,7 +51,7 @@ def specs : List Row :=
, { id := "openai", kind := .responses, auth := .bearer }
, { id := "google", kind := .interactions, auth := .googApiKey, catalog := .openai, takesEffort := true }
, { id := "minimax", kind := .anthropic, auth := .bearer }
- , { id := "xiaomi", kind := .openai, auth := .bearer }
+ , { id := "xiaomi", kind := .openai, auth := .bearer, catalog := .openai }
, { id := "kilo", kind := .openai, auth := .bearer }
, { id := "groq", kind := .openai, auth := .bearer }
, { id := "cerebras", kind := .openai, auth := .bearer, catalog := .openai, takesEffort := true }
diff --git a/spec/kernels/providers.json b/spec/kernels/providers.json
index 32efb0c0..3260b9a4 100644
--- a/spec/kernels/providers.json
+++ b/spec/kernels/providers.json
@@ -61,7 +61,7 @@
"kind": "openai",
"auth": "bearer",
"login": "api_key",
- "catalog": "baked",
+ "catalog": "openai",
"sub_login": false,
"takes_effort": false
},
diff --git a/spec/ref/provider.py b/spec/ref/provider.py
index a73753a0..363d43dc 100644
--- a/spec/ref/provider.py
+++ b/spec/ref/provider.py
@@ -37,7 +37,7 @@ SPECS: list[dict] = [
row("openai", "responses", "bearer"),
row("google", "interactions", "goog_api_key", catalog="openai", takes_effort=True),
row("minimax", "anthropic", "bearer"),
- row("xiaomi", "openai", "bearer"),
+ row("xiaomi", "openai", "bearer", catalog="openai"),
row("kilo", "openai", "bearer"),
row("groq", "openai", "bearer"),
row("cerebras", "openai", "bearer", catalog="openai", takes_effort=True),
diff --git a/src/http_headers.zig b/src/http_headers.zig
index 0e0d600e..3daa08ce 100644
--- a/src/http_headers.zig
+++ b/src/http_headers.zig
@@ -164,7 +164,10 @@ pub fn restoreProjectRootId(id: []const u8) void {
if (id.len != 36) return;
while (project_id_lock.cmpxchgWeak(false, true, .acquire, .monotonic) != null) std.atomic.spinLoopHint();
defer project_id_lock.store(false, .release);
- @memcpy(project_id_buf[0..36], id[0..36]);
+ // `id` may be a slice of `project_id_buf` (resume of the live key).
+ var tmp: [36]u8 = undefined;
+ @memcpy(&tmp, id[0..36]);
+ @memcpy(&project_id_buf, &tmp);
project_id_len = 36;
}