Skip to content
Closed
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
1 change: 1 addition & 0 deletions scripts/test-layout/layout.json
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,7 @@
"rate-limit-retry.test.ts": "providers",
"raycast-client.test.ts": "clients",
"raycast-detect.test.ts": "clients",
"reasoning-effort-summary-default.test.ts": "responses",
"reasoning-effort.test.ts": "codex-integration",
"reasoning-envelope.test.ts": "responses",
"reasoning-metadata.test.ts": "codex-integration",
Expand Down
8 changes: 6 additions & 2 deletions src/combos/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@ export function concreteComboRequestBody(
return clone;
}
if (reasoning === undefined) {
clone.reasoning = { effort: resolvedEffort };
clone.reasoning = { effort: resolvedEffort, summary: "auto" };
} else {
clone.reasoning = { ...(reasoning as Record<string, unknown>), effort: resolvedEffort };
clone.reasoning = {
...(reasoning as Record<string, unknown>),
effort: resolvedEffort,
...((reasoning as Record<string, unknown>).summary === undefined ? { summary: "auto" } : {}),
};
}
return clone;
}
Expand Down
3 changes: 2 additions & 1 deletion src/responses/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,8 @@ export function parseRequest(
options.reasoning = requestedEffort;
}
const summaryMode = data.reasoning?.summary;
if (!summaryMode || summaryMode === "none") options.hideThinkingSummary = true;
const reasoningActive = Boolean(requestedEffort && requestedEffort !== "none" && requestedEffort !== "off");
if (summaryMode === "none" || (!summaryMode && !reasoningActive)) options.hideThinkingSummary = true;
if (data.presence_penalty !== undefined) options.presencePenalty = data.presence_penalty;
if (data.frequency_penalty !== undefined) options.frequencyPenalty = data.frequency_penalty;
if (data.service_tier !== undefined) options.serviceTier = data.service_tier;
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/test-layout-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@
"rate-limit-retry.test.ts": "providers",
"raycast-client.test.ts": "clients",
"raycast-detect.test.ts": "clients",
"reasoning-effort-summary-default.test.ts": "responses",
"reasoning-effort.test.ts": "codex-integration",
"reasoning-envelope.test.ts": "responses",
"reasoning-metadata.test.ts": "codex-integration",
Expand Down
53 changes: 53 additions & 0 deletions tests/responses/reasoning-effort-summary-default.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { describe, expect, test } from "bun:test";
import { parseRequest } from "../../src/responses/parser";
import { concreteComboRequestBody } from "../../src/combos/request";
import type { OcxComboTarget } from "../../src/types";

describe("reasoning effort preserves visible thinking when summary is omitted", () => {
test("reasoning with active effort does not default to hideThinkingSummary", () => {
const parsed = parseRequest({
model: "test-model",
reasoning: { effort: "high" },
input: [{ type: "message", role: "user", content: [{ type: "input_text", text: "hi" }] }],
});
expect(parsed.options.reasoning).toBe("high");
expect(parsed.options.hideThinkingSummary).toBeUndefined();
});

test("explicit summary of none still hides thinking summary", () => {
const parsed = parseRequest({
model: "test-model",
reasoning: { effort: "high", summary: "none" },
input: [{ type: "message", role: "user", content: [{ type: "input_text", text: "hi" }] }],
});
expect(parsed.options.reasoning).toBe("high");
expect(parsed.options.hideThinkingSummary).toBe(true);
});

test("omitted reasoning and omitted effort still default to hideThinkingSummary", () => {
const parsed = parseRequest({
model: "test-model",
input: [{ type: "message", role: "user", content: [{ type: "input_text", text: "hi" }] }],
});
expect(parsed.options.hideThinkingSummary).toBe(true);
});

test("reasoning effort of none defaults to hideThinkingSummary", () => {
const parsed = parseRequest({
model: "test-model",
reasoning: { effort: "none" },
input: [{ type: "message", role: "user", content: [{ type: "input_text", text: "hi" }] }],
});
expect(parsed.options.hideThinkingSummary).toBe(true);
});

test("combo injected effort defaults summary to auto", () => {
const target: Pick<OcxComboTarget, "provider" | "model"> = {
provider: "test-provider",
model: "test-model",
};
const body = { model: "combo/test", input: [] };
const child = concreteComboRequestBody(body, target, "high", ["high"]);
expect(child.reasoning).toEqual({ effort: "high", summary: "auto" });
});
});
Loading