Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 30, 2025

Description

This PR fixes an issue where GPT-5 models (specifically gpt-5-codex) were unable to read subtask results after completion. The root cause was that the parent task was unconditionally setting skipPrevResponseIdOnce = true after a subtask completed, which broke the conversation continuity chain that GPT-5 models rely on.

Problem

When using gpt-5-codex:

  • Parent task launches a subtask
  • Subtask completes and returns results
  • Parent task resumes but cannot see the subtask results
  • This happens because skipPrevResponseIdOnce causes the next API call to omit the previous_response_id, breaking continuity

Solution

Modified the completeSubtask() method to conditionally handle the skipPrevResponseIdOnce flag:

  • For GPT-5 models: Do NOT skip the previous_response_id (maintains continuity)
  • For other models: Continue existing behavior (skip to ensure full conversation is sent)

Changes

  • Modified src/core/task/Task.ts to check if the model is GPT-5 before setting the skip flag
  • Added comprehensive tests in src/core/task/__tests__/Task.spec.ts covering:
    • GPT-5 models preserving continuity
    • Non-GPT-5 models maintaining existing behavior
    • Edge case handling when model ID is undefined

Testing

  • ✅ All existing tests pass
  • ✅ New tests added specifically for GPT-5 subtask completion
  • ✅ Type checking passes
  • ✅ Linting passes

Fixes #8402


Important

Fixes GPT-5 conversation continuity issue after subtask completion by conditionally setting a flag in Task.ts.

  • Behavior:
    • Fixes issue where GPT-5 models lost conversation continuity after subtask completion by modifying completeSubtask() in Task.ts.
    • For GPT-5 models, maintains continuity by not setting skipPrevResponseIdOnce.
    • For non-GPT-5 models, continues to set skipPrevResponseIdOnce to ensure full conversation is sent.
  • Testing:
    • Added tests in Task.spec.ts to verify behavior for GPT-5 and non-GPT-5 models.
    • Tests cover edge cases, including undefined model ID.

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

- Modified completeSubtask to check if the model is GPT-5 before setting skipPrevResponseIdOnce
- GPT-5 models now maintain previous_response_id chain after subtask completion
- Non-GPT-5 models continue to skip previous_response_id as before
- Added comprehensive tests for both GPT-5 and non-GPT-5 behavior

Fixes #8402
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 30, 2025 08:13
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Sep 30, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 30, 2025
Copy link
Contributor Author

@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.

Self-review initialized: auditing my own code with the emotional range of a diff algorithm.

@@ -0,0 +1 @@
Subproject commit e46929b8d8add0cd3c412d69f8ac882c405a4ba9
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[P1] Unrelated git submodule/gitsubtree artifact committed. No matching .gitmodules update and not referenced by the code changes. Please drop this file from the PR.

@@ -0,0 +1 @@
Subproject commit 88a473b017af37091c85ce3056e444e856f80d6e
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[P1] Unrelated submodule/gitreference introduced. This appears accidental and unrelated to GPT‑5 continuity fix. Please remove from the PR.

// GPT-5 only receives the latest message without the subtask result context.
// For other models, we skip to ensure the full conversation is sent.
const modelId = this.api.getModel().id
const isGpt5Model = modelId && modelId.startsWith("gpt-5")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[P1] GPT‑5 detection robustness. Model ids can be prefixed or vary in case across providers. Suggest normalizing and using includes:\n\nsuggestion\n\t\t\tconst modelId = this.api.getModel().id\n\t\t\tconst isGpt5Model = typeof modelId === \"string\" && modelId.toLowerCase().includes(\"gpt-5\")\n\n\nAlso consider centralizing this in a small helper to keep parity with other call sites.

})

describe("GPT-5 Subtask Completion", () => {
it("should NOT skip previous_response_id for GPT-5 models after subtask completion", async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[P2] Completeness. Add a test that, after completeSubtask() with GPT‑5, the subsequent attemptApiRequest() includes metadata.previousResponseId (and omits suppressPreviousResponseId). This validates the continuity chain beyond just the flag.

@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 14, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Oct 14, 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 Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] Subtasks not working with gpt-5-codex

3 participants