Skip to content

Commit aaa6b49

Browse files
committed
fix(server): legacy Codex approvals keep argument boundaries
1 parent 2d2da8a commit aaa6b49

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ const CODEX_PROVIDER = ProviderDriverKind.make("codex");
153153
export const CODEX_DRIVER_KIND = CODEX_PROVIDER;
154154
export const CODEX_DEFAULT_INSTANCE_ID = defaultInstanceIdForDriver(CODEX_DRIVER_KIND);
155155

156+
// Legacy approvals send argv; quoting keeps argument boundaries visible.
157+
function codexShellWord(word: string): string {
158+
return /^[\w./:@=-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
159+
}
160+
156161
/** Describe approval scope even when Codex omits or blanks the optional reason. */
157162
export function codexFileChangeApprovalPrompt(input: {
158163
readonly reason?: string | null;
@@ -5442,7 +5447,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
54425447
nativeItemId: payload.callId,
54435448
nativeRequestId,
54445449
requestKind: "command",
5445-
prompt: payload.command.join(" "),
5450+
prompt: payload.command.map(codexShellWord).join(" "),
54465451
title: payload.reason,
54475452
});
54485453
const decision = yield* Deferred.make<ProviderApprovalDecision, never>();

0 commit comments

Comments
 (0)