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
@@ -203,6 +203,27 @@ impl App {
|
||||
Ok(ids.len())
|
||||
}
|
||||
|
||||
/// `R`: reopens a failed or escalated session and hands it to the host. The error is why it cannot restart.
|
||||
fn restart(&mut self, id: &str) -> Result<()> {
|
||||
let Some(db) = &self.db else {
|
||||
bail!("no database")
|
||||
};
|
||||
db.reopen(id)?;
|
||||
self.ensure_host()?.submit(id);
|
||||
self.refresh();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn restart_or_show(&mut self, id: &str) {
|
||||
if let Err(e) = self.restart(id) {
|
||||
self.pager = Some(Pager {
|
||||
title: "restart".into(),
|
||||
lines: vec![format!("{e:#}")],
|
||||
scroll: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a session row from the form and hands it to the host, which runs it as soon as a slot is free.
|
||||
/// Any problem (no machine, broken machine file, worktree in use) comes back as the error to show in the form.
|
||||
fn start_session(&mut self, f: &newform::Form) -> Result<String> {
|
||||
@@ -882,6 +903,11 @@ fn on_key(
|
||||
});
|
||||
}
|
||||
}
|
||||
KeyCode::Char('R') => {
|
||||
if let Some(id) = app.overview.rows.get(app.sel).map(|r| r.id.clone()) {
|
||||
app.restart_or_show(&id);
|
||||
}
|
||||
}
|
||||
// every other letter acts on the focused Needs-you item
|
||||
KeyCode::Char(c) => {
|
||||
if let Some(n) = app.overview.needs.get(app.need_sel).cloned() {
|
||||
@@ -999,6 +1025,7 @@ fn on_key(
|
||||
serde_json::json!({"state": start, "why": "replan"}),
|
||||
);
|
||||
}
|
||||
KeyCode::Char('R') => app.restart_or_show(&id),
|
||||
KeyCode::Char('t') => app.pager = Some(test_output(app, &id)),
|
||||
KeyCode::Char('l') => app.pager = Some(transcript(app, &id)),
|
||||
KeyCode::Char('d') => {
|
||||
|
||||
Reference in new issue
Block a user