feat: restart a failed or escalated session at the state where it stopped
build / version (push) Successful in 10s
build / build (aarch64-apple-darwin) (push) Successful in 4m5s
build / build (x86_64-unknown-linux-musl) (push) Successful in 3m34s
build / release (push) Successful in 16s

Adds orch session --restart sN and R in the TUI. A restart event gives the
session fresh budgets and retry counts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
johannesandClaude Sonnet 5.5 committed 2026-11-15 22:36:10 +01:00
1 parent 0e57b04d25
commit e50f90d299
9 files changed
+140 -10

No files matched your search

+10 -2
View File
@@ -62,7 +62,10 @@ pub struct Exceeded {
pub limit: String,
}
pub fn exceeded(evs: &[&Event], cfg: &BudgetCfg, now_ms: u64) -> Option<Exceeded> {
/// A restarted session gets a fresh budget: only the events from its last `restart` count.
pub fn exceeded(all: &[&Event], cfg: &BudgetCfg, now_ms: u64) -> Option<Exceeded> {
let restarted = all.iter().rposition(|e| e.kind == "restart");
let evs = &all[restarted.unwrap_or(0)..];
if let Some(limit) = cfg.wall_secs {
let used = active_secs(evs, now_ms);
if used > limit {
@@ -74,7 +77,12 @@ pub fn exceeded(evs: &[&Event], cfg: &BudgetCfg, now_ms: u64) -> Option<Exceeded
}
}
if let Some(limit) = cfg.cost {
let used = cost(evs);
// usage after a restart belongs to the new hx, whose total starts again
let used = if restarted.is_some() {
cost(&evs[1..])
} else {
cost(evs)
};
if used > limit {
return Some(Exceeded {
what: "cost",