Skip to content

Commit 8739645

Browse files
committed
test(codex): pin native-first tool catalog
1 parent 6eb5ce5 commit 8739645

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

extensions/codex/src/app-server/run-attempt.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,46 @@ describe("runCodexAppServerAttempt", () => {
368368
).toEqual(["read", "exec", "message"]);
369369
});
370370

371+
it("starts Codex threads without duplicate OpenClaw workspace tools by default", async () => {
372+
const sessionFile = path.join(tempDir, "session.jsonl");
373+
const workspaceDir = path.join(tempDir, "workspace");
374+
const harness = createStartedThreadHarness();
375+
const params = {
376+
...createParams(sessionFile, workspaceDir),
377+
disableTools: false,
378+
provider: "openai",
379+
modelId: "gpt-5.5",
380+
model: createCodexTestModel("openai"),
381+
agentDir: tempDir,
382+
senderIsOwner: true,
383+
} as EmbeddedRunAttemptParams;
384+
385+
const run = runCodexAppServerAttempt(params);
386+
await harness.waitForMethod("turn/start");
387+
await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
388+
await run;
389+
390+
const startRequest = harness.requests.find((request) => request.method === "thread/start");
391+
const dynamicToolNames = (
392+
(startRequest?.params as { dynamicTools?: Array<{ name: string }> } | undefined)
393+
?.dynamicTools ?? []
394+
).map((tool) => tool.name);
395+
396+
expect(dynamicToolNames).toContain("message");
397+
expect(dynamicToolNames).toContain("web_search");
398+
expect(dynamicToolNames).not.toEqual(
399+
expect.arrayContaining([
400+
"read",
401+
"write",
402+
"edit",
403+
"apply_patch",
404+
"exec",
405+
"process",
406+
"update_plan",
407+
]),
408+
);
409+
});
410+
371411
it("returns a failed dynamic tool response when an app-server tool call exceeds the deadline", async () => {
372412
vi.useFakeTimers();
373413
let capturedSignal: AbortSignal | undefined;

extensions/codex/src/app-server/thread-lifecycle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ function stabilizeJsonValue(value: JsonValue): JsonValue {
222222
export function buildDeveloperInstructions(params: EmbeddedRunAttemptParams): string {
223223
const promptOverlay = renderCodexRuntimePromptOverlay(params);
224224
const sections = [
225-
"You are running inside OpenClaw. Use OpenClaw dynamic tools for messaging, cron, sessions, and host actions when available.",
225+
"You are running inside OpenClaw. Use OpenClaw dynamic tools for OpenClaw-specific integrations such as messaging, cron, sessions, media, gateway, and nodes when available.",
226226
"Preserve the user's existing channel/session context. If sending a channel reply, use the OpenClaw messaging tool instead of describing that you would reply.",
227227
promptOverlay,
228228
params.extraSystemPrompt,

0 commit comments

Comments
 (0)