From fc6256372d61eb45f10e5d167d0db89d298c7930 Mon Sep 17 00:00:00 2001 From: can1357 Date: Thu, 23 Jul 2026 00:13:14 +0200 Subject: [PATCH] test: fix local-midnight logger flake and stale kimi k3 thinking format pin - logger-multiprocess asserted the UTC day (toISOString) while DailyRotateFile names files with the LOCAL date, failing nightly between 00:00 and 02:00 local (UTC+2); the per-pid rotation-file invariant now matches any dated name. - kimi-code k3 bundled compat moved to thinkingFormat 'kimi' with the catalog regen; the K3 named-tool-choice downgrade gate keys on provider/id/baseUrl, so only the stale precondition needed updating. --- .../src/providers/__tests__/kimi-code-thinking.test.ts | 2 +- .../coding-agent/test/tools/jtd-to-json-schema.test.ts | 2 +- packages/coding-agent/test/tools/yield.test.ts | 10 +++++----- packages/utils/test/logger-multiprocess.test.ts | 7 +++++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/ai/src/providers/__tests__/kimi-code-thinking.test.ts b/packages/ai/src/providers/__tests__/kimi-code-thinking.test.ts index 85617a965..c83d92d82 100644 --- a/packages/ai/src/providers/__tests__/kimi-code-thinking.test.ts +++ b/packages/ai/src/providers/__tests__/kimi-code-thinking.test.ts @@ -161,7 +161,7 @@ describe("Kimi K3 thinking transport", () => { it("downgrades named tool choice to required for K3 thinking", async () => { vi.spyOn(kimiOauth, "getKimiCommonHeaders").mockReturnValue(KIMI_HEADERS); const bundledModel = getBundledModel<"openai-completions">("kimi-code", "k3"); - expect(bundledModel.compat.thinkingFormat).toBe("zai"); + expect(bundledModel.compat.thinkingFormat).toBe("kimi"); let payload: unknown; const capturePayload = async ( model: Model<"openai-completions">, diff --git a/packages/coding-agent/test/tools/jtd-to-json-schema.test.ts b/packages/coding-agent/test/tools/jtd-to-json-schema.test.ts index 788a3cc82..0add7cfec 100644 --- a/packages/coding-agent/test/tools/jtd-to-json-schema.test.ts +++ b/packages/coding-agent/test/tools/jtd-to-json-schema.test.ts @@ -70,7 +70,7 @@ describe("jtdToJsonSchema", () => { }); }); it("does not misinterpret user-named properties that collide with JTD keywords (#1345)", () => { - // Mirrors the `files[]` shape declared by the built-in explore agent: + // Mirrors the `files[]` shape declared by the built-in scout agent: // a JTD elements form whose item properties include one literally named `ref`. const converted = jtdToJsonSchema({ properties: { diff --git a/packages/coding-agent/test/tools/yield.test.ts b/packages/coding-agent/test/tools/yield.test.ts index aa0f2fbd7..574bee40c 100644 --- a/packages/coding-agent/test/tools/yield.test.ts +++ b/packages/coding-agent/test/tools/yield.test.ts @@ -1106,8 +1106,8 @@ describe("YieldTool", () => { ).rejects.toThrow("Output does not match schema"); }); - it("rejects nested-array shape mismatches with a retry hint (explore-style JTD)", async () => { - // Regression for the GLM/explore failure mode: model invents per-file fields + it("rejects nested-array shape mismatches with a retry hint (scout-style JTD)", async () => { + // Regression for the GLM/scout failure mode: model invents per-file fields // (`ref`, `surface`, …) instead of the schema's `path` + `description`. The // in-tool validator MUST surface the mismatch with a retry directive so the // subagent can fix its output before the parent runs its post-mortem check. @@ -1138,13 +1138,13 @@ describe("YieldTool", () => { ], }; - await expect(tool.execute("call-explore-1", { result: { data: badPayload } } as never)).rejects.toThrow( + await expect(tool.execute("call-scout-1", { result: { data: badPayload } } as never)).rejects.toThrow( /files\/0\/path: is required.*Call yield again with the corrected shape/, ); // Third retry still throws with one attempt remaining advertised in the hint. - await tool.execute("call-explore-2", { result: { data: badPayload } } as never).catch(() => {}); - await expect(tool.execute("call-explore-3", { result: { data: badPayload } } as never)).rejects.toThrow( + await tool.execute("call-scout-2", { result: { data: badPayload } } as never).catch(() => {}); + await expect(tool.execute("call-scout-3", { result: { data: badPayload } } as never)).rejects.toThrow( "this is the final retry before the schema constraint is dropped", ); }); diff --git a/packages/utils/test/logger-multiprocess.test.ts b/packages/utils/test/logger-multiprocess.test.ts index da5974c6f..82efaccac 100644 --- a/packages/utils/test/logger-multiprocess.test.ts +++ b/packages/utils/test/logger-multiprocess.test.ts @@ -50,9 +50,12 @@ describe("multiprocess file logging", () => { expect(await Promise.all(processes.map(proc => proc.exited))).toEqual([0, 0]); const entries = await fs.readdir(logsDir); - const datedPrefix = `omp.${new Date().toISOString().slice(0, 10)}`; + // DailyRotateFile's %DATE% uses the LOCAL date; don't pin an exact day + // (toISOString is UTC and diverges around local midnight) — the invariant + // is one dated rotation file per pid. for (const proc of processes) { - expect(entries).toContain(`${datedPrefix}.${proc.pid}.log`); + const perPid = new RegExp(`^omp\\.\\d{4}-\\d{2}-\\d{2}\\.${proc.pid}\\.log$`); + expect(entries.some(name => perPid.test(name))).toBe(true); } expect(entries.filter(name => name.endsWith("-audit.json"))).toHaveLength(2); });