Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Aug 22, 2025

Description

This PR fixes issue #7251 where subtask results were not being provided to GPT-5 when using the OpenAI Responses API with the previous_response_id mechanism.

Problem

When a subtask completes and the parent task resumes, the next API call was using a previous_response_id from before the subtask was created. This caused GPT-5 to only receive the new message without the subtask result context, as the API would only provide messages after the specified previous_response_id.

Solution

Set skipPrevResponseIdOnce = true in the resumePausedTask() method after adding the subtask result to the conversation history. This ensures the next API call sends the full conversation including the subtask result, following the same pattern used after context condensation.

Changes

  • Added this.skipPrevResponseIdOnce = true in Task.ts line 1129 after the subtask result is added to the API conversation history

Testing

The fix follows the established pattern already used in the codebase for context condensation scenarios where we need to ensure the full context is sent.

Fixes #7251


Important

Fixes issue #7251 by ensuring subtask results are included in the next API call to GPT-5 in resumePausedTask() in Task.ts.

  • Behavior:
  • Testing:
    • Follows established pattern for context condensation to ensure full context is sent.

This description was created by Ellipsis for 235a144. You can customize this summary. It will automatically update as commits are pushed.

… API

When a subtask completes and the parent task resumes, set skipPrevResponseIdOnce = true
to ensure the next API call sends the full conversation including the subtask result.
This fixes the issue where GPT-5 would only receive the new message without the subtask
result context when using previous_response_id.

Fixes #7251
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners August 22, 2025 02:58
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Aug 22, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Aug 22, 2025
Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Thank you for this fix! I've reviewed the changes and the solution correctly addresses the issue where subtask results weren't being provided to GPT-5 when using the OpenAI Responses API.

The fix follows the established pattern already used for context condensation, which gives confidence in the approach. The implementation is minimal and focused, addressing exactly what's needed.


// Set skipPrevResponseIdOnce to ensure the next API call sends the full conversation
// including the subtask result, not just from before the subtask was created
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.

})

// 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?

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 22, 2025
@mrubens mrubens merged commit d06d970 into main Aug 22, 2025
24 checks passed
@mrubens mrubens deleted the fix/subtask-result-gpt5-context branch August 22, 2025 03:16
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Aug 22, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Subtasks: Result is NOT provided to the model on return (GPT-5)

4 participants