Skip to content

Commit 0c4bbc3

Browse files
authored
feat(ai): keep prompt cache across effort switches on GPT-6 Sol and Luna (#51339)
1 parent ae7dd82 commit 0c4bbc3

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

‎packages/ai/src/protocols/openai-responses.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@ const adapter = {
143143
restoreHostedToolItem: (item: unknown) => (Schema.is(OpenAIResponsesHostedToolItem)(item) ? item : undefined),
144144
} satisfies OpenResponses.ProviderAdapter
145145

146-
// Only GPT-6 Astra accepts `configuration_update`, and never alongside automatic `context_management` compaction.
146+
// GPT-6 Astra, Sol, and Luna accept `configuration_update` only in standard mode (not `reasoning.mode: "pro"` or
147+
// `-pro` slugs), and never alongside automatic `context_management` compaction.
147148
const supportsEffortUpdates = (request: LLMRequest) => {
148149
if (request.providerOptions?.contextManagement !== undefined) return false
150+
if (Schema.is(Schema.Struct({ mode: Schema.Literal("pro") }))(request.http?.body?.reasoning)) return false
149151
const override = request.model.compatibility?.supportsEffortUpdates
150152
if (override !== undefined) return override
151-
return /(?:^|\/)gpt-6-astra$/i.test(request.model.id)
153+
return /(?:^|\/)gpt-6-(?:astra|sol|luna)$/i.test(request.model.id)
152154
}
153155

154156
const nativeImageToolInput = (tool: ToolDefinition) => {

‎packages/ai/test/effort-updates.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,34 @@ describe("OpenAI Responses effort updates", () => {
351351
}),
352352
)
353353

354+
it.effect("strips markers when the body overlay selects pro reasoning mode", () =>
355+
Effect.gen(function* () {
356+
const prepared = yield* compileRequest(
357+
LLM.request({
358+
model: OpenAI.configure({ apiKey: "fixture", http: { body: { reasoning: { mode: "pro" } } } }).responses(
359+
"gpt-6-sol",
360+
),
361+
messages: conversation,
362+
providerOptions: { reasoningEffort: "low" },
363+
}),
364+
)
365+
366+
expect(updates(prepared.body)).toEqual([])
367+
expect(prepared.body.reasoning).toEqual({ effort: "low" })
368+
}),
369+
)
370+
354371
for (const [id, supported] of [
355372
["gpt-6-astra", true],
356373
["openai/gpt-6-astra", true],
374+
["gpt-6-sol", true],
375+
["openai/gpt-6-sol", true],
376+
["gpt-6-luna", true],
377+
["openai/gpt-6-luna", true],
357378
["gpt-6-astra-2026-09-01", false],
379+
["gpt-6-sol-pro", false],
380+
["gpt-6-luna-pro", false],
381+
["gpt-6-sol-fast", false],
358382
["gpt-5.6-sol", false],
359383
] as const) {
360384
it.effect(`${supported ? "lowers" : "strips"} markers for ${id}`, () =>

0 commit comments

Comments
 (0)