From 15023e472821b89186204938e9415edf92b977fe Mon Sep 17 00:00:00 2001 From: jif-oai Date: Mon, 24 Nov 2025 15:26:55 +0000 Subject: [PATCH] A few more --- codex-rs/core/src/review_prompts.rs | 4 +++- codex-rs/exec/src/lib.rs | 11 ++++------ codex-rs/tui/config.toml | 2 ++ codex-rs/tui/src/chatwidget.rs | 32 ++++++++++++++--------------- 4 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 codex-rs/tui/config.toml diff --git a/codex-rs/core/src/review_prompts.rs b/codex-rs/core/src/review_prompts.rs index 7122b55697..2ceb6077e6 100644 --- a/codex-rs/core/src/review_prompts.rs +++ b/codex-rs/core/src/review_prompts.rs @@ -114,7 +114,9 @@ pub fn review_request_from_target( if sha.is_empty() { return Err(ReviewTargetError::EmptySha); } - let title = title.map(|t| t.trim().to_string()).filter(|t| !t.is_empty()); + let title = title + .map(|t| t.trim().to_string()) + .filter(|t| !t.is_empty()); let (prompt, hint) = review_commit_prompt(&sha, title.as_deref()); let short_sha: String = sha.chars().take(min(7, sha.len())).collect(); let display_text = if let Some(title) = title { diff --git a/codex-rs/exec/src/lib.rs b/codex-rs/exec/src/lib.rs index 46a0df362d..b8e650738e 100644 --- a/codex-rs/exec/src/lib.rs +++ b/codex-rs/exec/src/lib.rs @@ -30,8 +30,8 @@ use codex_core::protocol::Event; use codex_core::protocol::EventMsg; use codex_core::protocol::Op; use codex_core::protocol::SessionSource; -use codex_core::review_prompts::review_request_from_target; use codex_core::review_prompts::ReviewTarget; +use codex_core::review_prompts::review_request_from_target; use codex_protocol::config_types::SandboxMode; use codex_protocol::user_input::UserInput; use event_processor_with_human_output::EventProcessorWithHumanOutput; @@ -402,9 +402,7 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option) -> any } else { custom.to_string() }; - ReviewTarget::Custom { - instructions: text, - } + ReviewTarget::Custom { instructions: text } } else if let Some(branch) = &args.branch { ReviewTarget::BaseBranch { branch: branch.clone(), @@ -431,9 +429,8 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option) -> any }; let mut built_request = - review_request_from_target(target, append_to_original_thread).map_err(|err| { - anyhow::anyhow!("invalid review target: {err}") - })?; + review_request_from_target(target, append_to_original_thread) + .map_err(|err| anyhow::anyhow!("invalid review target: {err}"))?; if let Some(hint_override) = &args.hint { built_request.review_request.user_facing_hint = hint_override.clone(); diff --git a/codex-rs/tui/config.toml b/codex-rs/tui/config.toml new file mode 100644 index 0000000000..bc906c6cce --- /dev/null +++ b/codex-rs/tui/config.toml @@ -0,0 +1,2 @@ +[projects."/Users/jif/code/codex"] +trust_level = "untrusted" diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index 3b9b955d53..1e388d5587 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -2777,9 +2777,9 @@ impl ChatWidget { items.push(SelectionItem { name: format!("{current_branch} -> {branch}"), actions: vec![Box::new(move |tx3: &AppEventSender| { - if let Some(review_request) = - build_review_request(ReviewTarget::BaseBranch { branch: branch.clone() }) - { + if let Some(review_request) = build_review_request(ReviewTarget::BaseBranch { + branch: branch.clone(), + }) { tx3.send(AppEvent::CodexOp(Op::Review { review_request })); } })], @@ -2841,19 +2841,19 @@ impl ChatWidget { "Type instructions and press Enter".to_string(), None, Box::new(move |prompt: String| { - let trimmed = prompt.trim().to_string(); - if trimmed.is_empty() { - return; - } - if let Some(review_request) = - build_review_request(ReviewTarget::Custom { instructions: trimmed }) - { - tx.send(AppEvent::CodexOp(Op::Review { review_request })); - } - }), - ); - self.bottom_pane.show_view(Box::new(view)); -} + let trimmed = prompt.trim().to_string(); + if trimmed.is_empty() { + return; + } + if let Some(review_request) = build_review_request(ReviewTarget::Custom { + instructions: trimmed, + }) { + tx.send(AppEvent::CodexOp(Op::Review { review_request })); + } + }), + ); + self.bottom_pane.show_view(Box::new(view)); + } pub(crate) fn token_usage(&self) -> TokenUsage { self.token_info