From d1275897ab19ad2ac18a2b7326244a766b3423f1 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 31 Jul 2025 09:44:22 -0700 Subject: [PATCH] adding config --- codex-rs/core/src/codex.rs | 23 ++++++++++++++--------- codex-rs/core/src/models.rs | 4 ++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index c282a94b91..308916341a 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -223,6 +223,7 @@ pub(crate) struct Session { state: Mutex, codex_linux_sandbox_exe: Option, user_shell: shell::Shell, + show_reasoning_content: bool, } impl Session { @@ -722,6 +723,7 @@ async fn submission_loop( codex_linux_sandbox_exe: config.codex_linux_sandbox_exe.clone(), disable_response_storage, user_shell: default_shell, + show_reasoning_content: config.show_reasoning_content, })); // Patch restored state into the newly created session. @@ -1286,15 +1288,18 @@ async fn handle_response_item( }; sess.tx_event.send(event).await.ok(); } - for item in content { - let text = match item { - ReasoningItemContent::ReasoningText { text } => text, - }; - let event = Event { - id: sub_id.to_string(), - msg: EventMsg::AgentReasoningContent(AgentReasoningContentEvent { text }), - }; - sess.tx_event.send(event).await.ok(); + if sess.show_reasoning_content && content.is_some() { + let content = content.unwrap(); + for item in content { + let text = match item { + ReasoningItemContent::ReasoningText { text } => text, + }; + let event = Event { + id: sub_id.to_string(), + msg: EventMsg::AgentReasoningContent(AgentReasoningContentEvent { text }), + }; + sess.tx_event.send(event).await.ok(); + } } None } diff --git a/codex-rs/core/src/models.rs b/codex-rs/core/src/models.rs index 2a5e8c6f22..98d8727e77 100644 --- a/codex-rs/core/src/models.rs +++ b/codex-rs/core/src/models.rs @@ -45,8 +45,8 @@ pub enum ResponseItem { Reasoning { id: String, summary: Vec, - #[serde(default)] - content: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + content: Option>, encrypted_content: Option, }, LocalShellCall {