From e8f6d65899475858dd2935351082af74c9778195 Mon Sep 17 00:00:00 2001 From: Owen Lin Date: Thu, 4 Dec 2025 13:48:37 -0800 Subject: [PATCH] fix(app-server): add will_retry to ErrorNotification (#7611) VSCE renders `codex/event/stream_error` (automatically retried, e.g. `"Reconnecting... 1/n"`) and `codex/event/error` (terminal errors) differently, so add `will_retry` on ErrorNotification to indicate this. --- codex-rs/app-server-protocol/src/protocol/v2.rs | 3 +++ codex-rs/app-server/src/bespoke_event_handling.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rs index f650d4d1f..cef25ca1b 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -942,6 +942,9 @@ pub struct TurnError { #[ts(export_to = "v2/")] pub struct ErrorNotification { pub error: TurnError, + // Set to true if the error is transient and the app-server process will automatically retry. + // If true, this will not interrupt a turn. + pub will_retry: bool, pub thread_id: String, pub turn_id: String, } diff --git a/codex-rs/app-server/src/bespoke_event_handling.rs b/codex-rs/app-server/src/bespoke_event_handling.rs index 547daf08b..c9ecd0116 100644 --- a/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/codex-rs/app-server/src/bespoke_event_handling.rs @@ -333,6 +333,7 @@ pub(crate) async fn apply_bespoke_event_handling( outgoing .send_server_notification(ServerNotification::Error(ErrorNotification { error: turn_error, + will_retry: false, thread_id: conversation_id.to_string(), turn_id: event_turn_id.clone(), })) @@ -348,6 +349,7 @@ pub(crate) async fn apply_bespoke_event_handling( outgoing .send_server_notification(ServerNotification::Error(ErrorNotification { error: turn_error, + will_retry: true, thread_id: conversation_id.to_string(), turn_id: event_turn_id.clone(), }))