@@ -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 }
0 commit comments