From fb96ccd4c6ddc741c0a03801913d79b38cce54f1 Mon Sep 17 00:00:00 2001 From: shijie-openai Date: Sat, 10 Jan 2026 11:23:28 -0800 Subject: [PATCH] Fix: send commandExecution before approval request --- .../app-server/src/bespoke_event_handling.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/codex-rs/app-server/src/bespoke_event_handling.rs b/codex-rs/app-server/src/bespoke_event_handling.rs index 0870191ec8..18755155c1 100644 --- a/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/codex-rs/app-server/src/bespoke_event_handling.rs @@ -225,6 +225,26 @@ pub(crate) async fn apply_bespoke_event_handling( let proposed_execpolicy_amendment_v2 = proposed_execpolicy_amendment.map(V2ExecPolicyAmendment::from); + let item = ThreadItem::CommandExecution { + id: item_id.clone(), + command: command_string.clone(), + cwd: cwd.clone(), + process_id: None, + status: CommandExecutionStatus::InProgress, + command_actions: command_actions.clone(), + aggregated_output: None, + exit_code: None, + duration_ms: None, + }; + let notification = ItemStartedNotification { + thread_id: conversation_id.to_string(), + turn_id: event_turn_id.clone(), + item, + }; + outgoing + .send_server_notification(ServerNotification::ItemStarted(notification)) + .await; + let params = CommandExecutionRequestApprovalParams { thread_id: conversation_id.to_string(), turn_id: turn_id.clone(),