fix: resolve stream defaults and codex prompt mapping (#1873, #1872)

This commit is contained in:
diegosouzapw
2026-05-02 10:04:23 -03:00
parent f64b209750
commit fe25fdcfdc
3 changed files with 21 additions and 2 deletions

View File

@@ -13,6 +13,8 @@
### 🐛 Bug Fixes
- **fix(gemini-cli):** separate Cloud Code transport from Antigravity (#1869 — thanks @dhaern)
- **fix(codex):** map prompt field to input array for Cursor compatibility (fixes #1872)
- **fix(core):** align stream parameter default to false per strict OpenAI spec (fixes #1873)
### 🏆 Release Attribution & Retroactive Credits

View File

@@ -1198,6 +1198,21 @@ export class CodexExecutor extends BaseExecutor {
})
: [],
}));
} else if (!body.input && typeof body.prompt === "string" && body.prompt.trim()) {
// Issue #1872: Cursor occasionally passes the request as `prompt` instead of `messages`.
body.input = [
{
type: "message",
role: "user",
content: [{ type: "input_text", text: body.prompt }],
},
];
} else if (!body.input && Array.isArray(body.prompt)) {
body.input = body.prompt.map((p: any) => ({
type: "message",
role: "user",
content: [{ type: "input_text", text: typeof p === "string" ? p : JSON.stringify(p) }],
}));
}
// ── Cache-aware system prompt handling (both paths) ──

View File

@@ -22,8 +22,10 @@ export function resolveStreamFlag(bodyStream: unknown, acceptHeader: unknown): b
// Explicit body value always wins
if (bodyStream === true) return true;
if (bodyStream === false) return false;
// No explicit stream param — fall back to Accept header heuristic
return !clientWantsJsonResponse(acceptHeader);
// No explicit stream param — default to false per OpenAI spec
// (Fixes #1873 - previously relied on Accept header heuristic)
return false;
}
/**