Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,17 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
role: "user",
content: [{ type: "text", text: `[new_task completed] Result: ${lastMessage}` }],
})

// When using GPT-5 with the responses API, we need to skip the previous_response_id
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work following the existing pattern from condense operations! The inline comment clearly explains why this is necessary for GPT-5.

// for the next API call after a subtask completes, similar to what happens after
// a condense operation. This ensures the conversation continuity is properly maintained.
const modelId = this.api.getModel().id
if (modelId && modelId.startsWith("gpt-5")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resumePausedTask method correctly checks if the model ID starts with 'gpt-5' and sets the skipPrevResponseIdOnce flag. Consider extracting this model check into a helper (e.g. isGpt5Model) to improve clarity and reuse.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting this GPT-5 check logic into a utility function like isGpt5Model(modelId) for better maintainability. This pattern might be needed elsewhere in the codebase as GPT-5 adoption grows.

this.skipPrevResponseIdOnce = true
this.providerRef
.deref()
?.log(`[GPT-5] Skipping previous_response_id for next API call after subtask completion`)
}
} catch (error) {
this.providerRef
.deref()
Expand Down
Loading
Loading