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 <poc@bcachefs.org>
This commit is contained in:
parent
121b46e1d2
commit
5fe22a5f23
1 changed files with 7 additions and 2 deletions
|
|
@ -318,6 +318,7 @@ impl Agent {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut overflow_retries: u32 = 0;
|
let mut overflow_retries: u32 = 0;
|
||||||
|
let mut overflow_activity: Option<ActivityGuard> = None;
|
||||||
let mut empty_retries: u32 = 0;
|
let mut empty_retries: u32 = 0;
|
||||||
let mut ds = DispatchState::new();
|
let mut ds = DispatchState::new();
|
||||||
|
|
||||||
|
|
@ -382,8 +383,12 @@ impl Agent {
|
||||||
}
|
}
|
||||||
if overflow_retries < 2 {
|
if overflow_retries < 2 {
|
||||||
overflow_retries += 1;
|
overflow_retries += 1;
|
||||||
agent.state.lock().await.notify(
|
let msg = format!("context overflow — compacting ({}/2)", overflow_retries);
|
||||||
format!("context overflow — retrying ({}/2)", overflow_retries));
|
match &overflow_activity {
|
||||||
|
Some(a) => a.update(&msg).await,
|
||||||
|
None => overflow_activity = Some(
|
||||||
|
start_activity(&agent, &msg).await),
|
||||||
|
}
|
||||||
agent.compact().await;
|
agent.compact().await;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue