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; }