Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Nov 14, 2025

Summary of Changes

Fixes this with OpeanAI Native provider
image

  • Keep encrypted reasoning from OpenAI Responses attached to the assistant turn that produced it, so context management can safely trim history without separating the two.
  • Factor the logic that builds provider-ready conversation history into a small helper to keep the core task loop simple and readable.

Details

  • When an assistant response includes encrypted reasoning, Roo now:
    • Embeds that reasoning as the first content block on the assistant message in internal history.
  • Right before sending the next request, Roo:
    • Uses a new helper to:
      • Extract the embedded reasoning into a separate reasoning item for the provider.
      • Emit a clean assistant message without the reasoning block.
      • Preserve legacy reasoning entries from existing tasks.

Net effect: reasoning state and assistant messages stay paired through context trimming, while the OpenAI-native provider still receives the exact reasoning payload it expects.


Important

Embed encrypted reasoning in assistant messages for improved context management, with tests ensuring correct behavior.

  • Behavior:
    • Encrypted reasoning is embedded as the first content block in assistant messages in Task.ts.
    • buildCleanConversationHistory() in Task.ts separates embedded reasoning into distinct reasoning items.
    • Maintains compatibility with legacy standalone reasoning entries.
  • Tests:
    • Added test in reasoning-preservation.test.ts to verify encrypted reasoning embedding.
    • Tests ensure reasoning is correctly embedded and retrieved.

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

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Nov 14, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 14, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed. No new issues found.

This commit refactors the reasoning history building logic into a dedicated helper method, improving code organization without changing functionality.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 14, 2025
@hannesrudolph hannesrudolph changed the title Embed encrypted reasoning with assistant messages for robust context management [FIX] Fix OpenAI Native handling of encrypted reasoning blocks to prevent error when condensing Nov 14, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 14, 2025
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Review] in Roo Code Roadmap Nov 14, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Nov 14, 2025
@mrubens mrubens merged commit 4a9ff8f into main Nov 14, 2025
16 checks passed
@mrubens mrubens deleted the chore/openai-native-reasoning-embedding branch November 14, 2025 17:54
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 14, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Nov 14, 2025
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Nov 17, 2025