Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/persona-kit/schemas/persona.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@
},
"approvalPolicy": {
"$ref": "#/definitions/CodexApprovalPolicy",
"description": "Codex CLI approval policy (`--ask-for-approval`)."
"deprecated": true,
"description": "`--ask-for-approval` was removed in codex 0.1.77+. Use `dangerouslyBypassApprovalsAndSandbox` or `sandboxMode` instead. Setting this field emits a warning and has no effect."
},
"workspaceWriteNetworkAccess": {
"type": "boolean",
Expand Down
29 changes: 27 additions & 2 deletions packages/persona-kit/src/interactive-spec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,20 @@ test('codex translates sandbox harness settings to launch flags', () => {
webSearch: true
}
});
// approvalPolicy emits a warning but no flag (--ask-for-approval was removed in codex 0.1.77+)
assert.deepEqual(result.args, [
'-m',
'gpt-5.3-codex',
'--sandbox',
'workspace-write',
'--ask-for-approval',
'on-request',
'-c',
'sandbox_workspace_write.network_access=true',
'--search'
]);
assert.ok(
result.warnings.some((w) => w.includes('approvalPolicy') && w.includes('not supported')),
'expected a deprecation warning for approvalPolicy'
);
});

test('codex emits the single bypass flag when dangerouslyBypassApprovalsAndSandbox is set', () => {
Expand All @@ -148,6 +151,28 @@ test('codex emits the single bypass flag when dangerouslyBypassApprovalsAndSandb
]);
});

test('codex warns for approvalPolicy even when dangerouslyBypassApprovalsAndSandbox is also set', () => {
const result = buildInteractiveSpec({
harness: 'codex',
personaId: 'test-persona',
model: 'openai-codex/gpt-5.3-codex',
systemPrompt: 'x',
harnessSettings: {
reasoning: 'high',
timeoutSeconds: 1200,
dangerouslyBypassApprovalsAndSandbox: true,
approvalPolicy: 'on-request',
}
});
// bypass flag is still emitted
assert.ok(result.args.includes('--dangerously-bypass-approvals-and-sandbox'));
// approvalPolicy warning fires even though dangerouslyBypassApprovalsAndSandbox masked it
assert.ok(
result.warnings.some((w) => w.includes('approvalPolicy') && w.includes('not supported')),
'expected deprecation warning for approvalPolicy even when bypass flag is set'
);
});

test('codex translates http mcpServers into --config mcp_servers.* args', () => {
const result = buildInteractiveSpec({
harness: 'codex',
Expand Down
14 changes: 11 additions & 3 deletions packages/persona-kit/src/interactive-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,17 @@ export function buildInteractiveSpec(input: BuildInteractiveSpecInput): Interact
if (mcpServers && Object.keys(mcpServers).length > 0) {
appendCodexMcpServerArgs(args, mcpServers, warnings);
}
if (harnessSettings?.approvalPolicy) {
// `--ask-for-approval` was removed in codex 0.1.77+ (replaced by
// `--sandbox` + `--dangerously-bypass-approvals-and-sandbox`).
// Warn unconditionally — regardless of whether dangerouslyBypassApprovalsAndSandbox
// is also set — so callers are alerted even when the bypass flag masks it.
warnings.push(
`codex harnessSettings.approvalPolicy ("${harnessSettings.approvalPolicy}") is not supported in codex 0.1.77+; ` +
`the --ask-for-approval flag was removed. Use dangerouslyBypassApprovalsAndSandbox: true for non-interactive execution, ` +
`or sandboxMode for filesystem access control.`
);
}
if (harnessSettings?.dangerouslyBypassApprovalsAndSandbox) {
// Single combined flag — collapses "no sandbox + never ask" and
// suppresses codex's interactive "are you sure?" startup
Expand All @@ -262,9 +273,6 @@ export function buildInteractiveSpec(input: BuildInteractiveSpecInput): Interact
if (harnessSettings?.sandboxMode) {
args.push('--sandbox', harnessSettings.sandboxMode);
}
if (harnessSettings?.approvalPolicy) {
args.push('--ask-for-approval', harnessSettings.approvalPolicy);
}
if (harnessSettings?.workspaceWriteNetworkAccess !== undefined) {
args.push(
'-c',
Expand Down
5 changes: 4 additions & 1 deletion packages/persona-kit/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export interface HarnessSettings {
* missing capability; `danger-full-access` is the fully unsandboxed fallback.
*/
sandboxMode?: CodexSandboxMode;
/** Codex CLI approval policy (`--ask-for-approval`). */
/**
* @deprecated
* @description `--ask-for-approval` was removed in codex 0.1.77+. Use `dangerouslyBypassApprovalsAndSandbox` or `sandboxMode` instead. Setting this field emits a warning and has no effect.
*/
approvalPolicy?: CodexApprovalPolicy;
/**
* Allow outbound network access inside Codex's workspace-write sandbox
Expand Down
Loading