fix(coding-agent): reuse session thinking for compaction closes #3438

This commit is contained in:
Mario Zechner
2026-04-20 15:09:50 +02:00
parent d66ef6dce8
commit da6a81d398
4 changed files with 69 additions and 10 deletions

View File

@@ -56,18 +56,58 @@ describe("generateSummary reasoning options", () => {
completeSimpleMock.mockResolvedValue(mockSummaryResponse);
});
it("sets reasoning=high for reasoning-capable models", async () => {
await generateSummary(messages, createModel(true), 2000, "test-key");
it("uses the provided thinking level for reasoning-capable models", async () => {
await generateSummary(
messages,
createModel(true),
2000,
"test-key",
undefined,
undefined,
undefined,
undefined,
"medium",
);
expect(completeSimpleMock).toHaveBeenCalledTimes(1);
expect(completeSimpleMock.mock.calls[0][2]).toMatchObject({
reasoning: "high",
reasoning: "medium",
apiKey: "test-key",
});
});
it("does not set reasoning when thinking is off", async () => {
await generateSummary(
messages,
createModel(true),
2000,
"test-key",
undefined,
undefined,
undefined,
undefined,
"off",
);
expect(completeSimpleMock).toHaveBeenCalledTimes(1);
expect(completeSimpleMock.mock.calls[0][2]).toMatchObject({
apiKey: "test-key",
});
expect(completeSimpleMock.mock.calls[0][2]).not.toHaveProperty("reasoning");
});
it("does not set reasoning for non-reasoning models", async () => {
await generateSummary(messages, createModel(false), 2000, "test-key");
await generateSummary(
messages,
createModel(false),
2000,
"test-key",
undefined,
undefined,
undefined,
undefined,
"medium",
);
expect(completeSimpleMock).toHaveBeenCalledTimes(1);
expect(completeSimpleMock.mock.calls[0][2]).toMatchObject({