Merge pull request #518 from diegosouzapw/fix/issue-517-515-prompt-cache-key-tagcontent

fix: preserve prompt_cache_key in Responses API, escape \n in tagContent (#517, #515)
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-03-21 17:32:24 -03:00
committed by GitHub
3 changed files with 5 additions and 3 deletions

View File

@@ -472,7 +472,7 @@ export async function handleComboChat({
// SDKs close the connection on finish_reason, so anything sent after
// that marker is silently dropped.
if (!res.body) return res;
const tagContent = `\n<omniModel>${modelStr}</omniModel>\n`;
const tagContent = `\\n<omniModel>${modelStr}</omniModel>\\n`;
const encoder = new TextEncoder();
const decoder = new TextDecoder();
let tagInjected = false;

View File

@@ -93,10 +93,11 @@ export function convertResponsesApiFormat(body) {
}
// Cleanup Responses API specific fields
// Note: prompt_cache_key is intentionally preserved — it is used by Codex and other
// providers as a cache-affinity signal. Stripping it breaks prompt caching (#517).
delete result.input;
delete result.instructions;
delete result.include;
delete result.prompt_cache_key;
delete result.store;
delete result.reasoning;

View File

@@ -227,10 +227,11 @@ export function openaiResponsesToOpenAIRequest(
});
// Cleanup Responses API specific fields
// Note: prompt_cache_key is intentionally preserved — it is used by Codex and other
// providers as a cache-affinity signal. Stripping it breaks prompt caching (#517).
delete result.input;
delete result.instructions;
delete result.include;
delete result.prompt_cache_key;
delete result.store;
delete result.reasoning;