Skip to content

Commit 675e993

Browse files
committed
Cleanup
1 parent 8edbd6e commit 675e993

File tree

4 files changed

+9
-41
lines changed

4 files changed

+9
-41
lines changed

codex-rs/core/src/codex.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ async fn submission_loop(
565565
notify,
566566
cwd,
567567
} => {
568-
info!("Configuring session: model={model}; provider={provider:?}");
568+
debug!("Configuring session: model={model}; provider={provider:?}");
569569
if !cwd.is_absolute() {
570570
let message = format!("cwd is not absolute: {cwd:?}");
571571
error!(message);
@@ -989,10 +989,6 @@ async fn run_turn(
989989
sub_id: String,
990990
input: Vec<ResponseItem>,
991991
) -> CodexResult<Vec<ProcessedResponseItem>> {
992-
debug!("[GABE] codex#run_turn");
993-
info!("[GABE] codex#run_turn");
994-
error!("[GABE] codex#run_turn");
995-
996992
// Decide whether to use server-side storage (previous_response_id) or disable it
997993
let (prev_id, store) = {
998994
let state = sess.state.lock().unwrap();
@@ -1139,7 +1135,7 @@ async fn handle_response_item(
11391135
action,
11401136
} => {
11411137
let LocalShellAction::Exec(action) = action;
1142-
tracing::info!("LocalShellCall: {action:?}");
1138+
debug!("LocalShellCall: {action:?}");
11431139
let params = ShellToolCallParams {
11441140
command: action.command,
11451141
workdir: action.working_directory,

codex-rs/tui/src/app.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ use crate::scroll_event_helper::ScrollEventHelper;
99
use crate::slash_command::SlashCommand;
1010
use crate::tui;
1111
use codex_core::config::Config;
12-
use codex_core::protocol::{Event, EventMsg, LogEvent};
12+
use codex_core::protocol::Event;
13+
use codex_core::protocol::EventMsg;
14+
use codex_core::protocol::LogEvent;
1315
use codex_core::protocol::Op;
1416
use color_eyre::eyre::Result;
1517
use crossterm::event::KeyCode;
@@ -229,10 +231,8 @@ impl<'a> App<'a> {
229231
},
230232
AppEvent::LatestLog(line) => match &mut self.app_state {
231233
AppState::Chat { widget } => widget.handle_codex_event(Event {
232-
id: "123".to_string(),
233-
msg: EventMsg::Log(LogEvent {
234-
line: line.clone(),
235-
})
234+
id: String::new(),
235+
msg: EventMsg::Log(LogEvent { line: line.clone() }),
236236
}),
237237
AppState::Login { .. } | AppState::GitWarning { .. } => {}
238238
},

codex-rs/tui/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> std::io::
122122

123123
// Channel that carries formatted log lines to the UI.
124124
let (log_tx, log_rx) = tokio::sync::mpsc::unbounded_channel::<String>();
125-
let tui_layer = TuiLogLayer::new(log_tx.clone(), 120).with_filter(env_filter());
125+
let tui_layer = TuiLogLayer::new(log_tx.clone()).with_filter(env_filter());
126126

127127
let _ = tracing_subscriber::registry()
128128
.with(file_layer)

codex-rs/tui/src/log_layer.rs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,14 @@ use tracing_subscriber::Layer;
1919
use tracing_subscriber::layer::Context;
2020
use tracing_subscriber::registry::LookupSpan;
2121

22-
/// Maximum characters forwarded to the TUI. Longer messages are truncated so the
23-
/// single‑line status indicator cannot overflow the viewport.
24-
#[allow(dead_code)]
25-
const _DEFAULT_MAX_LEN: usize = 120;
26-
2722
pub struct TuiLogLayer {
2823
tx: UnboundedSender<String>,
29-
max_len: usize,
3024
}
3125

3226
impl TuiLogLayer {
33-
pub fn new(tx: UnboundedSender<String>, max_len: usize) -> Self {
27+
pub fn new(tx: UnboundedSender<String>) -> Self {
3428
Self {
3529
tx,
36-
max_len: max_len.max(8),
3730
}
3831
}
3932
}
@@ -67,27 +60,6 @@ where
6760

6861
event.record(&mut Visitor { buf: &mut buf });
6962

70-
// `String::truncate` operates on UTF‑8 code‑point boundaries and will
71-
// panic if the provided index is not one. Because we limit the log
72-
// line by its **byte** length we can not guarantee that the index we
73-
// want to cut at happens to be on a boundary. Therefore we fall back
74-
// to a simple, boundary‑safe loop that pops complete characters until
75-
// the string is within the designated size.
76-
77-
if buf.len() > self.max_len {
78-
// Attempt direct truncate at the byte index. If that is not a
79-
// valid boundary we advance to the next one ( ≤3 bytes away ).
80-
if buf.is_char_boundary(self.max_len) {
81-
buf.truncate(self.max_len);
82-
} else {
83-
let mut idx = self.max_len;
84-
while idx < buf.len() && !buf.is_char_boundary(idx) {
85-
idx += 1;
86-
}
87-
buf.truncate(idx);
88-
}
89-
}
90-
9163
let sanitized = buf.replace(['\n', '\r'], " ");
9264
let _ = self.tx.send(sanitized);
9365
}

0 commit comments

Comments
 (0)