chore: handle rolled back run result clients
This commit is contained in:
parent
03e7795130
commit
9fc3653502
|
|
@ -62,6 +62,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
PodRunResult::Finished => println!("(finished)"),
|
PodRunResult::Finished => println!("(finished)"),
|
||||||
PodRunResult::Paused => println!("(paused)"),
|
PodRunResult::Paused => println!("(paused)"),
|
||||||
PodRunResult::LimitReached => println!("(turn limit reached)"),
|
PodRunResult::LimitReached => println!("(turn limit reached)"),
|
||||||
|
PodRunResult::RolledBack => println!("(empty turn rolled back)"),
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Extract the assistant's reply from history
|
// 5. Extract the assistant's reply from history
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,16 @@ impl SegmentLogSink {
|
||||||
*mirror = entries;
|
*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
|
/// Atomically read the current mirror and subscribe to subsequent
|
||||||
/// commits. The returned snapshot and receiver split the entry
|
/// commits. The returned snapshot and receiver split the entry
|
||||||
/// timeline into a duplicate-free, gap-free prefix/suffix pair.
|
/// timeline into a duplicate-free, gap-free prefix/suffix pair.
|
||||||
|
|
|
||||||
|
|
@ -677,7 +677,9 @@ impl App {
|
||||||
});
|
});
|
||||||
self.set_pod_status(match result {
|
self.set_pod_status(match result {
|
||||||
RunResult::Paused => PodStatus::Paused,
|
RunResult::Paused => PodStatus::Paused,
|
||||||
RunResult::Finished | RunResult::LimitReached => PodStatus::Idle,
|
RunResult::Finished | RunResult::LimitReached | RunResult::RolledBack => {
|
||||||
|
PodStatus::Idle
|
||||||
|
}
|
||||||
});
|
});
|
||||||
self.run_requests = 0;
|
self.run_requests = 0;
|
||||||
self.run_upload_tokens = 0;
|
self.run_upload_tokens = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user