Skip to content

Commit e5c2f55

Browse files
Merge pull request #527 from corbitsdev/cl-6695-retarget-the-codex-developer-bridge-for-proxy-tools
Retarget Codex developer bridge for proxy tools
2 parents c3a5db3 + e3a91f7 commit e5c2f55

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

src/provider/codex-responses-adapter.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, expect, test } from "bun:test";
22
import type { ConversationTurn, LastCycleSource } from "@intx/types/runtime";
3+
import { PRODUCT_NAME } from "../branding.js";
34
import {
45
createCodexResponsesAdapter,
56
isResponsesStreamTerminal,
@@ -60,6 +61,29 @@ describe("createCodexResponsesAdapter", () => {
6061
const adapter = createCodexResponsesAdapter(source);
6162
expect(adapter.isStreamTerminal).toBe(isResponsesStreamTerminal);
6263
});
64+
65+
test("bridge message points at Codex tool proxies instead of neutralizing them", () => {
66+
const adapter = createCodexResponsesAdapter(source);
67+
const turns: ConversationTurn[] = [
68+
{ role: "user", timestamp: 0, content: [{ type: "text", text: "hi" }] },
69+
];
70+
71+
const request = adapter.buildRequest(turns, "gpt-5.1-codex", {
72+
systemPrompt: "operating prompt body",
73+
});
74+
const body = JSON.parse(request.body) as {
75+
input: { role?: string; content?: { text?: string }[] }[];
76+
};
77+
const bridgeText = body.input[0]?.content?.[0]?.text ?? "";
78+
79+
expect(bridgeText).toContain(`${PRODUCT_NAME} is the harness, not the Codex CLI.`);
80+
expect(bridgeText).toContain("apply_patch, update_plan, shell");
81+
expect(bridgeText).toContain("proxy onto");
82+
expect(bridgeText).toContain("prefer whichever name appears in the current tool list");
83+
expect(bridgeText).toContain("operating prompt body");
84+
expect(bridgeText).not.toContain("DO NOT EXIST");
85+
expect(bridgeText).not.toContain("Ignore every tool reference");
86+
});
6387
});
6488

6589
describe("createCodexResponsesAdapter usage parsing", () => {

src/provider/codex-responses-adapter.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,12 @@ function optionString(options: InferenceOptions, key: string): string | undefine
273273

274274
// `instructions` is pinned to the official Codex prompt (the backend rejects
275275
// anything else), so Corbits Code's operating prompt rides as a leading developer
276-
// message that also neutralizes the Codex prompt's references to tools that do
277-
// not exist here. The function tools sent with the request are authoritative.
276+
// message that also reconciles the Codex prompt's tool references with the
277+
// proxies actually wired up here. The function tools sent with the request are
278+
// authoritative for names/schemas; this text only resolves which dialect to speak.
278279
function bridgeMessage(systemPrompt: string): ResponsesInputItem {
279280
const text = `<${ENVIRONMENT_TAG_NAME} priority="0">
280-
You are NOT running in the Codex CLI. You are running in ${PRODUCT_NAME}, a different harness. The base instructions above describe Codex CLI tools (apply_patch, update_plan, shell) that DO NOT EXIST here. Ignore every tool reference in the base instructions and use ONLY the function tools provided in this request. The following are your authoritative operating instructions:
281+
${PRODUCT_NAME} is the harness, not the Codex CLI. The Codex tools named above (apply_patch, update_plan, shell) proxy onto ${PRODUCT_NAME}'s native tools with the same permissions — prefer whichever name appears in the current tool list. These operating instructions are authoritative where they differ from the base instructions:
281282
282283
${systemPrompt}
283284
</${ENVIRONMENT_TAG_NAME}>`;

0 commit comments

Comments
 (0)