chore: handle rolled back run result clients

This commit is contained in:
Keisuke Hirata 2026-05-23 12:51:40 +09:00
parent 55dedd173c
commit 23e218abaa
3 changed files with 14 additions and 1 deletions

View File

@ -62,6 +62,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
PodRunResult::Finished => println!("(finished)"),
PodRunResult::Paused => println!("(paused)"),
PodRunResult::LimitReached => println!("(turn limit reached)"),
PodRunResult::RolledBack => println!("(empty turn rolled back)"),
}
// 5. Extract the assistant's reply from history

View File

@ -157,6 +157,16 @@ impl SegmentLogSink {
*mirror = entries;
}
/// Truncate the mirror without broadcasting.
pub fn truncate_silent(&self, entries_len: usize) {
let mut mirror = self
.inner
.mirror
.lock()
.expect("session log mirror mutex poisoned");
mirror.truncate(entries_len);
}
/// Atomically read the current mirror and subscribe to subsequent
/// commits. The returned snapshot and receiver split the entry
/// timeline into a duplicate-free, gap-free prefix/suffix pair.

View File

@ -677,7 +677,9 @@ impl App {
});
self.set_pod_status(match result {
RunResult::Paused => PodStatus::Paused,
RunResult::Finished | RunResult::LimitReached => PodStatus::Idle,
RunResult::Finished | RunResult::LimitReached | RunResult::RolledBack => {
PodStatus::Idle
}
});
self.run_requests = 0;
self.run_upload_tokens = 0;