{"record":{"id":"55b5465660011424","repo":"can1357/oh-my-pi","slug":"model-model-id-does-not-support-v2-streaming-co","errorCode":null,"errorMessage":"Model ${model.id} does not support V2 streaming compaction","messagePattern":"Model (.+?) does not support V2 streaming compaction","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/compaction/compaction-v2-streaming.ts","lineNumber":247,"sourceCode":"\n/** Request V2 compaction over the normal OpenAI Responses streaming endpoint. */\nexport async function requestCompactionV2Streaming(\n\tmodel: Model,\n\tapiKey: string,\n\trequest: CompactionV2Request,\n\tsignal?: AbortSignal,\n\toptions?: {\n\t\tfetch?: FetchImpl;\n\t\ttimeoutMs?: number;\n\t\tretryWait?: (delayMs: number, signal?: AbortSignal) => Promise<void>;\n\t\tproviderSessionState?: Map<string, ProviderSessionState>;\n\t\tcodexCompaction?: CodexCompactionContext;\n\t\tpreferWebsockets?: boolean;\n\t},\n): Promise<CompactionV2Response> {\n\tconst endpoint = getCompactionV2Endpoint(model);\n\tif (!endpoint) {\n\t\tthrow new Error(`Model ${model.id} does not support V2 streaming compaction`);\n\t}\n\n\tconst fetchImpl = options?.fetch ?? globalThis.fetch;\n\tconst retryWait = options?.retryWait ?? ((delayMs: number) => Bun.sleep(delayMs));\n\tconst isCodexResponses = compactionV2Api(model) === \"openai-codex-responses\" || model.provider === \"openai-codex\";\n\tconst codexMetadata =\n\t\tisCodexResponses && !shouldUseCodexProviderTransport(model)\n\t\t\t? createOpenAICodexCompatibilityMetadata({\n\t\t\t\t\tsessionId: request.sessionId,\n\t\t\t\t\tproviderSessionState: options?.providerSessionState,\n\t\t\t\t\trequestKind: \"compaction\",\n\t\t\t\t\tcompaction: createOpenAICodexCompactionRequestContext({\n\t\t\t\t\t\tcontext: options?.codexCompaction,\n\t\t\t\t\t\timplementation: \"responses_compaction_v2\",\n\t\t\t\t\t}),\n\t\t\t\t})\n\t\t\t: undefined;\n\tlet lastError: Error | undefined;","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/agent/src/compaction/compaction-v2-streaming.ts#L229-L265","documentation":"requestCompactionV2Streaming throws when getCompactionV2Endpoint(model) returns no endpoint, meaning the given model is not registered for remote V2 streaming compaction (wrong API type / provider). Only models whose compaction API resolves to a V2 endpoint can use this path.","triggerScenarios":"Calling requestCompactionV2Streaming with a Model whose id/provider/api does not map to a V2 compaction endpoint — e.g. a plain chat-completions model, a non-OpenAI provider, or a model id that compactionV2Api() does not recognize.","commonSituations":"Switching the session to a new model that lacks V2 compaction support while compaction config still requests V2; typos in model ids; using a custom/proxy provider without registering the compaction endpoint; version mismatch where the model catalog predates V2 support.","solutions":["Use a model that supports V2 streaming compaction (check compactionV2Api/getCompactionV2Endpoint for the model's provider/id)","Fall back to local/V1 compaction for unsupported models instead of forcing the V2 streaming path","If this is your provider, register the V2 compaction endpoint mapping for the model id/api type","Verify the model id spelling and that the model resolves through the catalog as an OpenAI Responses/Codex-family model"],"exampleFix":"// before\nawait requestCompactionV2Streaming({ model: gpt4oChatModel, ... }); // unsupported\n// after\nif (getCompactionV2Endpoint(model)) {\n  await requestCompactionV2Streaming({ model, ... });\n} else {\n  await compactLocally(session); // fallback\n}","handlingStrategy":"fallback","validationCode":"import { getCompactionV2Endpoint } from \".../compaction-v2-streaming\";\nif (!getCompactionV2Endpoint(model)) {\n  // route to local/V1 compaction instead\n}","typeGuard":"function supportsV2Compaction(model: Model): boolean {\n  return getCompactionV2Endpoint(model) !== undefined;\n}","tryCatchPattern":null,"preventionTips":["Feature-check the model with getCompactionV2Endpoint before choosing V2 streaming compaction","Keep the model catalog current so newly supported ids are recognized","Maintain a local compaction fallback for unsupported models"],"tags":["compaction","unsupported-model","openai","feature-support"],"backgroundTag":"unsupported-model-feature","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}