Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Add default collaboration mode preset for Codex turn starts
Julius Marminge551aebc6046f
diff --git a/apps/server/src/codexAppServerManager.test.ts b/apps/server/src/codexAppServerManager.test.tsindex 58c340202..f2e11ca29 100644--- a/apps/server/src/codexAppServerManager.test.ts+++ b/apps/server/src/codexAppServerManager.test.ts@@ -7,6 +7,7 @@ import { ApprovalRequestId, ThreadId } from "@t3tools/contracts";import {buildCodexInitializeParams,+ CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS,CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS,CodexAppServerManager,classifyCodexStderrLine,@@ -346,6 +347,36 @@ describe("sendTurn", () => {});});+ it("passes Codex default mode as a collaboration preset on turn/start", async () => {+ const { manager, context, sendRequest } = createSendTurnHarness();++ await manager.sendTurn({+ threadId: asThreadId("thread_1"),+ input: "PLEASE IMPLEMENT THIS PLAN:\n- step 1",+ interactionMode: "default",+ });++ expect(sendRequest).toHaveBeenCalledWith(context, "turn/start", {+ threadId: "thread_1",+ input: [+ {+ type: "text",+ text: "PLEASE IMPLEMENT THIS PLAN:\n- step 1",+ text_elements: [],+ },+ ],+ model: "gpt-5.3-codex",+ collaborationMode: {+ mode: "default",+ settings: {+ model: "gpt-5.3-codex",+ reasoning_effort: "medium",+ developer_instructions: CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS,+ },+ },+ });+ });+it("rejects empty turn input", async () => {const { manager } = createSendTurnHarness();diff --git a/apps/server/src/codexAppServerManager.ts b/apps/server/src/codexAppServerManager.tsindex 185851ae1..6e83d211a 100644--- a/apps/server/src/codexAppServerManager.ts+++ b/apps/server/src/codexAppServerManager.ts@@ -257,6 +257,19 @@ Do not ask "should I proceed?" in the final output. The user can easily switch oOnly produce at most one \`<proposed_plan>\` block per turn, and only when you are presenting a complete spec.</collaboration_mode>`;+export const CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS = `<collaboration_mode># Collaboration Mode: Default++You are now in Default mode. Any previous instructions for other modes (e.g. Plan mode) are no longer active.++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.++## request_user_input availability++The \`request_user_input\` tool is unavailable in Default mode. If you call it while in Default mode, it will return an error.++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.+</collaboration_mode>`;+function mapCodexRuntimeMode(runtimeMode: RuntimeMode): {readonly approvalPolicy: "on-request" | "never";readonly sandbox: "workspace-write" | "danger-full-access";@@ -326,7 +339,7 @@ function buildCodexCollaborationMode(input: {readonly effort?: string;}):| {- mode: "plan";+ mode: "default" | "plan";settings: {model: string;reasoning_effort: string;@@ -334,16 +347,19 @@ function buildCodexCollaborationMode(input: {};}| undefined {- if (input.interactionMode !== "plan") {+ if (input.interactionMode === undefined) {return undefined;}const model = normalizeCodexModelSlug(input.model) ?? "gpt-5.3-codex";return {- mode: "plan",+ mode: input.interactionMode,settings: {model,reasoning_effort: input.effort ?? "medium",- developer_instructions: CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS,+ developer_instructions:+ input.interactionMode === "plan"+ ? CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS+ : CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS,},};}@@ -644,7 +660,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEveeffort?: string;serviceTier?: string;collaborationMode?: {- mode: "plan";+ mode: "default" | "plan";settings: {model: string;reasoning_effort: string;diff --git a/apps/web/src/store.test.ts b/apps/web/src/store.test.tsindex 77b913c3d..145d8301e 100644--- a/apps/web/src/store.test.ts+++ b/apps/web/src/store.test.ts@@ -1,4 +1,10 @@-import { ProjectId, ThreadId, TurnId, type OrchestrationReadModel } from "@t3tools/contracts";+import {+ DEFAULT_MODEL_BY_PROVIDER,+ ProjectId,+ ThreadId,+ TurnId,+ type OrchestrationReadModel,+} from "@t3tools/contracts";import { describe, expect, it } from "vitest";import { markThreadUnread, syncServerReadModel, type AppState } from "./store";@@ -139,6 +145,6 @@ describe("store read model sync", () => {const next = syncServerReadModel(initialState, readModel);- expect(next.threads[0]?.model).toBe("gpt-5.3-codex");+ expect(next.threads[0]?.model).toBe(DEFAULT_MODEL_BY_PROVIDER.codex);});});