{"record":{"id":"922bc3166c71ad9a","repo":"can1357/oh-my-pi","slug":"cache-is-not-supported-for-openai-codex-response","errorCode":null,"errorMessage":"--cache is not supported for openai-codex-responses because Codex WebSocket chaining cannot produce independent prompt-cache pairs","messagePattern":"--cache is not supported for openai-codex-responses because Codex WebSocket chaining cannot produce independent prompt-cache pairs","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/bench-cli.ts","lineNumber":846,"sourceCode":"\t\t\t\t.trimEnd(),\n\t\t),\n\t];\n\tlet winnerMarked = false;\n\tfor (const row of rows) {\n\t\tconst cells = row.cells.map((cell, i) => cell.padEnd(widths[i]!));\n\t\tif (!winnerMarked && row.hasStats) {\n\t\t\tcells[0] = chalk.green(cells[0]!);\n\t\t\twinnerMarked = true;\n\t\t}\n\t\tconst failedSuffix = row.failed > 0 ? `  ${chalk.red(`(${row.failed} failed)`)}` : \"\";\n\t\tlines.push(cells.join(\"  \").trimEnd() + failedSuffix);\n\t}\n\treturn `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction assertCacheModeSupported(targets: BenchTarget[]): void {\n\tif (targets.some(({ model }) => model.api === \"openai-codex-responses\")) {\n\t\tthrow new Error(\n\t\t\t\"--cache is not supported for openai-codex-responses because Codex WebSocket chaining cannot produce independent prompt-cache pairs\",\n\t\t);\n\t}\n}\n\nexport async function runBenchCommand(command: BenchCommandArgs, deps: BenchDependencies = {}): Promise<BenchSummary> {\n\tconst cacheMode = command.flags.cache === true;\n\tconst cacheFlagsUsed =\n\t\tcommand.flags.cachePrefixFile !== undefined ||\n\t\tcommand.flags.cachePrefixBytes !== undefined ||\n\t\tcommand.flags.cachePairs !== undefined ||\n\t\tcommand.flags.cacheConcurrency !== undefined;\n\tif (!cacheMode && cacheFlagsUsed) throw new Error(\"Cache flags require --cache\");\n\tif (cacheMode && command.flags.runs !== undefined)\n\t\tthrow new Error(\"Use --cache-pairs instead of --runs with --cache\");\n\tif (cacheMode && command.flags.prompt !== undefined) throw new Error(\"--cache builds its own stable-prefix prompts\");\n\tif (cacheMode && command.flags.profile !== undefined) throw new Error(\"--profile cannot be combined with --cache\");\n\tif (cacheMode && (command.flags.par ?? 1) > 1) {","sourceCodeStart":828,"sourceCodeEnd":864,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/bench-cli.ts#L828-L864","documentation":"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.","triggerScenarios":"Running `omp bench --cache` with a target model whose `model.api` is \"openai-codex-responses\".","commonSituations":"Benchmarking GPT-5-Codex/Codex-line models with --cache; CI scripts that apply --cache uniformly across all target models.","solutions":["Drop --cache for codex targets and benchmark them in normal mode.","Filter the target model list to exclude openai-codex-responses models when --cache is set.","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."],"exampleFix":"// before\nomp bench --cache --model gpt-5.2-codex\n// after\nomp bench --model gpt-5.2-codex","handlingStrategy":"validation","validationCode":"if (flags.cache && targets.some(t => t.model.api === \"openai-codex-responses\")) {\n  console.error(\"--cache unsupported for codex targets; dropping --cache\");\n  delete flags.cache;\n}","typeGuard":"function supportsCachePairs(api: string): boolean {\n  return api !== \"openai-codex-responses\";\n}","tryCatchPattern":"try {\n  await runBenchCommand(command);\n} catch (err) {\n  if (String(err).includes(\"--cache is not supported\")) {\n    console.error(\"Re-run without --cache for codex models\");\n  }\n  process.exitCode = 1;\n}","preventionTips":["Filter benchmark target lists by API before applying --cache","Keep CI bench matrices split: codex targets without --cache","Check model.api when scripting bench invocations"],"tags":["benchmark","prompt-cache","codex","unsupported-feature"],"backgroundTag":"flag-model-incompatible","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}