Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silence-startup-refresh-warnings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

Silence noisy warnings from background provider refreshes during startup.
7 changes: 4 additions & 3 deletions apps/kimi-code/src/tui/kimi-tui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,10 @@ export class KimiTUI {
if (c.added <= 0) continue;
this.showStatus(`${c.providerName} · +${String(c.added)} model${c.added > 1 ? 's' : ''}.`);
}
for (const f of result.failed) {
this.showStatus(`Skipped refreshing ${f.provider}: ${f.reason}`, 'warning');
}
// Per-provider failures are best-effort during the startup background
// refresh (offline, transient network errors, expired OAuth), so don't
// surface them as warnings here. The manual refresh in the model picker
// still reports failures when the user asks for it.
} catch {
// Best-effort: startup must not crash on background refresh failures.
}
Expand Down
4 changes: 2 additions & 2 deletions apps/kimi-code/test/tui/kimi-tui-startup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ describe('KimiTUI startup', () => {
expect(write).toHaveBeenCalledWith(DISABLE_TERMINAL_THEME_REPORTING);
});

it("only shows provider refresh status for added models", async () => {
it("only shows provider refresh status for added models and ignores failures", async () => {
const harness = makeHarness();
const driver = makeDriver(harness, makeStartupInput());
const showStatus = vi.spyOn(driver as any, "showStatus").mockImplementation(() => {});
Expand All @@ -1105,7 +1105,7 @@ describe('KimiTUI startup', () => {
{ providerId: "metadata-only", providerName: "Metadata Only", added: 0, removed: 0 },
],
unchanged: [],
failed: [],
failed: [{ provider: "managed:kimi-code", reason: "fetch failed" }],
});

await (driver as any).refreshProviderModelsInBackground();
Expand Down
3 changes: 0 additions & 3 deletions packages/oauth/src/custom-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ export async function fetchCustomRegistry(
// fetch, mirroring `toModelEntry`'s skip-on-invalid behavior. This keeps
// existing providers working when kokub adds a new provider type that
// this client doesn't yet recognize.
console.warn(
`[custom-registry] Skipping invalid entry "${key}" at ${source.url}: missing required fields or unsupported type (id, name, api, type, models).`,
);
continue;
}
out[key] = entry;
Expand Down
30 changes: 9 additions & 21 deletions packages/oauth/test/custom-registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,15 @@ describe('fetchCustomRegistry', () => {
'registry_chat-completions': goodEntry,
}),
);
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});

try {
const result = await fetchCustomRegistry(
KOKUB_SOURCE,
fetchMock as unknown as typeof fetch,
);

expect(Object.keys(result)).toEqual(['registry_chat-completions']);
expect(result['broken-entry']).toBeUndefined();
expect(result['unknown-type']).toBeUndefined();
expect(result['registry_chat-completions']?.type).toBe('openai');

expect(warnSpy).toHaveBeenCalledTimes(2);
const warnings = warnSpy.mock.calls.map((args) => String(args[0]));
expect(warnings.some((m) => m.includes('broken-entry'))).toBe(true);
expect(warnings.some((m) => m.includes('unknown-type'))).toBe(true);
expect(warnings.every((m) => m.includes(KOKUB_SOURCE.url))).toBe(true);
} finally {
warnSpy.mockRestore();
}
const result = await fetchCustomRegistry(
KOKUB_SOURCE,
fetchMock as unknown as typeof fetch,
);

expect(Object.keys(result)).toEqual(['registry_chat-completions']);
expect(result['broken-entry']).toBeUndefined();
expect(result['unknown-type']).toBeUndefined();
expect(result['registry_chat-completions']?.type).toBe('openai');
});
});

Expand Down
Loading