Skip to content

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

Python

Merge #274 selective Kimi/xAI OAuth refresh at startup

justrachc4e70204cbc2
diff --cc src/startup.zig
index bce22cf5,ea14cb91..f745c6d3
--- a/src/startup.zig
+++ b/src/startup.zig
@@@ -189,16 -217,20 +189,20 @@@ pub fn resolveKeys(io: Io, gpa: Allocat
// Kimi "login": OAuth device-flow token from `graff login kimi`
// (~/.kimi/credentials/graff-oauth.json), refreshed in place when near
// expiry. Same on-disk-credential pattern as codex/codegraff; env wins.
+ // #274: refreshing is a synchronous network round-trip, so an explicit
+ // provider/exact-model selection that cannot route to kimi/xai must skip
+ // it entirely rather than pay for it on every startup — same selective-
+ // scope discipline as the stored-key load a few lines below.
if (keys_cli.homeEnv(environ_map)) |home| {
for (provider_mod.provider_specs, &keys.values, &keys.sources) |spec, *value, *source| {
- if (std.mem.eql(u8, spec.id, "kimi") and value.* == null) {
+ if (std.mem.eql(u8, spec.id, "kimi") and value.* == null and storedKeyMayAffectSelection(spec.id, model_flag)) {
- if (oauth.loadKimiOAuth(io, gpa, arena, home, false)) |key| {
+ if (oauth.loadKimiOAuth(io, gpa, arena, home, false, null)) |key| {
value.* = key;
source.* = .login;
}
}
- if (std.mem.eql(u8, spec.id, "xai") and value.* == null) {
+ if (std.mem.eql(u8, spec.id, "xai") and value.* == null and storedKeyMayAffectSelection(spec.id, model_flag)) {
- if (oauth.loadXaiOAuth(io, gpa, arena, home, false)) |key| {
+ if (oauth.loadXaiOAuth(io, gpa, arena, home, false, null)) |key| {
value.* = key;
source.* = .login;
}