From 8a8525bf4e45705e90075b2980527695a1ebbade Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Mon, 9 Nov 2026 01:10:49 -0800 Subject: [PATCH] fix(server): Codex /goal no longer tries to create the goal twice T3 sets the goal, then starts the first goal turn with a user message. "Start working toward this goal: X" read as a request to create a goal, so the model called create_goal and Codex rejected it. The message now says the goal is already set. Co-Authored-By: Claude Opus 5.5 --- .../src/orchestration-v2/Adapters/CodexAdapterV2.test.ts | 4 ++-- apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts index c9b9218ca1f27..55a1e66ee7254 100644 --- a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts @@ -8700,7 +8700,7 @@ describe("CodexAdapterV2 post-settle continuation", () => { nativeThreadId, nativeTurnId: "goal-turn-1", prompt: objective, - sentPrompt: `Start working toward this goal: ${objective}`, + sentPrompt: `This thread's goal is already set. Do not call create_goal. Start working on it now: ${objective}`, }).slice(5), 5, ), @@ -8840,7 +8840,7 @@ describe("CodexAdapterV2 post-settle continuation", () => { nativeThreadId, nativeTurnId: "goal-turn-limit", prompt: atLimit, - sentPrompt: `Start working toward this goal: ${atLimit}`, + sentPrompt: `This thread's goal is already set. Do not call create_goal. Start working on it now: ${atLimit}`, }).slice(5), 5, ), diff --git a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts index 831b240d8bba2..997547cdb3309 100644 --- a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts +++ b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts @@ -6976,7 +6976,8 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* ( const activation = { stopped: false }; goalActivations.set(threadId, activation); yield* Effect.gen(function* () { - // A bare objective reads like a statement, so the model echoes it back. + // A bare objective gets echoed back, and "start this goal" gets a + // create_goal call that Codex rejects because the goal already exists. yield* startNativeTurn( turnInput, command.type === "set" @@ -6984,7 +6985,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* ( ...turnInput, message: { ...turnInput.message, - text: `Start working toward this goal: ${command.objective}`, + text: `This thread's goal is already set. Do not call create_goal. Start working on it now: ${command.objective}`, }, }) : [],