From 5fe22a5f23e6e5a91d0c0e685ae1ba9afeedbc6e Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Thu, 9 Apr 2026 22:25:16 -0400 Subject: [PATCH] Use ActivityGuard for context overflow retry progress Instead of two separate notifications piling up on the status bar, use a single ActivityGuard that updates in place during overflow retries and auto-completes when the turn finishes. Co-Authored-By: Proof of Concept --- src/agent/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/agent/mod.rs b/src/agent/mod.rs index a31a82c..0f92757 100644 --- a/src/agent/mod.rs +++ b/src/agent/mod.rs @@ -318,6 +318,7 @@ impl Agent { } let mut overflow_retries: u32 = 0; + let mut overflow_activity: Option = None; let mut empty_retries: u32 = 0; let mut ds = DispatchState::new(); @@ -382,8 +383,12 @@ impl Agent { } if overflow_retries < 2 { overflow_retries += 1; - agent.state.lock().await.notify( - format!("context overflow — retrying ({}/2)", overflow_retries)); + let msg = format!("context overflow — compacting ({}/2)", overflow_retries); + match &overflow_activity { + Some(a) => a.update(&msg).await, + None => overflow_activity = Some( + start_activity(&agent, &msg).await), + } agent.compact().await; continue; }