fix(translator): preserve developer instructions in openai-responses conversion (#2434)

Map role="developer" messages to top-level instructions alongside
role="system" in openaiToOpenAIResponsesRequest. Previously developer
messages matched no branch and were silently dropped from the Responses
request, losing GPT-5/Codex system-level prompts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
deranalabs
2026-07-07 11:54:07 +07:00
committed by decolua
co-authored by Cursor
parent bf7da67859
commit a3cd7c82bc
2 changed files with 18 additions and 3 deletions
@@ -46,6 +46,20 @@ describe("Codex CLI Responses → OpenAI", () => {
});
describe("OpenAI → Codex Responses (reverse)", () => {
it("maps developer messages to Responses API instructions", () => {
const out = O2R({
messages: [
{ role: "developer", content: "Follow the project rules." },
{ role: "user", content: "Hello" },
],
});
expect(out.instructions).toBe("Follow the project rules.");
expect(out.input).toEqual([
{ type: "message", role: "user", content: [{ type: "input_text", text: "Hello" }] },
]);
});
// openai-responses.js:13 — clampCallId NOT applied on Responses→Chat; but here Chat→Responses must clamp
it("call_id longer than 64 chars is clamped", () => {
const longId = "call_" + "x".repeat(80);