diff --git a/AGENTS.md b/AGENTS.md index 4188cc9873..27af48ae60 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,6 +4,6 @@ In the codex-rs folder where the rust code lives: - Never add or modify any code related to `CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR`. You operate in a sandbox where `CODEX_SANDBOX_NETWORK_DISABLED=1` will be set whenever you use the `shell` tool. Any existing code that uses `CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR` was authored with this fact in mind. It is often used to early exit out of tests that the author knew you would not be able to run given your sandbox limitations. -After making changes to the rust code run `just fmt` (in `codex-rs` directory) to format the code and `just fix` (in `codex-rs` directory) to fix any linter issues in the code. +Before creating a pull request with changes to `codex-rs`, run `just fmt` (in `codex-rs` directory) to format the code and `just fix` (in `codex-rs` directory) to fix any linter issues in the code, ensure the test suite passes by running `cargo test --all-features` in the `codex-rs` directory. -Ensure the test suite passes by running `cargo test --all-features` in the `codex-rs` directory. +When making individual changes prefer running tests on individual files or projects first. diff --git a/codex-rs/justfile b/codex-rs/justfile index 6c8e9f9e4d..3e1336be43 100644 --- a/codex-rs/justfile +++ b/codex-rs/justfile @@ -28,4 +28,5 @@ fix: cargo clippy --fix --all-features --tests --allow-dirty install: + rustup show active-toolchain cargo fetch diff --git a/codex-rs/toolchain.toml b/codex-rs/rust-toolchain.toml similarity index 100% rename from codex-rs/toolchain.toml rename to codex-rs/rust-toolchain.toml diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index 397c0dc9a4..2fa0cb6cbd 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -25,8 +25,15 @@ use std::sync::mpsc::channel; use std::thread; use std::time::Duration; +/// Debouncing is often a helpful performance optimization, though as shown in +/// https://github.com/openai/codex/pull/1610, it requires care to ensure that +/// it works well with interrupts via ctrl-C. For now, we favor correctness at +/// the cost of performance, but it would be worth revisiting this in the +/// future. +const DEBOUNCE_REDRAW_REQUESTS: bool = false; + /// Time window for debouncing redraw requests. -const REDRAW_DEBOUNCE: Duration = Duration::from_millis(100); +const REDRAW_DEBOUNCE: Duration = Duration::from_millis(10); /// Top-level application state: which full-screen view is currently active. #[allow(clippy::large_enum_variant)] @@ -209,10 +216,14 @@ impl App<'_> { while let Ok(event) = self.app_event_rx.recv() { match event { AppEvent::RequestRedraw => { - self.schedule_redraw(); + if DEBOUNCE_REDRAW_REQUESTS { + self.schedule_redraw(); + } else { + self.redraw_immediately(terminal)?; + } } AppEvent::Redraw => { - self.draw_next_frame(terminal)?; + self.redraw_immediately(terminal)?; } AppEvent::KeyEvent(key_event) => { match key_event { @@ -386,6 +397,10 @@ impl App<'_> { } } + fn redraw_immediately(&mut self, terminal: &mut tui::Tui) -> Result<()> { + self.draw_next_frame(terminal) + } + fn dispatch_paste_event(&mut self, pasted: String) { match &mut self.app_state { AppState::Chat { widget } => widget.handle_paste(pasted),