mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +00:00
Drive TUI stream animation from the foreground loop (#40644)
## Why Stream animation ticks generated on a background thread can accumulate while the TUI is busy, causing stale ticks to run after the animation stops or the chat widget is replaced. ## What changed - Replace the animation thread and `CommitTick` app event with a Tokio interval owned by the foreground event loop. - Delay missed ticks instead of replaying a burst, and let pending app events run before animation work. - Drop the interval when animation stops or the chat widget is replaced, while preserving `CommitTick` session-log entries. ## Testing Add a paused-time test covering stable pacing, missed ticks, restart behavior, and chat-widget replacement. GitOrigin-RevId: d0561d3f8962b5e05a728463e76aa8ec83cd5a31
This commit is contained in:
1 parent
a9e447a69d
commit
a95391160a
9 files changed
+95
-27
No files matched your search
@@ -190,8 +190,6 @@ use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
use tokio::select;
|
||||
@@ -568,8 +566,8 @@ pub(crate) struct App {
|
||||
pub(crate) keymap: RuntimeKeymap,
|
||||
pub(crate) key_chord_matcher: KeyChordMatcher,
|
||||
|
||||
/// Controls the animation thread that sends CommitTick events.
|
||||
pub(crate) commit_anim_running: Arc<AtomicBool>,
|
||||
/// The foreground loop owns stream pacing; stopped animations have no timer.
|
||||
pub(crate) commit_animation: Option<tokio::time::Interval>,
|
||||
// Shared across ChatWidget instances so invalid status-line config warnings only emit once.
|
||||
status_line_invalid_items_warned: Arc<AtomicBool>,
|
||||
// Shared across ChatWidget instances so invalid terminal-title config warnings only emit once.
|
||||
|
||||
Reference in new issue
Block a user