Skip to content

Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy

Rust

show Codex compaction in the monitor

Raine Virta58435a9a374d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 119ce7b..bde4f2f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+## Unreleased
+
+- The monitor shows active native Codex compaction requests with a dedicated
+ `compacting` status.
+
## v0.1.24 (2026-07-23)
- Codex optionally preserves conversation continuity across Claude Code
diff --git a/src/monitor.rs b/src/monitor.rs
index f9ebf00..eaa2f22 100644
--- a/src/monitor.rs
+++ b/src/monitor.rs
@@ -33,6 +33,7 @@ impl EndpointKind {
pub enum RequestStatus {
Started,
ProviderSelected,
+ Compacting,
Upstream,
Streaming,
Completed,
@@ -44,6 +45,7 @@ impl RequestStatus {
match self {
Self::Started => "started",
Self::ProviderSelected => "selected",
+ Self::Compacting => "compacting",
Self::Upstream => "upstream",
Self::Streaming => "streaming",
Self::Completed => "completed",
@@ -78,6 +80,9 @@ pub enum MonitorEvent {
request_id: String,
model: String,
},
+ CompactionStarted {
+ request_id: String,
+ },
UpstreamStarted {
request_id: String,
},
@@ -367,6 +372,12 @@ impl MonitorHandle {
});
}
+ pub fn compaction_started(&self, request_id: impl Into<String>) {
+ self.publish(MonitorEvent::CompactionStarted {
+ request_id: request_id.into(),
+ });
+ }
+
pub fn upstream_started(&self, request_id: impl Into<String>) {
self.publish(MonitorEvent::UpstreamStarted {
request_id: request_id.into(),
@@ -527,6 +538,11 @@ impl MonitorStore {
});
}
}
+ MonitorEvent::CompactionStarted { request_id } => {
+ if let Some(active) = self.active.get_mut(&request_id) {
+ active.status = RequestStatus::Compacting;
+ }
+ }
MonitorEvent::UpstreamStarted { request_id } => {
if let Some(active) = self.active.get_mut(&request_id) {
active.status = RequestStatus::Upstream;
@@ -1058,6 +1074,18 @@ mod tests {
assert_eq!(state.active[0].model.as_deref(), Some("gpt-5.6-sol"));
}
+ #[test]
+ fn compaction_started_marks_request_compacting() {
+ let monitor = MonitorHandle::new(10);
+ monitor.request_started("r1", None, None, EndpointKind::Messages);
+ monitor.provider_selected("r1", "codex", "gpt-5.6-sol", None);
+ monitor.compaction_started("r1");
+
+ let state = monitor.snapshot();
+ assert_eq!(state.active[0].status, RequestStatus::Compacting);
+ assert_eq!(state.sessions[0].last_status, "compacting");
+ }
+
#[test]
fn generation_baseline_pairs_total_usage_with_the_full_observed_interval() {
let monitor = MonitorHandle::new(10);
diff --git a/src/providers/codex/mod.rs b/src/providers/codex/mod.rs
index 7cabfe4..7b9f4b8 100644
--- a/src/providers/codex/mod.rs
+++ b/src/providers/codex/mod.rs
@@ -157,6 +157,9 @@ impl Provider for CodexProvider {
translated.input.len(),
None,
);
+ if let Some(monitor) = ctx.monitor.as_ref() {
+ monitor.compaction_started(&ctx.req_id);
+ }
let mut compaction_ctx = ctx.clone();
compaction_ctx.monitor = None;
match request_compaction(self.client.as_ref(), &translated, &compaction_ctx).await {
diff --git a/src/tui.rs b/src/tui.rs
index ed9d0f7..f0f1c8d 100644
--- a/src/tui.rs
+++ b/src/tui.rs
@@ -50,6 +50,7 @@ const GREEN: Color = Color::Rgb(120, 200, 120);
const RED: Color = Color::Rgb(220, 120, 120);
const YELLOW: Color = Color::Rgb(220, 200, 100);
const BLUE: Color = Color::Rgb(120, 170, 230);
+const PURPLE: Color = Color::Rgb(190, 140, 240);
const DIM: Color = Color::Rgb(100, 104, 114);
const SESSION_SPARKLINE_MIN_WIDTH: u16 = 170;
const SESSION_SPARKLINE_MAX_TOKENS: u64 = 4_000;
@@ -593,6 +594,7 @@ fn status_color(value: &str) -> Color {
match value {
"completed" => GREEN,
"streaming" => TEAL,
+ "compacting" => PURPLE,
"failed" => RED,
"upstream" => BLUE,
"selected" | "started" => YELLOW,
@@ -1001,7 +1003,11 @@ fn render_active(
let columns = active_columns(LayoutTier::for_outer_width(area.width));
let widths = column_constraints(&columns);
let rows = active.iter().map(|request| {
- let status = format!("{} {}", spinner(tick), request.status.label());
+ let status = if request.status == crate::monitor::RequestStatus::Compacting {
+ format!("{}{}", spinner(tick), request.status.label())
+ } else {
+ format!("{} {}", spinner(tick), request.status.label())
+ };
let cells = columns
.iter()
.enumerate()
@@ -2207,6 +2213,22 @@ mod tests {
assert!(active_text.contains("⠋ upstream"), "{active_text}");
}
+ #[test]
+ fn active_compacting_status_is_distinct_at_narrow_width() {
+ let monitor = MonitorHandle::new(10);
+ monitor.request_started("request-1", None, None, EndpointKind::Messages);
+ monitor.compaction_started("request-1");
+ let state = monitor.snapshot();
+
+ let active = draw(88, 6, |frame| {
+ render_active(frame, frame.area(), &state.active, 0)
+ });
+
+ let active_text = buffer_text(&active);
+ assert!(active_text.contains("⠋compacting"), "{active_text}");
+ assert_eq!(status_color("compacting"), PURPLE);
+ }
+
#[test]
fn populated_tables_render_rows_without_placeholders() {
let monitor = MonitorHandle::new(10);