mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Show live context compaction status in the TUI (#42319)
## Why Context compaction was only reported after it completed, so the TUI did not show when compaction was actively making room to continue. ## What changed - Show `Compacting context` as soon as manual or server-driven compaction starts, with an elapsed timer independent of the current turn timer. - Preserve the compaction status across follow-up input and transient activity, while still allowing retry errors to take precedence. - Restore in-progress compaction timing from thread snapshots and add the live duration to the completion message. - Clear stale compaction state when the turn starts, completes, or terminates. ## Testing Added TUI tests covering manual and server-driven compaction, narrow rendering, follow-up input, replay and task switching, retry status, timer preservation, and turn termination. GitOrigin-RevId: 804e1bc553315da24ff1f99462e8e282818cada3
This commit is contained in:
1 parent
a94a5db629
commit
a526f54b00
17 files changed
+392
-8
No files matched your search
@@ -211,7 +211,10 @@ impl StatusIndicator<'_> {
|
||||
fn lines(&self, width: u16) -> Vec<Line<'static>> {
|
||||
let row = self.row;
|
||||
let now = Instant::now();
|
||||
let elapsed_duration = self.timer.elapsed_at(now);
|
||||
let elapsed_duration = self.timer.display_started_at.map_or_else(
|
||||
|| self.timer.elapsed_at(now),
|
||||
|started_at| now.saturating_duration_since(started_at),
|
||||
);
|
||||
let pretty_elapsed = fmt_elapsed_compact(elapsed_duration.as_secs());
|
||||
let motion_mode = MotionMode::from_animations_enabled(row.animations_enabled);
|
||||
|
||||
@@ -280,10 +283,15 @@ impl Renderable for StatusIndicator<'_> {
|
||||
if area.is_empty() {
|
||||
return;
|
||||
}
|
||||
if self.row.animations_enabled {
|
||||
if self.row.animations_enabled || self.timer.display_started_at.is_some() {
|
||||
let interval_ms = if self.row.animations_enabled {
|
||||
32
|
||||
} else {
|
||||
1_000
|
||||
};
|
||||
self.row
|
||||
.frame_requester
|
||||
.schedule_frame_in(Duration::from_millis(32));
|
||||
.schedule_frame_in(Duration::from_millis(interval_ms));
|
||||
}
|
||||
Paragraph::new(Text::from(self.lines(area.width))).render(area, buf);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user