Skip to content

Commit 64a2a03

Browse files
committed
fix(gpt5): canonicalize GPT-5 metadata key to previous_response_id and align enableGpt5ReasoningSummary default docs
1 parent 614dc44 commit 64a2a03

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/core/task/Task.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,16 +2052,18 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
20522052
try {
20532053
const modelId = this.api.getModel().id
20542054
if (modelId && modelId.startsWith("gpt-5") && !this.skipPrevResponseIdOnce) {
2055-
// Find the last assistant message that has a response_id stored
2055+
// Find the last assistant message that has a previous_response_id stored
20562056
const idx = findLastIndex(
20572057
this.clineMessages,
2058-
(m) => m.type === "say" && (m as any).say === "text" && (m as any).metadata?.gpt5?.response_id,
2058+
(m) =>
2059+
m.type === "say" &&
2060+
(m as any).say === "text" &&
2061+
(m as any).metadata?.gpt5?.previous_response_id,
20592062
)
20602063
if (idx !== -1) {
2061-
// Use the response_id from the last assistant message as the previous_response_id for this request
2062-
previousResponseId = ((this.clineMessages[idx] as any).metadata.gpt5.response_id || undefined) as
2063-
| string
2064-
| undefined
2064+
// Use the previous_response_id from the last assistant message for this request
2065+
previousResponseId = ((this.clineMessages[idx] as any).metadata.gpt5.previous_response_id ||
2066+
undefined) as string | undefined
20652067
}
20662068
}
20672069
} catch {
@@ -2225,7 +2227,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
22252227
}
22262228

22272229
/**
2228-
* Persist GPT-5 per-turn metadata (response_id, instructions, reasoning_summary)
2230+
* Persist GPT-5 per-turn metadata (previous_response_id, instructions, reasoning_summary)
22292231
* onto the last complete assistant say("text") message.
22302232
*/
22312233
private async persistGpt5Metadata(reasoningMessage?: string): Promise<void> {
@@ -2243,7 +2245,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
22432245
msg.metadata = msg.metadata ?? {}
22442246
msg.metadata.gpt5 = {
22452247
...(msg.metadata.gpt5 ?? {}),
2246-
response_id: lastResponseId,
2248+
previous_response_id: lastResponseId,
22472249
instructions: this.lastUsedInstructions,
22482250
reasoning_summary: (reasoningMessage ?? "").trim() || undefined,
22492251
}

src/shared/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type ApiHandlerOptions = Omit<ProviderSettings, "apiProvider"> & {
1111
/**
1212
* When true and using GPT‑5 Responses API, include reasoning.summary: "auto"
1313
* so the API returns reasoning summaries (we already parse and surface them).
14-
* Defaults to false to preserve existing request body expectations.
14+
* Defaults to true; set to false to disable summaries.
1515
*/
1616
enableGpt5ReasoningSummary?: boolean
1717
}

0 commit comments

Comments
 (0)