Simplify compaction status messages

This commit is contained in:
Dhanji R. Prasanna
2026-01-16 20:26:35 +05:30
parent 415226ca84
commit 95f89d3f8e
2 changed files with 11 additions and 15 deletions

View File

@@ -338,16 +338,16 @@ async fn handle_command<W: UiWriter>(
Ok(true) Ok(true)
} }
"/compact" => { "/compact" => {
output.print("🗜️ Triggering manual compaction..."); output.print("g3: compacting session ...");
match agent.force_compact().await { match agent.force_compact().await {
Ok(true) => { Ok(true) => {
output.print("✅ Compaction completed successfully"); output.print("g3: compacting session ... done");
} }
Ok(false) => { Ok(false) => {
output.print("⚠️ Compaction failed"); output.print("g3: compacting session ... failed");
} }
Err(e) => { Err(e) => {
output.print(&format!("❌ Error during compaction: {}", e)); output.print(&format!("g3: compacting session ... error: {}", e));
} }
} }
Ok(true) Ok(true)

View File

@@ -893,7 +893,7 @@ impl<W: UiWriter> Agent<W> {
// Check if we need to do 90% auto-compaction // Check if we need to do 90% auto-compaction
if self.pending_90_compaction { if self.pending_90_compaction {
self.ui_writer self.ui_writer
.print_context_status("\n⚡ Context window reached 90% - auto-compacting...\n"); .print_context_status("\ng3: compacting session ...\n");
if let Err(e) = self.force_compact().await { if let Err(e) = self.force_compact().await {
warn!("Failed to auto-compact at 90%: {}", e); warn!("Failed to auto-compact at 90%: {}", e);
} else { } else {
@@ -982,10 +982,7 @@ impl<W: UiWriter> Agent<W> {
debug!("Manual compaction triggered"); debug!("Manual compaction triggered");
self.ui_writer.print_context_status(&format!( // Note: Status messages are now handled by the CLI layer
"\n🗜️ Manual compaction requested (current usage: {}%)...",
self.context_window.percentage_used() as u32
));
let provider = self.providers.get(None)?; let provider = self.providers.get(None)?;
let provider_name = provider.name().to_string(); let provider_name = provider.name().to_string();
@@ -1016,8 +1013,7 @@ impl<W: UiWriter> Agent<W> {
.await?; .await?;
if result.success { if result.success {
self.ui_writer // Note: Success message is now handled by the CLI layer
.print_context_status("✅ Context compacted successfully.\n");
self.compaction_events.push(result.chars_saved); self.compaction_events.push(result.chars_saved);
Ok(true) Ok(true)
} else { } else {
@@ -1076,11 +1072,11 @@ impl<W: UiWriter> Agent<W> {
if !self.context_window.should_compact() { if !self.context_window.should_compact() {
self.ui_writer self.ui_writer
.print_context_status("✅ Thinning resolved capacity issue. Continuing...\n"); .print_context_status("g3: thinning resolved capacity issue\n");
return Ok(false); return Ok(false);
} }
self.ui_writer self.ui_writer
.print_context_status("⚠️ Thinning insufficient. Proceeding with compaction...\n"); .print_context_status("g3: thinning insufficient, compacting ...\n");
} }
// Compaction still needed // Compaction still needed
@@ -1091,7 +1087,7 @@ impl<W: UiWriter> Agent<W> {
use crate::compaction::{perform_compaction, CompactionConfig}; use crate::compaction::{perform_compaction, CompactionConfig};
self.ui_writer.print_context_status(&format!( self.ui_writer.print_context_status(&format!(
"\n🗜️ Context window reaching capacity ({}%). Compacting...", "\ng3: compacting session ({}%) ...",
self.context_window.percentage_used() as u32 self.context_window.percentage_used() as u32
)); ));
@@ -1120,7 +1116,7 @@ impl<W: UiWriter> Agent<W> {
if result.success { if result.success {
self.ui_writer self.ui_writer
.print_context_status("✅ Context compacted successfully. Continuing...\n"); .print_context_status("g3: compacting session ... done\n");
self.compaction_events.push(result.chars_saved); self.compaction_events.push(result.chars_saved);
request.messages = self.context_window.conversation_history.clone(); request.messages = self.context_window.conversation_history.clone();
return Ok(true); return Ok(true);