Skip to content

Commit 0fdbd39

Browse files
Migrate conversation continuity to plugin-side encrypted reasoning items (Responses API) (#9203)
* Migrate conversation continuity to plugin-side encrypted reasoning items (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. * fix(webview): remove unused metadata prop from ReasoningBlock render * Responses API: retain response id for troubleshooting (not continuity) 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. * remove DEPRECATED tests * chore: remove unused Task types file to satisfy knip CI * fix(task): properly type cleanConversationHistory and createMessage args in Task to address Dan's review
1 parent 387d1ba commit 0fdbd39

File tree

10 files changed

+186
-951
lines changed

10 files changed

+186
-951
lines changed

packages/types/src/message.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,6 @@ export const clineMessageSchema = z.object({
226226
isProtected: z.boolean().optional(),
227227
apiProtocol: z.union([z.literal("openai"), z.literal("anthropic")]).optional(),
228228
isAnswered: z.boolean().optional(),
229-
metadata: z
230-
.object({
231-
gpt5: z
232-
.object({
233-
previous_response_id: z.string().optional(),
234-
})
235-
.optional(),
236-
})
237-
.optional(),
238229
})
239230

240231
export type ClineMessage = z.infer<typeof clineMessageSchema>

src/api/index.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,20 @@ export interface SingleCompletionHandler {
4949
}
5050

5151
export interface ApiHandlerCreateMessageMetadata {
52-
mode?: string
53-
taskId: string
54-
previousResponseId?: string
5552
/**
56-
* When true, the provider must NOT fall back to internal continuity state
57-
* (e.g., lastResponseId) if previousResponseId is absent.
58-
* Used to enforce "skip once" after a condense operation.
53+
* Task ID used for tracking and provider-specific features:
54+
* - DeepInfra: Used as prompt_cache_key for caching
55+
* - Roo: Sent as X-Roo-Task-ID header
56+
* - Requesty: Sent as trace_id
57+
* - Unbound: Sent in unbound_metadata
5958
*/
60-
suppressPreviousResponseId?: boolean
59+
taskId: string
6160
/**
62-
* Controls whether the response should be stored for 30 days in OpenAI's Responses API.
63-
* When true (default), responses are stored and can be referenced in future requests
64-
* using the previous_response_id for efficient conversation continuity.
65-
* Set to false to opt out of response storage for privacy or compliance reasons.
66-
* @default true
61+
* Current mode slug for provider-specific tracking:
62+
* - Requesty: Sent in extra metadata
63+
* - Unbound: Sent in unbound_metadata
6764
*/
68-
store?: boolean
65+
mode?: string
6966
}
7067

7168
export interface ApiHandler {

0 commit comments

Comments
 (0)