Skip to content

Commit 233cf27

Browse files
committed
fix(provider): omit reasoning id when store is false for third-party API compatibility
When using third-party OpenAI-compatible APIs with store: false, the reasoning object should not include the id field. Third-party APIs don't support OpenAI's item_reference mechanism, causing 'Item with id rs_... not found' errors on subsequent requests. This fix: - Makes the id field optional in OpenAIResponsesReasoning type - Omits the id field when store is false in convertToOpenAIResponsesInput Fixes anomalyco#2941, anomalyco#4426, anomalyco#4445
1 parent 94dca30 commit 233cf27

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎packages/opencode/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,10 @@ export async function convertToOpenAIResponsesInput({
224224
}
225225

226226
if (reasoningMessage === undefined) {
227+
// When store is false, don't include the id field as third-party APIs
228+
// don't support OpenAI's item_reference mechanism
227229
reasoningMessages[reasoningId] = {
228230
type: "reasoning",
229-
id: reasoningId,
230231
encrypted_content: providerOptions?.reasoningEncryptedContent,
231232
summary: summaryParts,
232233
}

‎packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export type OpenAIResponsesTool =
198198

199199
export type OpenAIResponsesReasoning = {
200200
type: "reasoning"
201-
id: string
201+
id?: string // Optional: omit when store is false for third-party API compatibility
202202
encrypted_content?: string | null
203203
summary: Array<{
204204
type: "summary_text"

0 commit comments

Comments
 (0)