Fix Codex exec resume sandbox arg ordering
This commit is contained in:
@@ -73,16 +73,22 @@ function createAgentRuntime(deps) {
|
||||
}
|
||||
const runtimeId = getRuntimeSessionId(session);
|
||||
const args = ['exec'];
|
||||
if (runtimeId) args.push('resume');
|
||||
args.push('--json', '--skip-git-repo-check');
|
||||
|
||||
const permMode = session.permissionMode || 'yolo';
|
||||
// `-s/--sandbox` is an option for `codex exec`, but not for `codex exec resume`.
|
||||
// When resuming, it must appear before the `resume` subcommand, otherwise Codex CLI errors
|
||||
// with: "unexpected argument '-s' found".
|
||||
if (runtimeId && permMode === 'plan') {
|
||||
args.push('-s', 'read-only');
|
||||
}
|
||||
if (runtimeId) args.push('resume');
|
||||
switch (permMode) {
|
||||
case 'yolo':
|
||||
args.push('--dangerously-bypass-approvals-and-sandbox');
|
||||
break;
|
||||
case 'plan':
|
||||
args.push('-s', 'read-only');
|
||||
if (!runtimeId) args.push('-s', 'read-only');
|
||||
break;
|
||||
case 'default':
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user