@@ -43,6 +43,10 @@ interface CodexSession {
4343 eventCounter : number ;
4444 cwd : string ;
4545 model ?: string ;
46+ /** Approval policy for the session — passed to turn/start and lazy thread/start */
47+ approvalPolicy ?: string ;
48+ /** Sandbox policy for the session — passed to lazy thread/start */
49+ sandbox ?: string ;
4650}
4751
4852import { SUPPORTED_SERVER_REQUESTS , isSupportedServerRequestMethod , pickModelId } from "@shared/lib/codex-helpers" ;
@@ -258,6 +262,8 @@ export function register(getMainWindow: () => BrowserWindow | null): void {
258262 eventCounter : 0 ,
259263 cwd : options . cwd ,
260264 model : undefined ,
265+ approvalPolicy : options . approvalPolicy ,
266+ sandbox : options . sandbox ,
261267 } ;
262268 codexSessions . set ( internalId , session ) ;
263269 setupCodexHandlers ( rpc , session , internalId , getMainWindow ) ;
@@ -374,6 +380,8 @@ export function register(getMainWindow: () => BrowserWindow | null): void {
374380 persistExtendedHistory : false ,
375381 } ;
376382 if ( session . model ) threadParams . model = session . model ;
383+ if ( session . approvalPolicy ) threadParams . approvalPolicy = session . approvalPolicy ;
384+ if ( session . sandbox ) threadParams . sandbox = session . sandbox ;
377385 const threadResult = await session . rpc . request < CodexThreadStartResponse > ( "thread/start" , threadParams ) ;
378386 session . threadId = threadResult . thread . id ;
379387 log (
@@ -388,7 +396,7 @@ export function register(getMainWindow: () => BrowserWindow | null): void {
388396
389397 log (
390398 "codex" ,
391- ` Send requested: session=${ shortId ( data . sessionId , 12 ) } thread=${ shortId ( session . threadId , 12 ) } text_len=${ data . text . length } images=${ data . images ?. length ?? 0 } effort=${ data . effort ?? "default" } collab=${ data . collaborationMode ?. mode ?? "none" } activeTurn=${ session . activeTurnId ? shortId ( session . activeTurnId , 12 ) : "none" } ` ,
399+ ` Send requested: session=${ shortId ( data . sessionId , 12 ) } thread=${ shortId ( session . threadId , 12 ) } text_len=${ data . text . length } images=${ data . images ?. length ?? 0 } effort=${ data . effort ?? "default" } collab=${ data . collaborationMode ?. mode ?? "none" } approval= ${ session . approvalPolicy ?? "default" } activeTurn=${ session . activeTurnId ? shortId ( session . activeTurnId , 12 ) : "none" } ` ,
392400 ) ;
393401
394402 try {
@@ -405,6 +413,7 @@ export function register(getMainWindow: () => BrowserWindow | null): void {
405413 ...( session . model ? { model : session . model } : { } ) ,
406414 ...( data . effort ? { effort : data . effort } : { } ) ,
407415 ...( data . collaborationMode ? { collaborationMode : data . collaborationMode } : { } ) ,
416+ ...( session . approvalPolicy ? { approvalPolicy : session . approvalPolicy } : { } ) ,
408417 } ;
409418
410419
@@ -703,6 +712,8 @@ export function register(getMainWindow: () => BrowserWindow | null): void {
703712 eventCounter : 0 ,
704713 cwd : data . cwd ,
705714 model : data . model ,
715+ approvalPolicy : data . approvalPolicy ,
716+ sandbox : data . sandbox ,
706717 } ;
707718 codexSessions . set ( internalId , session ) ;
708719 setupCodexHandlers ( rpc , session , internalId , getMainWindow ) ;
0 commit comments