can1357/oh-my-pi · error

--cache is not supported for openai-codex-responses because

Error message

--cache is not supported for openai-codex-responses because Codex WebSocket chaining cannot produce independent prompt-cache pairs

What it means

The bench --cache mode measures prompt-cache hit rates by sending independent cold/warm prompt pairs. Codex's openai-codex-responses API chains requests over a WebSocket where each call depends on the previous one, so independent cache pairs cannot be constructed. assertCacheModeSupported throws to prevent meaningless cache benchmarks for that API.

Source

Thrown at packages/coding-agent/src/cli/bench-cli.ts:846

				.trimEnd(),
		),
	];
	let winnerMarked = false;
	for (const row of rows) {
		const cells = row.cells.map((cell, i) => cell.padEnd(widths[i]!));
		if (!winnerMarked && row.hasStats) {
			cells[0] = chalk.green(cells[0]!);
			winnerMarked = true;
		}
		const failedSuffix = row.failed > 0 ? `  ${chalk.red(`(${row.failed} failed)`)}` : "";
		lines.push(cells.join("  ").trimEnd() + failedSuffix);
	}
	return `${lines.join("\n")}\n`;
}

function assertCacheModeSupported(targets: BenchTarget[]): void {
	if (targets.some(({ model }) => model.api === "openai-codex-responses")) {
		throw new Error(
			"--cache is not supported for openai-codex-responses because Codex WebSocket chaining cannot produce independent prompt-cache pairs",
		);
	}
}

export async function runBenchCommand(command: BenchCommandArgs, deps: BenchDependencies = {}): Promise<BenchSummary> {
	const cacheMode = command.flags.cache === true;
	const cacheFlagsUsed =
		command.flags.cachePrefixFile !== undefined ||
		command.flags.cachePrefixBytes !== undefined ||
		command.flags.cachePairs !== undefined ||
		command.flags.cacheConcurrency !== undefined;
	if (!cacheMode && cacheFlagsUsed) throw new Error("Cache flags require --cache");
	if (cacheMode && command.flags.runs !== undefined)
		throw new Error("Use --cache-pairs instead of --runs with --cache");
	if (cacheMode && command.flags.prompt !== undefined) throw new Error("--cache builds its own stable-prefix prompts");
	if (cacheMode && command.flags.profile !== undefined) throw new Error("--profile cannot be combined with --cache");
	if (cacheMode && (command.flags.par ?? 1) > 1) {

View on GitHub (pinned to 9690622007)

Solutions

  1. Drop --cache for codex targets and benchmark them in normal mode.
  2. Filter the target model list to exclude openai-codex-responses models when --cache is set.
  3. If Codex adds independent-request support upstream, this assertion can be revisited — for now pick a Responses-HTTP or Chat API model for cache tests.

Example fix

// before
omp bench --cache --model gpt-5.2-codex
// after
omp bench --model gpt-5.2-codex
Defensive patterns

Strategy: validation

Validate before calling

if (flags.cache && targets.some(t => t.model.api === "openai-codex-responses")) {
  console.error("--cache unsupported for codex targets; dropping --cache");
  delete flags.cache;
}

Type guard

function supportsCachePairs(api: string): boolean {
  return api !== "openai-codex-responses";
}

Try / catch

try {
  await runBenchCommand(command);
} catch (err) {
  if (String(err).includes("--cache is not supported")) {
    console.error("Re-run without --cache for codex models");
  }
  process.exitCode = 1;
}

Prevention

When it happens

Trigger: Running `omp bench --cache` with a target model whose `model.api` is "openai-codex-responses".

Common situations: Benchmarking GPT-5-Codex/Codex-line models with --cache; CI scripts that apply --cache uniformly across all target models.

Related errors


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