diff --git a/packages/coding-agent/src/core/evolution-runtime.ts b/packages/coding-agent/src/core/evolution-runtime.ts index 09e0ba201..1e18cb9a0 100644 --- a/packages/coding-agent/src/core/evolution-runtime.ts +++ b/packages/coding-agent/src/core/evolution-runtime.ts @@ -443,7 +443,7 @@ export class CodingAgentEvolutionModelExecutor implements EvolutionModelExecutor { signal: controller.signal, ...(request.stage === "skill-synthesizer" ? { maxTokens: request.maxOutputTokens } : {}), - cacheRetention: "none", + cacheRetention: "short", sessionId: request.idempotencyKey, timeoutMs: PROVIDER_STREAM_IDLE_TIMEOUT_MS, websocketConnectTimeoutMs: PROVIDER_FIRST_BYTE_TIMEOUT_MS, diff --git a/packages/coding-agent/test/evolution-runtime.test.ts b/packages/coding-agent/test/evolution-runtime.test.ts index af82b99a7..272932db8 100644 --- a/packages/coding-agent/test/evolution-runtime.test.ts +++ b/packages/coding-agent/test/evolution-runtime.test.ts @@ -888,6 +888,44 @@ describe("coding-agent evolution runtime", () => { }); }); + it("requests short cache retention with the evolution session ID", async () => { + const harness = await createHarness(); + harnesses.push(harness); + const idempotencyKey = "evolution-prompt-cache"; + harness.setResponses([ + (_context, options) => { + expect(options?.cacheRetention).toBe("short"); + expect(options?.sessionId).toBe(idempotencyKey); + return fauxAssistantMessage(fauxToolCall("submit_evolution_response", { complete: true, lessons: [] }), { + stopReason: "toolUse", + }); + }, + ]); + const executor = new CodingAgentEvolutionModelExecutor(harness.session, harness.session.modelRuntime, { + async waitUntilBackgroundAllowed() {}, + }); + const model = harness.getModel(); + + await expect( + executor.execute({ + stage: "reflector", + model: { + provider: model.provider, + model: model.id, + configurationDigest: `sha256:${"1".repeat(64)}`, + }, + promptVersion: "reflector-v1", + idempotencyKey, + input: {}, + outputSchema: { type: "object" }, + tools: [], + }), + ).resolves.toMatchObject({ + output: { complete: true, lessons: [] }, + submissionMethod: "response-tool", + }); + }); + it("preserves transient provider stop diagnostics for evolution failures", async () => { const harness = await createHarness(); harnesses.push(harness);