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

// Set skipPrevResponseIdOnce to ensure the next API call sends the full conversation
// including the subtask result, not just from before the subtask was created
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment clearly explains why this flag is being set. Since this pattern (skipping previous_response_id after context changes) is now used in multiple places (here and line 2415 for condensation), would it be worth documenting this behavior pattern in a more central location or perhaps extracting it into a helper method for consistency?

this.skipPrevResponseIdOnce = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Good fix! This correctly ensures the full conversation history is sent after a subtask completes. The pattern matches what's done for context condensation (line 2415), which is a proven approach.

One suggestion: Consider adding a test case that specifically verifies subtask results are included in the GPT-5 API call when using the Responses API. This would help prevent regression of this issue.

} catch (error) {
this.providerRef
.deref()
Expand Down
Loading