Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Nov 12, 2025

Summary
We moved continuity off OpenAI servers and now maintain conversation state locally by persisting and replaying encrypted reasoning items. Requests are stateless (store=false) while retaining the performance/caching benefits of the Responses API. This has the side effect of removing complex logic around condensing.

Additional context https://cookbook.openai.com/examples/responses_api/reasoning_items

Why
This aligns with how Roo manages context and significantly simplifies our Responses API implementation while keeping all the benefits of continuity, caching, and latency improvements.

What changed

Removed (server-side continuity and legacy flags)

Kept (provider-agnostic metadata)

Result

  • Aligned with Roo’s context model: single, local continuity path using encrypted reasoning items.
  • Stateless API usage with preserved performance and caching characteristics from the Responses API.
  • Simpler, less error-prone code (no previous_response_id branches, retries, or skip flags).
  • No behavior regressions expected; Responses API streaming tests validate new behavior openai-native.spec.ts.

Important

Migrate conversation continuity to stateless API requests using encrypted reasoning items, removing server-side continuity dependencies.

  • Behavior:
    • Transition to stateless API requests with store=false and use of encrypted reasoning items for continuity in OpenAiNativeHandler.
    • Extract and replay encrypted reasoning items for conversation continuity in OpenAiNativeHandler.getEncryptedContent() and Task.attemptApiRequest().
    • Remove previous response ID logic and related retry mechanisms in OpenAiNativeHandler and Task.
  • Models:
    • Update ApiMessage type in apiMessages.ts to include type, summary, and encrypted_content for reasoning items.
  • Tests:
    • Mark tests related to previous response ID as deprecated in openai-native.spec.ts and Task.spec.ts.
    • Update taskMessages.spec.ts to reflect changes in message persistence.
  • Misc:
    • Remove metadata.gpt5.previous_response_id from clineMessageSchema in message.ts.
    • Remove persistGpt5Metadata() and related logic from Task.ts.

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

…ems (Responses API)

Summary
We moved continuity off OpenAI servers and now maintain conversation state locally by persisting and replaying encrypted reasoning items. Requests are stateless (store=false) while retaining the performance/caching benefits of the Responses API.

Why
This aligns with how Roo manages context and simplifies our Responses API implementation while keeping all the benefits of continuity, caching, and latency improvements.

What changed
- All OpenAI models now use the Responses API; system instructions are passed via the top-level instructions field; requests include store=false and include=["reasoning.encrypted_content"].
- We persist encrypted reasoning items (type: "reasoning", encrypted_content, optional id) into API history and replay them on subsequent turns.
- Reasoning summaries default to summary: "auto" when supported; text.verbosity only when supported.
- Atomic persistence via safeWriteJson.

Removed
- previous_response_id flows, suppressPreviousResponseId/skipPrevResponseIdOnce, persistGpt5Metadata(), and GPT‑5 response ID metadata in UI messages.

Kept
- taskId and mode metadata for cross-provider features.

Result
- ZDR-friendly, stateless continuity with equal or better performance and a simpler codepath.
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Enhancement New feature or request labels Nov 12, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 12, 2025

Rooviewer Clock   See task on Roo Cloud

Reviewed commit 7bd5071. No new issues found - the commit adds proper TypeScript typing to conversation history processing without changing behavior.

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 12, 2025
Continuity is stateless via encrypted reasoning items that we persist and replay. We now capture the top-level response id in OpenAiNativeHandler and persist the assistant message id into api_conversation_history.json solely for debugging/correlation with provider logs; it is not used for continuity or control flow.

Also: silence request-body debug logging to avoid leaking prompts.
Copy link
Collaborator Author

@hannesrudolph hannesrudolph left a comment

Choose a reason for hiding this comment

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

Implemented review fixes:

  • Guarded request-body debug log in OpenAiNativeHandler to avoid leaking prompts.
  • Retain response id from Responses API for troubleshooting/correlation only (not continuity). Continuity remains stateless via encrypted reasoning items persisted in API history.
  • Persist assistant message id when present to aid debugging.
    All tests pass across src and webview-ui.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Nov 12, 2025
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Nov 12, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 12, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Nov 12, 2025
@hannesrudolph
Copy link
Collaborator Author

Addressed Dan's feedback: typed cleanConversationHistory and createMessage params in Task.attemptApiRequest(). Removed any casts and added a ReasoningItem type for encrypted_content. All src and webview-ui tests pass locally.

@hannesrudolph hannesrudolph moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Nov 12, 2025
@mrubens mrubens merged commit 0fdbd39 into main Nov 13, 2025
13 checks passed
@mrubens mrubens deleted the feat/responses-encrypted-reasoning branch November 13, 2025 00:50
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Nov 13, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 13, 2025