can1357/oh-my-pi · error

Model ${model.id} does not support V2 streaming compaction

Error message

Model ${model.id} does not support V2 streaming compaction

What it means

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.

Source

Thrown at packages/agent/src/compaction/compaction-v2-streaming.ts:247

/** Request V2 compaction over the normal OpenAI Responses streaming endpoint. */
export async function requestCompactionV2Streaming(
	model: Model,
	apiKey: string,
	request: CompactionV2Request,
	signal?: AbortSignal,
	options?: {
		fetch?: FetchImpl;
		timeoutMs?: number;
		retryWait?: (delayMs: number, signal?: AbortSignal) => Promise<void>;
		providerSessionState?: Map<string, ProviderSessionState>;
		codexCompaction?: CodexCompactionContext;
		preferWebsockets?: boolean;
	},
): Promise<CompactionV2Response> {
	const endpoint = getCompactionV2Endpoint(model);
	if (!endpoint) {
		throw new Error(`Model ${model.id} does not support V2 streaming compaction`);
	}

	const fetchImpl = options?.fetch ?? globalThis.fetch;
	const retryWait = options?.retryWait ?? ((delayMs: number) => Bun.sleep(delayMs));
	const isCodexResponses = compactionV2Api(model) === "openai-codex-responses" || model.provider === "openai-codex";
	const codexMetadata =
		isCodexResponses && !shouldUseCodexProviderTransport(model)
			? createOpenAICodexCompatibilityMetadata({
					sessionId: request.sessionId,
					providerSessionState: options?.providerSessionState,
					requestKind: "compaction",
					compaction: createOpenAICodexCompactionRequestContext({
						context: options?.codexCompaction,
						implementation: "responses_compaction_v2",
					}),
				})
			: undefined;
	let lastError: Error | undefined;

View on GitHub (pinned to 9690622007)

Solutions

  1. Use a model that supports V2 streaming compaction (check compactionV2Api/getCompactionV2Endpoint for the model's provider/id)
  2. Fall back to local/V1 compaction for unsupported models instead of forcing the V2 streaming path
  3. If this is your provider, register the V2 compaction endpoint mapping for the model id/api type
  4. Verify the model id spelling and that the model resolves through the catalog as an OpenAI Responses/Codex-family model

Example fix

// before
await requestCompactionV2Streaming({ model: gpt4oChatModel, ... }); // unsupported
// after
if (getCompactionV2Endpoint(model)) {
  await requestCompactionV2Streaming({ model, ... });
} else {
  await compactLocally(session); // fallback
}
Defensive patterns

Strategy: fallback

Validate before calling

import { getCompactionV2Endpoint } from ".../compaction-v2-streaming";
if (!getCompactionV2Endpoint(model)) {
  // route to local/V1 compaction instead
}

Type guard

function supportsV2Compaction(model: Model): boolean {
  return getCompactionV2Endpoint(model) !== undefined;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/55b5465660011424. Report an issue: GitHub.