Skip to content

Commit 2638d35

Browse files
committed
fix: skip previousResponseId for GPT-5 after subtask completion
- When a subtask completes and returns to the parent task, the conversation continuity for GPT-5 responses API was broken because the previous_response_id was still being used - Added logic to set skipPrevResponseIdOnce flag when resuming from a subtask with GPT-5 - This ensures the next API call after subtask completion uses full conversation history - Added comprehensive tests to verify the fix works for GPT-5 and doesn't affect other models Fixes #7251
1 parent c608392 commit 2638d35

File tree

2 files changed

+215
-1654
lines changed

2 files changed

+215
-1654
lines changed

src/core/task/Task.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,17 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
11071107
role: "user",
11081108
content: [{ type: "text", text: `[new_task completed] Result: ${lastMessage}` }],
11091109
})
1110+
1111+
// When using GPT-5 with the responses API, we need to skip the previous_response_id
1112+
// for the next API call after a subtask completes, similar to what happens after
1113+
// a condense operation. This ensures the conversation continuity is properly maintained.
1114+
const modelId = this.api.getModel().id
1115+
if (modelId && modelId.startsWith("gpt-5")) {
1116+
this.skipPrevResponseIdOnce = true
1117+
this.providerRef
1118+
.deref()
1119+
?.log(`[GPT-5] Skipping previous_response_id for next API call after subtask completion`)
1120+
}
11101121
} catch (error) {
11111122
this.providerRef
11121123
.deref()

0 commit comments

Comments
 (0)