@devries-cameron20 / t3code Mirror · read-only / commits / fbd77420f2
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 20:15 UTC

feat: add "Auto" runtime mode — AI-reviewed approvals for Codex and Claude (#4272)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Theo Browne committed Jul 23, 2026 at 02:06 UTC fbd77420f27c1322d49726dd927861b8b5903494
9 files changed +79 -2
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+4 -1
@@ -582,10 +582,13 @@ export function NewTaskDraftScreen(props: {
582 ? "Approve actions"
583 : flow.runtimeMode === "auto-accept-edits"
584 ? "Auto-accept edits"
585 - : "Full access",
585 + : flow.runtimeMode === "auto"
586 + ? "Auto"
587 + : "Full access",
588 subactions: [
589 { id: "options:runtime:approval-required", title: "Approve actions" },
590 { id: "options:runtime:auto-accept-edits", title: "Auto-accept edits" },
591 + { id: "options:runtime:auto", title: "Auto" },
592 { id: "options:runtime:full-access", title: "Full access" },
593 ].map((option) => {
594 const value = option.id.replace("options:runtime:", "");
apps/mobile/src/features/threads/ThreadComposer.tsx
+4 -1
@@ -638,10 +638,13 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
638 ? "Approve actions"
639 : currentRuntimeMode === "auto-accept-edits"
640 ? "Auto-accept edits"
641 - : "Full access",
641 + : currentRuntimeMode === "auto"
642 + ? "Auto"
643 + : "Full access",
644 subactions: [
645 { id: "options:runtime:approval-required", title: "Approve actions" },
646 { id: "options:runtime:auto-accept-edits", title: "Auto-accept edits" },
647 + { id: "options:runtime:auto", title: "Auto" },
648 { id: "options:runtime:full-access", title: "Full access" },
649 ].map((option) => {
650 const value = option.id.replace("options:runtime:", "");
apps/server/src/provider/Layers/ClaudeAdapter.test.ts
+19
@@ -356,6 +356,25 @@ describe("ClaudeAdapterLive", () => {
356 );
357 });
358
359 + it.effect("derives auto permission mode from auto runtime policy without skip flag", () => {
360 + const harness = makeHarness();
361 + return Effect.gen(function* () {
362 + const adapter = yield* ClaudeAdapter;
363 + yield* adapter.startSession({
364 + threadId: THREAD_ID,
365 + provider: ProviderDriverKind.make("claudeAgent"),
366 + runtimeMode: "auto",
367 + });
368 +
369 + const createInput = harness.getLastCreateQueryInput();
370 + assert.equal(createInput?.options.permissionMode, "auto");
371 + assert.equal(createInput?.options.allowDangerouslySkipPermissions, undefined);
372 + }).pipe(
373 + Effect.provideService(Random.Random, makeDeterministicRandomService()),
374 + Effect.provide(harness.layer),
375 + );
376 + });
377 +
378 it.effect("loads Claude filesystem settings sources for SDK sessions", () => {
379 const harness = makeHarness();
380 return Effect.gen(function* () {
apps/server/src/provider/Layers/ClaudeAdapter.ts
+1
@@ -3509,6 +3509,7 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (
3509 const effectiveEffort = getEffectiveClaudeAgentEffort(effort, modelSelection?.model);
3510 const runtimeModeToPermission: Record<string, PermissionMode> = {
3511 "auto-accept-edits": "acceptEdits",
3512 + auto: "auto",
3513 "full-access": "bypassPermissions",
3514 };
3515 const permissionMode = runtimeModeToPermission[input.runtimeMode];
apps/server/src/provider/Layers/CodexSessionRuntime.test.ts
+28
@@ -104,6 +104,7 @@ describe("buildTurnStartParams", () => {
104 NodeAssert.deepStrictEqual(params, {
105 threadId: "provider-thread-1",
106 approvalPolicy: "never",
107 + approvalsReviewer: "user",
108 sandboxPolicy: {
109 type: "dangerFullAccess",
110 },
@@ -149,6 +150,7 @@ describe("buildTurnStartParams", () => {
150 NodeAssert.deepStrictEqual(params, {
151 threadId: "provider-thread-1",
152 approvalPolicy: "on-request",
153 + approvalsReviewer: "user",
154 sandboxPolicy: {
155 type: "workspaceWrite",
156 },
@@ -193,6 +195,31 @@ describe("buildTurnStartParams", () => {
195 NodeAssert.ok(settings?.developer_instructions?.includes(`as ${DEFAULT_MODEL} with medium`));
196 });
197
198 + it.effect("routes approvals to the auto reviewer in auto mode", () =>
199 + Effect.gen(function* () {
200 + const params = yield* buildTurnStartParams({
201 + threadId: "provider-thread-1",
202 + runtimeMode: "auto",
203 + prompt: "Ship it",
204 + });
205 +
206 + NodeAssert.deepStrictEqual(params, {
207 + threadId: "provider-thread-1",
208 + approvalPolicy: "on-request",
209 + approvalsReviewer: "auto_review",
210 + sandboxPolicy: {
211 + type: "workspaceWrite",
212 + },
213 + input: [
214 + {
215 + type: "text",
216 + text: "Ship it",
217 + },
218 + ],
219 + });
220 + }),
221 + );
222 +
223 it("omits collaboration mode when interaction mode is absent", () => {
224 const params = Effect.runSync(
225 buildTurnStartParams({
@@ -205,6 +232,7 @@ describe("buildTurnStartParams", () => {
232 NodeAssert.deepStrictEqual(params, {
233 threadId: "provider-thread-1",
234 approvalPolicy: "untrusted",
235 + approvalsReviewer: "user",
236 sandboxPolicy: {
237 type: "readOnly",
238 },
apps/server/src/provider/Layers/CodexSessionRuntime.ts
+15
@@ -264,23 +264,35 @@ function readResumeCursorThreadId(
264 function runtimeModeToThreadConfig(input: RuntimeMode): {
265 readonly approvalPolicy: EffectCodexSchema.V2ThreadStartParams__AskForApproval;
266 readonly sandbox: EffectCodexSchema.V2ThreadStartParams__SandboxMode;
267 + // Always explicit: omitting the field on resume keeps the thread's previous
268 + // reviewer, which would leave auto_review sticky after switching modes.
269 + readonly approvalsReviewer: EffectCodexSchema.V2ThreadStartParams__ApprovalsReviewer;
270 } {
271 switch (input) {
272 case "approval-required":
273 return {
274 approvalPolicy: "untrusted",
275 sandbox: "read-only",
276 + approvalsReviewer: "user",
277 };
278 case "auto-accept-edits":
279 return {
280 approvalPolicy: "on-request",
281 sandbox: "workspace-write",
282 + approvalsReviewer: "user",
283 + };
284 + case "auto":
285 + return {
286 + approvalPolicy: "on-request",
287 + sandbox: "workspace-write",
288 + approvalsReviewer: "auto_review",
289 };
290 case "full-access":
291 default:
292 return {
293 approvalPolicy: "never",
294 sandbox: "danger-full-access",
295 + approvalsReviewer: "user",
296 };
297 }
298 }
@@ -296,6 +308,7 @@ function buildThreadStartParams(input: {
308 cwd: input.cwd,
309 approvalPolicy: config.approvalPolicy,
310 sandbox: config.sandbox,
311 + approvalsReviewer: config.approvalsReviewer,
312 ...(input.model ? { model: input.model } : {}),
313 ...(input.serviceTier ? { serviceTier: input.serviceTier } : {}),
314 };
@@ -310,6 +323,7 @@ function runtimeModeToTurnSandboxPolicy(
323 type: "readOnly",
324 };
325 case "auto-accept-edits":
326 + case "auto":
327 return {
328 type: "workspaceWrite",
329 };
@@ -382,6 +396,7 @@ export function buildTurnStartParams(input: {
396 threadId: input.threadId,
397 input: turnInput,
398 approvalPolicy: config.approvalPolicy,
399 + approvalsReviewer: config.approvalsReviewer,
400 sandboxPolicy: runtimeModeToTurnSandboxPolicy(input.runtimeMode),
401 ...(input.model ? { model: input.model } : {}),
402 ...(input.serviceTier ? { serviceTier: input.serviceTier } : {}),
apps/web/src/components/chat/ChatComposer.tsx
+6
@@ -106,6 +106,7 @@ import {
106 LockIcon,
107 LockOpenIcon,
108 PenLineIcon,
109 + SparklesIcon,
110 XIcon,
111 } from "lucide-react";
112 import { proposedPlanTitle } from "../../proposedPlan";
@@ -149,6 +150,11 @@ const runtimeModeConfig: Record<
150 description: "Auto-approve edits, ask before other actions.",
151 icon: PenLineIcon,
152 },
153 + auto: {
154 + label: "Auto",
155 + description: "An AI reviewer approves routine actions; risky ones still ask.",
156 + icon: SparklesIcon,
157 + },
158 "full-access": {
159 label: "Full access",
160 description: "Allow commands and edits without prompts.",
apps/web/src/components/chat/CompactComposerControlsMenu.tsx
+1
@@ -71,6 +71,7 @@ export const CompactComposerControlsMenu = memo(function CompactComposerControls
71 >
72 <MenuRadioItem value="approval-required">Supervised</MenuRadioItem>
73 <MenuRadioItem value="auto-accept-edits">Auto-accept edits</MenuRadioItem>
74 + <MenuRadioItem value="auto">Auto</MenuRadioItem>
75 <MenuRadioItem value="full-access">Full access</MenuRadioItem>
76 </MenuRadioGroup>
77 {props.activePlan ? (
packages/contracts/src/orchestration.ts
+1
@@ -117,6 +117,7 @@ export type ModelSelection = typeof ModelSelection.Type;
117 export const RuntimeMode = Schema.Literals([
118 "approval-required",
119 "auto-accept-edits",
120 + "auto",
121 "full-access",
122 ]);
123 export type RuntimeMode = typeof RuntimeMode.Type;