feat: restart a failed or escalated session at the state where it stopped
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:
1 parent
0e57b04d25
commit
e50f90d299
9 files changed
+140
-10
No files matched your search
+10
-2
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user