From 980f274fc951a92aa220dd180aee93935ae9a0bd Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 13 Jan 2026 03:51:34 +0000 Subject: [PATCH] fix: stabilize docs and tests after system event timestamps --- docs/concepts/model-providers.md | 4 ++-- docs/providers/moonshot.md | 4 ++-- src/auto-reply/reply/session-updates.test.ts | 4 +--- src/discord/monitor.slash.test.ts | 2 +- src/discord/monitor.ts | 4 +++- src/infra/system-events.test.ts | 4 +++- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/concepts/model-providers.md b/docs/concepts/model-providers.md index 51704c762..0cd8cfb4a 100644 --- a/docs/concepts/model-providers.md +++ b/docs/concepts/model-providers.md @@ -118,12 +118,12 @@ Moonshot uses OpenAI-compatible endpoints, so configure it as a custom provider: - Auth: `MOONSHOT_API_KEY` - Example model: `moonshot/kimi-k2-0905-preview` - Kimi K2 model IDs: - + {/* moonshot-kimi-k2-model-refs:start */} - `moonshot/kimi-k2-0905-preview` - `moonshot/kimi-k2-turbo-preview` - `moonshot/kimi-k2-thinking` - `moonshot/kimi-k2-thinking-turbo` - + {/* moonshot-kimi-k2-model-refs:end */} ```json5 { agents: { diff --git a/docs/providers/moonshot.md b/docs/providers/moonshot.md index eb3ee7b91..7de182e01 100644 --- a/docs/providers/moonshot.md +++ b/docs/providers/moonshot.md @@ -10,12 +10,12 @@ Moonshot provides the Kimi API with OpenAI-compatible endpoints. Configure the provider and set the default model to `moonshot/kimi-k2-0905-preview`. Current Kimi K2 model IDs: - +{/* moonshot-kimi-k2-ids:start */} - `kimi-k2-0905-preview` - `kimi-k2-turbo-preview` - `kimi-k2-thinking` - `kimi-k2-thinking-turbo` - +{/* moonshot-kimi-k2-ids:end */} ```bash clawdbot onboard --auth-choice moonshot-api-key diff --git a/src/auto-reply/reply/session-updates.test.ts b/src/auto-reply/reply/session-updates.test.ts index 96c8c6681..6f243a532 100644 --- a/src/auto-reply/reply/session-updates.test.ts +++ b/src/auto-reply/reply/session-updates.test.ts @@ -33,9 +33,7 @@ describe("prependSystemEvents", () => { second: "2-digit", }); - expect(result).toContain( - `System: [${expectedTimestamp}] Model switched.`, - ); + expect(result).toContain(`System: [${expectedTimestamp}] Model switched.`); resetSystemEventsForTest(); vi.useRealTimers(); diff --git a/src/discord/monitor.slash.test.ts b/src/discord/monitor.slash.test.ts index a2a8beba3..251d96694 100644 --- a/src/discord/monitor.slash.test.ts +++ b/src/discord/monitor.slash.test.ts @@ -31,7 +31,7 @@ beforeEach(() => { describe("discord native commands", () => { it( "streams tool results for native slash commands", - { timeout: 10_000 }, + { timeout: 30_000 }, async () => { const { ChannelType } = await import("@buape/carbon"); const { createDiscordNativeCommand } = await import("./monitor.js"); diff --git a/src/discord/monitor.ts b/src/discord/monitor.ts index 9c285b4d1..2b5cf977b 100644 --- a/src/discord/monitor.ts +++ b/src/discord/monitor.ts @@ -179,7 +179,9 @@ export function registerDiscordListener( listeners: Array, listener: object, ) { - if (listeners.some((existing) => existing.constructor === listener.constructor)) { + if ( + listeners.some((existing) => existing.constructor === listener.constructor) + ) { return false; } listeners.push(listener); diff --git a/src/infra/system-events.test.ts b/src/infra/system-events.test.ts index a6d7656f2..e68e9dd0f 100644 --- a/src/infra/system-events.test.ts +++ b/src/infra/system-events.test.ts @@ -47,7 +47,9 @@ describe("system events (session routing)", () => { isNewSession: false, prefixedBodyBase: "hi", }); - expect(discord).toBe("System: Discord reaction added: ✅\n\nhi"); + expect(discord).toMatch( + /^System: \[[^\]]+\] Discord reaction added: ✅\n\nhi$/, + ); expect(peekSystemEvents("discord:group:123")).toEqual([]); });