@devries-cameron20 / t3code-1 / commits / 551aebc604
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Add default collaboration mode preset for Codex turn starts

- Send `collaborationMode` for both `default` and `plan` interactions - Add default-mode developer instructions and preserve plan-mode behavior - Update server/web tests for default collaboration mode and model constant usage

Julius Marminge committed Mar 5, 2026 at 22:43 UTC 551aebc6046f23eabcf0ea6dddab73619b83b2da
3 files changed +60 -7
apps/server/src/codexAppServerManager.test.ts
+31
@@ -7,6 +7,7 @@ import { ApprovalRequestId, ThreadId } from "@t3tools/contracts";
7
8 import {
9 buildCodexInitializeParams,
10 + CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS,
11 CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS,
12 CodexAppServerManager,
13 classifyCodexStderrLine,
@@ -346,6 +347,36 @@ describe("sendTurn", () => {
347 });
348 });
349
350 + it("passes Codex default mode as a collaboration preset on turn/start", async () => {
351 + const { manager, context, sendRequest } = createSendTurnHarness();
352 +
353 + await manager.sendTurn({
354 + threadId: asThreadId("thread_1"),
355 + input: "PLEASE IMPLEMENT THIS PLAN:\n- step 1",
356 + interactionMode: "default",
357 + });
358 +
359 + expect(sendRequest).toHaveBeenCalledWith(context, "turn/start", {
360 + threadId: "thread_1",
361 + input: [
362 + {
363 + type: "text",
364 + text: "PLEASE IMPLEMENT THIS PLAN:\n- step 1",
365 + text_elements: [],
366 + },
367 + ],
368 + model: "gpt-5.3-codex",
369 + collaborationMode: {
370 + mode: "default",
371 + settings: {
372 + model: "gpt-5.3-codex",
373 + reasoning_effort: "medium",
374 + developer_instructions: CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS,
375 + },
376 + },
377 + });
378 + });
379 +
380 it("rejects empty turn input", async () => {
381 const { manager } = createSendTurnHarness();
382
apps/server/src/codexAppServerManager.ts
+21 -5
@@ -257,6 +257,19 @@ Do not ask "should I proceed?" in the final output. The user can easily switch o
257 Only produce at most one \`<proposed_plan>\` block per turn, and only when you are presenting a complete spec.
258 </collaboration_mode>`;
259
260 +export const CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS = `<collaboration_mode># Collaboration Mode: Default
261 +
262 +You are now in Default mode. Any previous instructions for other modes (e.g. Plan mode) are no longer active.
263 +
264 +Your active mode changes only when new developer instructions with a different \`<collaboration_mode>...</collaboration_mode>\` change it; user requests or tool descriptions do not change mode by themselves. Known mode names are Default and Plan.
265 +
266 +## request_user_input availability
267 +
268 +The \`request_user_input\` tool is unavailable in Default mode. If you call it while in Default mode, it will return an error.
269 +
270 +In Default mode, strongly prefer making reasonable assumptions and executing the user's request rather than stopping to ask questions. If you absolutely must ask a question because the answer cannot be discovered from local context and a reasonable assumption would be risky, ask the user directly with a concise plain-text question. Never write a multiple choice question as a textual assistant message.
271 +</collaboration_mode>`;
272 +
273 function mapCodexRuntimeMode(runtimeMode: RuntimeMode): {
274 readonly approvalPolicy: "on-request" | "never";
275 readonly sandbox: "workspace-write" | "danger-full-access";
@@ -326,7 +339,7 @@ function buildCodexCollaborationMode(input: {
339 readonly effort?: string;
340 }):
341 | {
329 - mode: "plan";
342 + mode: "default" | "plan";
343 settings: {
344 model: string;
345 reasoning_effort: string;
@@ -334,16 +347,19 @@ function buildCodexCollaborationMode(input: {
347 };
348 }
349 | undefined {
337 - if (input.interactionMode !== "plan") {
350 + if (input.interactionMode === undefined) {
351 return undefined;
352 }
353 const model = normalizeCodexModelSlug(input.model) ?? "gpt-5.3-codex";
354 return {
342 - mode: "plan",
355 + mode: input.interactionMode,
356 settings: {
357 model,
358 reasoning_effort: input.effort ?? "medium",
346 - developer_instructions: CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS,
359 + developer_instructions:
360 + input.interactionMode === "plan"
361 + ? CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS
362 + : CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS,
363 },
364 };
365 }
@@ -644,7 +660,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
660 effort?: string;
661 serviceTier?: string;
662 collaborationMode?: {
647 - mode: "plan";
663 + mode: "default" | "plan";
664 settings: {
665 model: string;
666 reasoning_effort: string;
apps/web/src/store.test.ts
+8 -2
@@ -1,4 +1,10 @@
1 -import { ProjectId, ThreadId, TurnId, type OrchestrationReadModel } from "@t3tools/contracts";
1 +import {
2 + DEFAULT_MODEL_BY_PROVIDER,
3 + ProjectId,
4 + ThreadId,
5 + TurnId,
6 + type OrchestrationReadModel,
7 +} from "@t3tools/contracts";
8 import { describe, expect, it } from "vitest";
9
10 import { markThreadUnread, syncServerReadModel, type AppState } from "./store";
@@ -139,6 +145,6 @@ describe("store read model sync", () => {
145
146 const next = syncServerReadModel(initialState, readModel);
147
142 - expect(next.threads[0]?.model).toBe("gpt-5.3-codex");
148 + expect(next.threads[0]?.model).toBe(DEFAULT_MODEL_BY_PROVIDER.codex);
149 });
150 });