TypeScript
test(server): exercise Codex prompts through public assembly (#10045)
Julius Marmingedf370c31d26a
diff --git a/apps/server/src/provider/CodexDeveloperInstructions.ts b/apps/server/src/provider/CodexDeveloperInstructions.tsindex 2bb9647bd41..1c2439a9ad9 100644--- a/apps/server/src/provider/CodexDeveloperInstructions.ts+++ b/apps/server/src/provider/CodexDeveloperInstructions.ts@@ -22,7 +22,7 @@ Do not switch to global browser skills, Chrome, Node REPL browser automation, stconst browserToolInstructions = (browserToolsAvailable: boolean): string =>browserToolsAvailable ? T3_CODE_BROWSER_TOOL_INSTRUCTIONS : "";-export const codexPlanModeDeveloperInstructions = (+const codexPlanModeDeveloperInstructions = (browserToolsAvailable: boolean,): string => `<collaboration_mode># Plan Mode (Conversational)@@ -155,7 +155,7 @@ If the user stays in Plan mode and asks for revisions after a prior \`<proposed_${browserToolInstructions(browserToolsAvailable)}</collaboration_mode>`;-export const codexDefaultModeDeveloperInstructions = (+const codexDefaultModeDeveloperInstructions = (browserToolsAvailable: boolean,): string => `<collaboration_mode># Collaboration Mode: Defaultdiff --git a/apps/server/src/provider/Layers/CodexSessionRuntime.test.ts b/apps/server/src/provider/Layers/CodexSessionRuntime.test.tsindex fd4d66dd497..0136c3fbf17 100644--- a/apps/server/src/provider/Layers/CodexSessionRuntime.test.ts+++ b/apps/server/src/provider/Layers/CodexSessionRuntime.test.ts@@ -9,11 +9,7 @@ import * as CodexErrors from "effect-codex-app-server/errors";import * as CodexRpc from "effect-codex-app-server/rpc";import * as EffectCodexSchema from "effect-codex-app-server/schema";-import {- buildCodexDeveloperInstructions,- codexDefaultModeDeveloperInstructions,- codexPlanModeDeveloperInstructions,-} from "../CodexDeveloperInstructions.ts";+import { buildCodexDeveloperInstructions } from "../CodexDeveloperInstructions.ts";import { codexSessionAppServerArgs } from "./codexLaunchArgs.ts";import {buildTurnStartParams,@@ -459,7 +455,7 @@ describe("buildCodexDeveloperInstructions", () => {reasoningEffort: "high",});- NodeAssert.ok(instructions.startsWith(codexDefaultModeDeveloperInstructions(true)));+ NodeAssert.match(instructions, /^<collaboration_mode># Collaboration Mode: Default/);NodeAssert.match(instructions, /T3 Code/);NodeAssert.match(instructions, /Codex harness/);NodeAssert.match(instructions, /as gpt-5\.3-codex with high reasoning effort/);@@ -484,7 +480,7 @@ describe("buildCodexDeveloperInstructions", () => {reasoningEffort: "medium",});- NodeAssert.ok(instructions.startsWith(codexPlanModeDeveloperInstructions(true)));+ NodeAssert.match(instructions, /^<collaboration_mode># Plan Mode/);NodeAssert.match(instructions, /as gpt-5\.3-codex with medium reasoning effort/);});@@ -513,11 +509,11 @@ describe("buildCodexDeveloperInstructions", () => {});describe("T3 browser developer instructions", () => {+ const runtime = { model: "gpt-5.3-codex", reasoningEffort: "high" };+it("prefers the product-native preview tools in both collaboration modes", () => {- for (const instructions of [- codexDefaultModeDeveloperInstructions(true),- codexPlanModeDeveloperInstructions(true),- ]) {+ for (const mode of ["default", "plan"] as const) {+ const instructions = buildCodexDeveloperInstructions(mode, runtime, true);NodeAssert.match(instructions, /t3-code/);NodeAssert.match(instructions, /preview_status/);NodeAssert.match(instructions, /preview_open/);@@ -526,10 +522,8 @@ describe("T3 browser developer instructions", () => {});it("omits the browser block entirely when the preview tools are not attached", () => {- for (const instructions of [- codexDefaultModeDeveloperInstructions(false),- codexPlanModeDeveloperInstructions(false),- ]) {+ for (const mode of ["default", "plan"] as const) {+ const instructions = buildCodexDeveloperInstructions(mode, runtime, false);NodeAssert.doesNotMatch(instructions, /preview_status/);NodeAssert.doesNotMatch(instructions, /preview_open/);NodeAssert.doesNotMatch(instructions, /T3 Code collaborative browser/);@@ -543,7 +537,6 @@ describe("T3 browser developer instructions", () => {});it("tracks the turn's MCP configuration rather than defaulting to on", () => {- const runtime = { model: "gpt-5.3-codex", reasoningEffort: "high" };NodeAssert.match(buildCodexDeveloperInstructions("default", runtime, true), /preview_open/);NodeAssert.doesNotMatch(buildCodexDeveloperInstructions("default", runtime, false),