Skip to content

Commit 8c2ff69

Browse files
t3dotggclaude
andcommitted
fix: always send approvalsReviewer explicitly so it resets on mode switch
thread/resume treats an omitted approvalsReviewer as "keep current", so switching a thread out of Auto would leave auto_review sticky. Send "user" explicitly for every non-auto mode. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent b742293 commit 8c2ff69

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎apps/server/src/provider/Layers/CodexSessionRuntime.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ describe("buildTurnStartParams", () => {
104104
NodeAssert.deepStrictEqual(params, {
105105
threadId: "provider-thread-1",
106106
approvalPolicy: "never",
107+
approvalsReviewer: "user",
107108
sandboxPolicy: {
108109
type: "dangerFullAccess",
109110
},
@@ -149,6 +150,7 @@ describe("buildTurnStartParams", () => {
149150
NodeAssert.deepStrictEqual(params, {
150151
threadId: "provider-thread-1",
151152
approvalPolicy: "on-request",
153+
approvalsReviewer: "user",
152154
sandboxPolicy: {
153155
type: "workspaceWrite",
154156
},
@@ -230,6 +232,7 @@ describe("buildTurnStartParams", () => {
230232
NodeAssert.deepStrictEqual(params, {
231233
threadId: "provider-thread-1",
232234
approvalPolicy: "untrusted",
235+
approvalsReviewer: "user",
233236
sandboxPolicy: {
234237
type: "readOnly",
235238
},

‎apps/server/src/provider/Layers/CodexSessionRuntime.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,18 +264,22 @@ function readResumeCursorThreadId(
264264
function runtimeModeToThreadConfig(input: RuntimeMode): {
265265
readonly approvalPolicy: EffectCodexSchema.V2ThreadStartParams__AskForApproval;
266266
readonly sandbox: EffectCodexSchema.V2ThreadStartParams__SandboxMode;
267-
readonly approvalsReviewer?: EffectCodexSchema.V2ThreadStartParams__ApprovalsReviewer;
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;
268270
} {
269271
switch (input) {
270272
case "approval-required":
271273
return {
272274
approvalPolicy: "untrusted",
273275
sandbox: "read-only",
276+
approvalsReviewer: "user",
274277
};
275278
case "auto-accept-edits":
276279
return {
277280
approvalPolicy: "on-request",
278281
sandbox: "workspace-write",
282+
approvalsReviewer: "user",
279283
};
280284
case "auto":
281285
return {
@@ -288,6 +292,7 @@ function runtimeModeToThreadConfig(input: RuntimeMode): {
288292
return {
289293
approvalPolicy: "never",
290294
sandbox: "danger-full-access",
295+
approvalsReviewer: "user",
291296
};
292297
}
293298
}
@@ -303,7 +308,7 @@ function buildThreadStartParams(input: {
303308
cwd: input.cwd,
304309
approvalPolicy: config.approvalPolicy,
305310
sandbox: config.sandbox,
306-
...(config.approvalsReviewer ? { approvalsReviewer: config.approvalsReviewer } : {}),
311+
approvalsReviewer: config.approvalsReviewer,
307312
...(input.model ? { model: input.model } : {}),
308313
...(input.serviceTier ? { serviceTier: input.serviceTier } : {}),
309314
};
@@ -391,7 +396,7 @@ export function buildTurnStartParams(input: {
391396
threadId: input.threadId,
392397
input: turnInput,
393398
approvalPolicy: config.approvalPolicy,
394-
...(config.approvalsReviewer ? { approvalsReviewer: config.approvalsReviewer } : {}),
399+
approvalsReviewer: config.approvalsReviewer,
395400
sandboxPolicy: runtimeModeToTurnSandboxPolicy(input.runtimeMode),
396401
...(input.model ? { model: input.model } : {}),
397402
...(input.serviceTier ? { serviceTier: input.serviceTier } : {}),

0 commit comments

Comments
 (0)