The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
hn 0.1.23: New Harness by machine, choices beside the form, Cancel and Start buttons (#1236)
lingrdc2200733f4a6
diff --git a/tui/Cargo.lock b/tui/Cargo.lockindex cb0e807f3..8c0632b83 100644--- a/tui/Cargo.lock+++ b/tui/Cargo.lock@@ -654,7 +654,7 @@ dependencies = [[[package]]name = "harness-tui"-version = "0.1.22"+version = "0.1.23"dependencies = ["alacritty_terminal","base64",diff --git a/tui/Cargo.toml b/tui/Cargo.tomlindex f33357518..44a1ff040 100644--- a/tui/Cargo.toml+++ b/tui/Cargo.toml@@ -1,6 +1,6 @@[package]name = "harness-tui"-version = "0.1.22"+version = "0.1.23"edition = "2024"[dependencies]diff --git a/tui/src/app.rs b/tui/src/app.rsindex 0d34516d1..305246520 100644--- a/tui/src/app.rs+++ b/tui/src/app.rs@@ -1645,7 +1645,10 @@ impl App {let what = if failed { format!("{name} failed{}", agent.did.as_ref().filter(|d| !d.is_empty()).map(|d| format!(": {d}")).unwrap_or_default()) } else { format!("{name} finished") };if !replay && !subagent && looking.as_ref() != Some(&key) {agent.unread = true;- if mine && !visible.contains(&key) { self.say(what.clone(), if failed { theme::DANGER } else { theme::ONLINE }) }+ // Only a failure is said on the status line. "… finished" took the whole bar+ // into the message colours for seconds as the window's spinner became its ✓,+ // which says the same: the bar seemed to flash whenever a window was done.+ if mine && failed && !visible.contains(&key) { self.say(what.clone(), theme::DANGER) }} else if looking.as_ref() == Some(&key) { self.mark_seen_key(key) }if mine && !self.terminal_focused && !replay && !subagent { crate::notify("Harness", &what) }if !replay && !subagent && !failed { crate::commands::notify_harness(self, "harness-done", &hook_key) }@@ -6820,6 +6823,23 @@ mod recovery_tests {assert_eq!((agent.name.as_str(), agent.engine.as_str(), agent.project.as_str(), agent.branch.as_str()), ("Deploy checklist", "claude", "webapp", "main"));}+ /// A harness finishing in a window not shown is its tab's ✓ — not "… finished" taking the whole+ /// status line into the message colours, which read as the bar flashing. A failure is still said.+ #[tokio::test]+ async fn a_harness_finishing_out_of_sight_leaves_the_status_line_alone() {+ let mut app = fixture();+ app.fleet.merge_roster("test-peer", &[json!({"id": "agent-1", "name": "fix-login", "engine": "claude"})]);+ // Open in a pane of its own, not in the window being shown.+ app.panes.insert(99, crate::pane::Pane::new(99, "test-peer", "agent-1", 80, 24));+ app.toast = None;+ app.on_frame("test-peer", "turn_ended", json!({"agentId": "agent-1"}));+ assert!(app.toast.is_none(), "a finish is not said on the status line: {:?}", app.toast);+ assert!(app.fleet.agent("test-peer", "agent-1").unwrap().unread, "it is done and unread: its tab shows ✓");+ app.fleet.agents.get_mut(&("test-peer".to_string(), "agent-1".to_string())).unwrap().errored = true;+ app.on_frame("test-peer", "turn_ended", json!({"agentId": "agent-1"}));+ assert!(app.toast.as_ref().is_some_and(|t| t.0.contains("failed")), "a failure is still said: {:?}", app.toast);+ }+/// `set -g @hn-window-name …` by hand (or from a config file) changes the tab as Appearance does.#[tokio::test]async fn setting_the_tab_name_source_by_hand_changes_the_tab_at_once() {diff --git a/tui/src/devices.rs b/tui/src/devices.rsindex ca406305c..d19585c01 100644--- a/tui/src/devices.rs+++ b/tui/src/devices.rs@@ -1128,7 +1128,7 @@ fn reach(app: &App, m: &crate::fleet::Machine) -> (&'static str, Color, String)let spin = theme::spinner(app.tick);match &m.reach {_ if linking => (spin, theme::WARN, "connecting…".into()),- _ if m.local => ("✓", theme::ONLINE, "this computer".into()),+ _ if m.local => ("✓", theme::ONLINE, "connected".into()),_ if !m.online() => ("·", theme::MUTED, "offline".into()),Reach::Ready => ("✓", theme::ONLINE, "connected".into()),Reach::Connecting => (spin, theme::WARN, "connecting…".into()),@@ -1195,7 +1195,9 @@ fn account_row(app: &App) -> Row {fn machines_rows(app: &App) -> Vec<Row> {let mut rows = vec![account_row(app)];- let here = "This computer";+ // This computer's section, under its name ("This computer" only until it has one).+ let here = app.fleet.local_machine_name();+ let here = here.as_str();let password = app.devices.password.as_ref();let set = password.and_then(|p| p.as_ref().ok()).and_then(|v| v.get("hasPassword")).and_then(Value::as_bool);let state = match password {@@ -1768,7 +1770,9 @@ mod tests {let groups: Vec<&str> = picker.rows.iter().filter_map(|r| r.group.as_deref()).collect::<Vec<_>>();let mut seen: Vec<&str> = Vec::new();for g in groups { if seen.last() != Some(&g) { seen.push(g) } }- assert_eq!(seen, vec!["Account", "This computer", "Your machines", "Linked from here", "Add a machine", "Set up a server"], "each group once, in order");+ // This computer's section is under its name once it has one ("studio" here), not "This computer".+ assert_eq!(seen, vec!["Account", app.fleet.local_machine_name().as_str(), "Your machines", "Linked from here", "Add a machine", "Set up a server"], "each group once, in order");+ assert!(!seen.contains(&"This computer"));assert!(picker.rows.iter().any(|r| r.id == "add:login" && r.label == "2. Sign in as [email protected]"), "the server steps name the account");// A machine opens its actions: no Remove for this computer, Connect for one not linked.go_to(&mut app, &format!("m:{REMOTE}"));@@ -2397,7 +2401,7 @@ mod tests {let (s, _) = screen(&mut app, w, h);assert!(s.contains(view.title()), "{} at {w}x{h}:\n{s}", view.id());match view {- View::Machines => assert!(s.contains("This computer") && s.contains("Your machines") && s.contains("enter choose"), "{s}"),+ View::Machines => assert!(s.contains(&app.fleet.local_machine_name()) && !s.contains("This computer") && s.contains("Your machines") && s.contains("enter choose"), "{s}"),View::Connect => assert!(s.contains("gpu-box") && s.contains("Not linked yet") && s.contains("enter choose"), "{s}"),View::Phone if w == 80 => assert!(s.contains("to show the QR code") && app.devices.phone.drawn.get().is_none(), "too small says so:\n{s}"),View::Phone => assert!(app.devices.phone.drawn.get().is_some(), "{s}"),diff --git a/tui/src/modal.rs b/tui/src/modal.rsindex 1186985df..e7c17a35d 100644--- a/tui/src/modal.rs+++ b/tui/src/modal.rs@@ -685,7 +685,6 @@ pub fn machine_rows(app: &App) -> Vec<Row> {// (The harnesses' marks, no round ones: `✓` connected, a spinner connecting, `?` to link…)let (dot, color) = theme::machine_mark(&m.reach, m.online(), app.tick);let word: String = match &m.reach {- _ if m.local && m.reach == Reach::Ready => "this computer".into(),Reach::Ready => "connected".into(),Reach::Connecting => "connecting…".into(),Reach::NeedsLink => "not linked — M-l links it".into(),@@ -824,7 +823,7 @@ pub fn new_machine_rows(app: &App, prefer: &str) -> Vec<Row> {let running = app.fleet.agents.values().filter(|a| a.machine_id == m.id && a.status == "active").count();Row::new(m.id.clone(), app.fleet.machine_name(&m.id)).lead(vec![span(if m.id == prefer { "✓ " } else { " " }, fg(theme::accent()))])- .detail(vec![span(format!("{}{running} running", if m.local { "this computer · " } else { "" }), fg(theme::MUTED))])+ .detail(vec![span(format!("{running} running"), fg(theme::MUTED))])}).collect();rows.sort_by_key(|r| r.id != prefer);rowsdiff --git a/tui/src/models.rs b/tui/src/models.rsindex e9766923a..3b714dd61 100644--- a/tui/src/models.rs+++ b/tui/src/models.rs@@ -264,7 +264,17 @@ pub fn parse_api_models(reply: &Value) -> Option<Vec<ApiModel>> {/// An agent account's subscription, from the usage the status line reads (`usage_read`): how much/// of its tightest window is left.#[derive(Clone, Debug, PartialEq)]-pub struct Sub { pub engine: String, pub title: String, pub account: String, pub left: Option<f64>, pub status: String, pub details: Vec<String> }+pub struct Sub {+ pub engine: String, pub title: String, pub account: String, pub left: Option<f64>, pub status: String, pub details: Vec<String>,+ /// The machines this account's plan was read on, by name, this computer's first — what tells two plans apart, as the+ /// status line does. (The account key itself is a hash: it says nothing to a person.)+ pub machines: Vec<String>,+}++/// A machine as a person knows it: its name, never its id.+fn machine_name(app: &App, id: &str) -> String {+ app.fleet.machine(id).map(|m| m.name.clone()).filter(|n| !n.is_empty()).unwrap_or_else(|| "Unnamed machine".into())+}/// What is left of a window, as the desktop says it: never a positive remainder rounded to 0.fn left_of(used: f64) -> String { let left = (100.0 - used).clamp(0.0, 100.0); if left > 0.0 && left < 1.0 { "<1%".into() } else { format!("{}%", left.floor() as u32) } }@@ -276,7 +286,12 @@ pub fn subscriptions(app: &App) -> Vec<Sub> {for m in machines {for u in &app.usage[m] {let account = u.account.clone().unwrap_or_default();- if out.iter().any(|s| s.engine == u.provider && s.account == account) { continue }+ let name = machine_name(app, m);+ // The same account on another machine is the same plan: one row, every machine it is on.+ if let Some(seen) = out.iter_mut().find(|s| s.engine == u.provider && s.account == account) {+ if !seen.machines.contains(&name) { seen.machines.push(name) }+ continue;+ }let tightest = u.windows.iter().max_by(|a, b| a.used.total_cmp(&b.used));let title = match u.provider.as_str() { "claude" => "Anthropic".to_string(), "codex" => "OpenAI".to_string(), p => engine_label(p).to_string() };out.push(Sub {@@ -284,6 +299,7 @@ pub fn subscriptions(app: &App) -> Vec<Sub> {left: tightest.map(|w| (100.0 - w.used).clamp(0.0, 100.0)),status: tightest.map(|w| format!("{} left", left_of(w.used))).unwrap_or_else(|| "Usage unavailable".into()),details: u.windows.iter().map(|w| format!("{} — {} left", w.label, left_of(w.used))).collect(),+ machines: vec![name],});}}@@ -762,20 +778,21 @@ fn sub_word(app: &App, sub: &Sub, t: Option<&Target>) -> String {const LOW_WATER: f64 = 20.0;-/// A subscription's row, as the desktop's: the account (`Anthropic 315df1`), then how much of it is-/// left (`20% remaining`) — the one figure worth a glance; Enter on it is the preview's to say. Its-/// mark says it is in use (✓) or running low (!).-fn sub_row(app: &App, sub: &Sub, t: Option<&Target>, group: &str, twin: bool) -> Row {+/// A subscription's row: the plan's maker, the machines it is on (`Anthropic studio, laptop`), then how+/// much of it is left (`20% remaining`) — the one figure worth a glance; Enter on it is the preview's to+/// say. Its mark says it is in use (✓) or running low (!). [ordinal]: which of several plans of one maker+/// on the same machines this is — the only case a machine's name cannot tell them apart.+fn sub_row(app: &App, sub: &Sub, t: Option<&Target>, group: &str, ordinal: Option<usize>) -> Row {let word = sub_word(app, sub, t);let low = sub.left.is_some_and(|l| l <= LOW_WATER);- let short: String = sub.account.chars().take(6).collect();- let label = if twin && !short.is_empty() { format!("{} · {short}", sub.title) } else { sub.title.clone() };+ let label = ordinal.map_or_else(|| sub.title.clone(), |n| format!("{} {n}", sub.title));+ let machines = sub.machines.join(", ");let (dot, color) = if word.starts_with('✓') { ("✓ ", if low { theme::WARN } else { theme::accent() }) } else if low { ("! ", theme::WARN) } else { ("◇ ", theme::SOFT) };let left = sub.left.map(|l| format!("{} remaining", left_of(100.0 - l))).unwrap_or_else(|| sub.status.clone());Row::new(format!("mv:sub:{}\t{}", sub.engine, sub.account), label).group(group.to_string())- .extra(format!("{} {} subscription own login {word}", sub.engine, sub.account))+ .extra(format!("{} {machines} subscription own login {word}", sub.engine)).lead(vec![span(dot, fg(color))])- .detail(vec![span(if twin { String::new() } else { short }, fg(theme::MUTED))])+ .detail(vec![span(machines, fg(theme::MUTED))]).right(left)}@@ -801,7 +818,12 @@ pub fn rows(app: &App, query: &str) -> Vec<Row> {// Subscriptions: every account's, as the desktop lists them — how much of it is left and whether// that is running low; the harness's own login says it is in use.let subs = subscriptions(app);- out.extend(subs.iter().map(|sub| sub_row(app, sub, t, SUBSCRIPTIONS, subs.iter().filter(|s| s.title == sub.title).count() > 1)));+ out.extend(subs.iter().enumerate().map(|(i, sub)| {+ // (Two plans of one maker on the same machines have only their order to tell them apart.)+ let alike: Vec<usize> = subs.iter().enumerate().filter(|(_, s)| s.title == sub.title && s.machines == sub.machines).map(|(j, _)| j).collect();+ let ordinal = (alike.len() > 1).then(|| alike.iter().position(|j| *j == i).unwrap_or(0) + 1);+ sub_row(app, sub, t, SUBSCRIPTIONS, ordinal)+ }));// APIs saved on this computer: each folds its models until Enter (or a search) opens it.match &v.apis {@@ -2086,6 +2108,7 @@ pub fn preview(app: &App, id: &str) -> Vec<Line<'static>> {out.extend(failed(""));out.push(Line::raw(""));out.extend(sub.details.iter().take(3).map(|d| kv("Window", d.clone())));+ out.push(kv(if sub.machines.len() > 1 { "Machines" } else { "Machine" }, sub.machines.join(", ")));out.push(kv("Agent", engine_label(&sub.engine).to_string()));out.push(kv("Source", "Subscription"));let said = match sub_payload(app, &sub, t) { Ok(_) => "Enter puts this harness back on its own login.".to_string(), Err(w) => w };@@ -2407,6 +2430,37 @@ mod tests {fn flash(p: &Picker) -> String { p.flash.as_ref().map(|f| f.0.clone()).unwrap_or_default() }fn text(lines: &[Line]) -> String { lines.iter().map(|l| l.spans.iter().map(|s| s.content.as_ref()).collect::<String>()).collect::<Vec<_>>().join("\n") }+ /// A subscription row names the machines its plan is on, never the account's hash; the same plan on two+ /// machines is one row, and only two plans of one maker on the same machines are told apart by number.+ #[test]+ fn subscriptions_name_their_machines_and_not_their_account_keys() {+ let mut app = app();+ app.fleet.machines.push(Machine { shared: false, id: "m2".into(), name: "laptop".into(), local: false, status: "online".into(), reach: Reach::Ready });+ let win = || vec![Window { label: "5h".into(), used: 10.0, resets: None }];+ let claude = |account: &str| Usage { provider: "claude".into(), account: Some(account.into()), windows: win() };+ let codex = |account: &str| Usage { provider: "codex".into(), account: Some(account.into()), windows: win() };+ // The app() fixture has claude 7f0c on studio (local). The same account is on the laptop too, with a codex plan.+ app.usage.insert("m2".into(), vec![claude("7f0c"), codex("aa11")]);+ let text_of = |r: &Row| r.detail.iter().map(|s| s.content.as_ref()).collect::<String>();+ let rows = rows(&app, "");+ let one = row(&rows, "mv:sub:claude\t7f0c");+ assert_eq!((one.label.as_str(), text_of(one).as_str()), ("Anthropic", "studio, laptop"), "one plan, every machine it is on");+ let alone = row(&rows, "mv:sub:codex\taa11");+ assert_eq!((alone.label.as_str(), text_of(alone).as_str()), ("OpenAI", "laptop"));+ for r in [one, alone] { assert!(![r.label.clone(), text_of(r), r.right.clone()].join(" ").contains("7f0c") && !r.label.contains("aa11"), "no account key shown") }+ assert!(!rows.iter().any(|r| r.label.contains("this Mac") || text_of(r).contains("this Mac")), "machines are named, never 'this Mac'");+ // A second Anthropic plan on the same two machines: only now do the plans need a number.+ app.usage.get_mut("local").unwrap().push(claude("cc33"));+ app.usage.get_mut("m2").unwrap().push(claude("cc33"));+ let rows = super::rows(&app, "");+ let labels: Vec<&str> = rows.iter().filter(|r| r.id.starts_with("mv:sub:claude")).map(|r| r.label.as_str()).collect();+ assert_eq!(labels, ["Anthropic 1", "Anthropic 2"]);+ assert!(rows.iter().filter(|r| r.id.starts_with("mv:sub:claude")).all(|r| text_of(r) == "studio, laptop"));+ // The preview names them too.+ let preview = text(&super::preview(&app, "mv:sub:claude\t7f0c"));+ assert!(preview.contains("Machines") && preview.contains("studio, laptop"), "{preview}");+ }+/// The owner's flow, end to end on fake replies: the subscription runs low, so the focused/// harness is moved onto a local model that is not downloaded yet — Get (asked twice) →/// download → start → wait until the grid lists it → `agent_retarget {agentId, gridModel,diff --git a/tui/src/new_harness.rs b/tui/src/new_harness.rsindex 4c8cf27c9..b7e4817f6 100644--- a/tui/src/new_harness.rs+++ b/tui/src/new_harness.rs@@ -123,6 +123,10 @@ pub struct Form {trail: Vec<Child>,area: Rect,child_area: Rect,+ /// The dialog's `[ Cancel ]` button, where it was last drawn: a click on it closes the form.+ cancel_area: Rect,+ /// On the button row, Cancel is the one chosen (← from Start), not Start.+ cancel_chosen: bool,task_area: Rect,task_editor: task::Editor,hits: Vec<(Rect, Field)>,@@ -163,9 +167,8 @@ impl Form {let page = matches!(self.surface, Surface::Window(_));let git_controls = self.draft.what.engine != "terminal"&& (data::git(&self.git) || self.git_loading || self.git["error"].is_string());- let mut fields = vec![Field::Task, Field::Agent];- if page { fields.push(Field::Machine); }- fields.push(Field::Project);+ // The machine is its own row, here and on the page: not "project @ machine" in one.+ let mut fields = vec![Field::Task, Field::Agent, Field::Machine, Field::Project];if !page && git_controls { fields.extend([Field::Branch, Field::Worktree]); }if self.draft.what.engine != "terminal" {fields.push(Field::Model);@@ -189,6 +192,8 @@ impl Form {let fields = self.fields();let at = fields.iter().position(|f| *f == self.focus).unwrap_or(0) as isize;self.focus = fields[(at + delta).rem_euclid(fields.len() as isize) as usize];+ // Coming back to the buttons, Start is the one chosen again.+ self.cancel_chosen = false;}fn worktree(&self) -> bool {self.draft.what.engine != "terminal"@@ -230,13 +235,10 @@ impl Form {Project::Clone(url) => format!("Clone: {url}"),}}- fn project_label(&self) -> String {- format!("{} @ {}", self.project_name(), self.machine_label)- }fn hint(&self) -> String {if self.focus == Field::Project {if let Project::Folder(path) = &self.draft.project {- return format!("{} @ {}", short_path(path, &self.home), self.machine_label);+ return short_path(path, &self.home);}}String::new()@@ -252,9 +254,7 @@ impl Form {self.draft.what.label.clone(),),Field::Machine => ("Machine", self.machine_label.clone()),- Field::Project => ("Project", if matches!(self.surface, Surface::Window(_)) {- self.project_name()- } else { self.project_label() }),+ Field::Project => ("Project", self.project_name()),Field::Task => ("Task", if self.draft.task.trim().is_empty() {"Add a task (optional)".into()} else {@@ -351,9 +351,10 @@ fn machine_home(app: &App, machine: &str) -> Option<String> {})}+/// A machine by its name — this computer's too, not "local".fn machine_label(app: &App, machine: &str) -> String {if app.fleet.machines.iter().any(|m| m.id == machine && m.local) {- "local".into()+ app.fleet.local_machine_name()} else {app.fleet.machine_name(machine)}@@ -557,6 +558,8 @@ fn make_form(app: &mut App, machine: Option<String>, cwd: Option<String>, surfactrail: vec![],area: Rect::default(),child_area: Rect::default(),+ cancel_area: Rect::default(),+ cancel_chosen: false,task_area: Rect::default(),task_editor: task::Editor::default(),hits: vec![],@@ -614,12 +617,11 @@ fn refresh_form(app: &App, form: &mut Form) {Choice::Compatible(dsh) => Some(compatible_rows(app, &form.draft.machine, dsh)),Choice::Project => {let mut rows = project_rows(app, &form.draft, !matches!(form.surface, Surface::Window(_)));- // The welcome header owns the destination; choosing a folder must- // not silently switch to a different computer with the same path.- if matches!(form.surface, Surface::Window(_)) {- rows.retain(|row| row.id.strip_prefix("at:").and_then(|s| s.split_once('\t'))- .is_none_or(|(machine, _)| machine == form.draft.machine));- }+ // The Machine field (and the welcome header) owns the destination: the projects are the+ // chosen machine's, and choosing one never switches to another computer.+ let chosen = app.fleet.launch_machine_id(&form.draft.machine);+ rows.retain(|row| row.id.strip_prefix("at:").and_then(|s| s.split_once('\t'))+ .is_none_or(|(machine, _)| machine == chosen || machine == form.draft.machine));Some(rows)}Choice::Machine(_) => Some(modal::new_machine_rows(app, &form.draft.machine)),@@ -703,11 +705,19 @@ fn project_rows(app: &App, draft: &Draft, show_machine: bool) -> Vec<Row> {if draft.what.engine != "terminal" {rows.push(Row::new("new", "New Folder"));}+ // The chosen machine's home first, as the composer offers "this folder": a machine whose recent+ // agents all ran in scratch folders otherwise offered nothing else.+ let chosen = app.fleet.launch_machine_id(&draft.machine);+ if let Some(home) = app.homes.get(chosen).filter(|h| h.starts_with('/')) {+ let label = if show_machine { format!("~ @ {}", machine_label(app, chosen)) } else { "~".into() };+ // (Its own id, not a recent project's "at:": chosen the same way, never counted among them.)+ rows.push(Row::new(format!("home:{chosen}\t{home}"), label).extra(format!("home {}", app.fleet.machine_name(chosen))).group("Home"));+ }let mut agents: Vec<_> = app.fleet.agents.values()- .filter(|a| !a.cwd.is_empty())+ .filter(|a| !a.cwd.is_empty() && !crate::shell_context::scratch_folder(&a.cwd)).collect();agents.sort_by_key(|a| {(@@ -739,11 +749,13 @@ fn project_rows(app: &App, draft: &Draft, show_machine: bool) -> Vec<Row> {.map(String::as_str).unwrap_or(""),);+ // "folder @ machine", the machine by its name. "local" still finds this computer's.+ let local = app.fleet.machines.iter().any(|m| m.id == machine && m.local);let mut row = Row::new(format!("at:{machine}\t{}", a.cwd),if show_machine { format!("{short} @ {}", machine_label(app, machine)) } else { short },)- .extra(app.fleet.machine_name(machine))+ .extra(format!("{}{}", app.fleet.machine_name(machine), if local { " local" } else { "" })).group("Recent projects");row.disabled = !app.fleet@@ -1071,7 +1083,8 @@ fn load_folder(app: &mut App, form: &mut Form, path: String) {c.kind = Choice::Folder(path.clone());c.picker.placeholder =format!("{} · Ctrl-L path", short_path(&path, &form.home));- let mut rows = vec![Row::new("use", "Use this folder")];+ // "Use ~/work/app", the folder it means, not "Use this folder".+ let mut rows = vec![Row::new("use", format!("Use {}", short_path(&path, &form.home)))];if path != "/" {rows.push(Row::new("up", ".. /"));}@@ -1243,17 +1256,15 @@ fn choose(app: &mut App, form: &mut Form) {"new" => ProjectAction::New,_ => ProjectAction::Open,};- if matches!(form.surface, Surface::Window(_)) {- let next = project_action(form, action);- step_into(app, form, c, next, "");- } else {- step_into(app, form, c, Choice::Machine(Some(action)), "");- }+ // The machine is chosen in its own field: Open, New and Clone act on it, never+ // asking for a machine a second time.+ let next = project_action(form, action);+ step_into(app, form, c, next, "");return;}_ => {if let Some((machine, path)) =- id.strip_prefix("at:").and_then(|s| s.split_once('\t'))+ id.strip_prefix("at:").or_else(|| id.strip_prefix("home:")).and_then(|s| s.split_once('\t')){set_machine(app, form, machine);set_project(form, Project::Folder(path.into()));@@ -1433,6 +1444,16 @@ pub fn key(app: &mut App, mut form: Box<Form>, key: KeyEvent) {form.submit_after_git = false;}let ctrl = key.modifiers.contains(KeyModifiers::CONTROL);+ // → enters a field's choices; ← comes back out, once the query's cursor is at its start: a step+ // back (a folder's parent list), else to the field, its choices still beside the form.+ if key.code == KeyCode::Left && !ctrl && form.child_active && form.child.as_ref().is_some_and(|c| c.picker.qcursor == 0) {+ if let Some(previous) = form.trail.pop() { form.child = Some(previous) }+ else if form.focus == Field::Task { form.child = None; form.child_active = false }+ else { form.child_active = false }+ form.error.clear();+ store_form(app, form);+ return;+ }if key.code == KeyCode::Esc || (ctrl && matches!(key.code, KeyCode::Char('c' | 'g'))) {if back(app, &mut form) {store_form(app, form);@@ -1584,6 +1605,16 @@ pub fn key(app: &mut App, mut form: Box<Form>, key: KeyEvent) {form.move_by(if key.code == KeyCode::BackTab { -1 } else { 1 });reveal(app, &mut form);}+ // The dialog's button row: ← → choose between Cancel and Start, as every dialog's+ // buttons do; Enter on Cancel closes the form, as Esc does.+ KeyCode::Left | KeyCode::Right if form.focus == Field::Create && !matches!(form.surface, Surface::Window(_)) => {+ form.cancel_chosen = key.code == KeyCode::Left;+ }+ KeyCode::Enter | KeyCode::Char(' ') if form.focus == Field::Create && form.cancel_chosen => {+ form.cancel_chosen = false;+ dismiss(app, form);+ return;+ }KeyCode::Enter | KeyCode::Char(' ') => launch = activate(app, &mut form),KeyCode::Right if form.focus != Field::Create => {activate(app, &mut form);@@ -1704,6 +1735,11 @@ pub fn mouse(app: &mut App, mouse: MouseEvent) {c.picker.move_by(delta as i64);}} else if mouse.kind == MouseEventKind::Down(MouseButton::Left) {+ if form.cancel_area.contains(pos) {+ // `[ Cancel ]`: as Esc closes the dialog, the draft kept for next time.+ dismiss(app, form);+ return;+ }if form.child.is_some() && form.child_area.contains(pos) {form.child_active = true;let c = form.child.as_mut().unwrap();@@ -2179,7 +2215,7 @@ mod tests {open(&mut app, explicit, None);let Some(Modal::NewHarness(form)) = &app.modal else { panic!() };assert_eq!(form.draft.machine, "local");- assert_eq!(form.project_label(), "New Folder @ local");+ assert_eq!((form.project_name().as_str(), form.machine_label.as_str()), ("New Folder", app.fleet.local_machine_name().as_str()));for rows in [modal::machine_rows(&app), modal::new_machine_rows(&app, shell)] {assert_eq!(rows.len(), 1);assert_eq!(rows[0].id, "local");@@ -2196,7 +2232,7 @@ mod tests {let recent: Vec<_> = rows.iter().filter(|r| r.id.starts_with("at:")).collect();assert_eq!(recent.len(), 1);assert_eq!(recent[0].id, "at:local\t/home/dev/repo");- assert_eq!(recent[0].label, "~/repo @ local");+ assert_eq!(recent[0].label, format!("~/repo @ {}", app.fleet.local_machine_name()), "its machine by name, not '@ local'");}#[tokio::test]@@ -2220,21 +2256,25 @@ mod tests {}open(&mut app, None, None);let Some(Modal::NewHarness(mut form)) = app.modal.take() else { panic!() };+ // The projects are the chosen machine's (the Machine field picks it): this computer's own,+ // at most fifty, and none of another machine's.child(&mut app, &mut form, Choice::Project, "");- assert_eq!(form.child.as_ref().unwrap().picker.rows.iter().filter(|r| r.id.starts_with("at:")).count(), 52);+ let recent = |form: &Form| form.child.as_ref().unwrap().picker.rows.iter().filter(|r| r.id.starts_with("at:")).map(|r| r.id.clone()).collect::<Vec<_>>();+ assert_eq!(recent(&form).len(), 50);+ assert!(recent(&form).iter().all(|id| !id.starts_with("at:office") && !id.starts_with("at:m2")));+ // A large local history does not crowd out a remote machine's: chosen, its project is there.for machine in ["office", "m2"] {- for query in [format!("{machine} harness"), format!("harness {machine}")] {- let picker = &mut form.child.as_mut().unwrap().picker;- picker.set_query(&query);- let selected = picker.current().expect("the remote project is searchable");- assert_eq!(selected.id, format!("at:{machine}\t/home/dev/harnesses/autonomous-harness-2026-000"), "{query}");- assert!(selected.label.ends_with(&format!(" @ {machine}")));- assert!(!selected.disabled);- }+ set_machine(&mut app, &mut form, machine);+ child(&mut app, &mut form, Choice::Project, "");+ assert_eq!(recent(&form), [format!("at:{machine}\t/home/dev/harnesses/autonomous-harness-2026-000")]);+ let picker = &mut form.child.as_mut().unwrap().picker;+ picker.set_query("harness");+ let selected = picker.current().expect("the machine's project is searchable");+ assert!(selected.label.ends_with(&format!(" @ {machine}")), "{}", selected.label);+ assert!(!selected.disabled);choose(&mut app, &mut form);assert_eq!(form.draft.machine, machine);assert!(matches!(&form.draft.project, Project::Folder(path) if path == "/home/dev/harnesses/autonomous-harness-2026-000"));- child(&mut app, &mut form, Choice::Project, "");}}@@ -2282,6 +2322,95 @@ mod tests {assert!(!rows.iter().any(|r| r.id.starts_with(&format!("at:{shell}\t"))));}+ /// → enters a field's choices and ← comes back out (at the query's start), the choices still+ /// shown beside the form; a typed query keeps ← for its cursor.+ #[tokio::test]+ async fn left_leaves_a_chooser_that_right_entered() {+ let mut app = app();+ open(&mut app, None, None);+ let Some(Modal::NewHarness(mut form)) = app.modal.take() else { panic!() };+ form.focus = Field::Agent;+ reveal(&mut app, &mut form);+ app.modal = Some(Modal::NewHarness(form));+ press(&mut app, KeyCode::Right);+ assert!(form_of(&app).child_active, "→ enters the choices");+ press(&mut app, KeyCode::Char('c'));+ press(&mut app, KeyCode::Left);+ assert!(form_of(&app).child_active, "← moves the query's cursor first");+ press(&mut app, KeyCode::Left);+ assert!(!form_of(&app).child_active, "← at the query's start comes back to the field");+ assert_eq!(form_of(&app).focus, Field::Agent);+ assert!(form_of(&app).child.is_some(), "its choices stay in view");+ }++ /// The dialog's Start is a button on its own line, in view at 80×24 whatever the agent's settings;+ /// a click on it is Start.+ #[tokio::test]+ async fn the_dialog_ends_with_a_start_button_always_in_view() {+ let mut app = app();+ open(&mut app, None, None);+ let Some(Modal::NewHarness(mut form)) = app.modal.take() else { panic!() };+ for engine in ["claude", "codex", "terminal"] {+ set_engine(&mut form, engine);+ let area = Rect::new(0, 0, 80, 24);+ let mut buf = Buffer::empty(area);+ view::draw(&mut buf, area, &mut form);+ let text: Vec<String> = (0..area.height).map(|y| (0..area.width).map(|x| buf[(x, y)].symbol().to_string()).collect()).collect();+ let label = form.describe(Field::Create).0;+ assert!(text.iter().any(|l| l.contains(&format!("[ {label} ]"))), "{engine}: no Start button\n{}", text.join("\n"));+ assert!(form.hits.iter().any(|(r, f)| *f == Field::Create && r.height == 1 && text[r.y as usize].contains("[ ")), "the button is its click target");+ assert!(text.iter().any(|l| l.contains("[ Cancel ]")), "{engine}: no Cancel button");+ assert!(form.cancel_area.width > 0 && text[form.cancel_area.y as usize].contains("[ Cancel ]"));+ }+ // A click on Cancel closes the form.+ app.modal = Some(Modal::NewHarness(form));+ let Some(Modal::NewHarness(form)) = &app.modal else { panic!() };+ let at = form.cancel_area;+ mouse(&mut app, MouseEvent { kind: MouseEventKind::Down(MouseButton::Left), column: at.x + 2, row: at.y, modifiers: KeyModifiers::NONE });+ assert!(!matches!(app.modal, Some(Modal::NewHarness(_))), "Cancel closes the form");++ // And from the keyboard: on the buttons, ← chooses Cancel, → Start again, Enter presses it.+ open(&mut app, None, None);+ let Some(Modal::NewHarness(mut form)) = app.modal.take() else { panic!() };+ form.focus = Field::Create;+ app.modal = Some(Modal::NewHarness(form));+ press(&mut app, KeyCode::Left);+ assert!(form_of(&app).cancel_chosen, "← chooses Cancel");+ press(&mut app, KeyCode::Right);+ assert!(!form_of(&app).cancel_chosen, "→ chooses Start");+ press(&mut app, KeyCode::Left);+ press(&mut app, KeyCode::Up);+ press(&mut app, KeyCode::Down);+ assert!(!form_of(&app).cancel_chosen, "coming back to the buttons, Start is chosen");+ press(&mut app, KeyCode::Left);+ let created = app.models_view.sent.len();+ press(&mut app, KeyCode::Enter);+ assert!(!matches!(app.modal, Some(Modal::NewHarness(_))), "Enter on Cancel closes the form");+ assert_eq!(app.models_view.sent.len(), created, "and starts nothing");+ }++ /// A machine whose agents ran in scratch folders (a test matrix in /tmp) offered only those, and+ /// starting in one was refused (FORBIDDEN: projects open under the home). Its home comes first,+ /// and only folders under it are offered.+ #[tokio::test]+ async fn projects_offer_the_machine_home_and_only_folders_under_it() {+ let mut app = app();+ let ids: Vec<String> = app.fleet.machines.iter().map(|m| m.id.clone()).chain(["local".to_string()]).collect();+ for id in ids { app.homes.insert(id, "/home/dev".into()); }+ for (id, cwd) in [("a1", "/home/dev/repo"), ("a2", "/tmp/grid-matrix-out/agents/codex-1"), ("a3", "/private/tmp/scratch")] {+ let agent = crate::fleet::agent_from("local", &json!({ "id": id, "engine": "codex", "project": { "cwd": cwd } }), None);+ app.fleet.agents.insert(agent.key(), agent);+ }+ open(&mut app, None, None);+ let Some(Modal::NewHarness(form)) = &app.modal else { panic!() };+ let rows = project_rows(&app, &form.draft, true);+ let first_folder = rows.iter().find(|r| r.id.starts_with("at:") || r.id.starts_with("home:")).expect("a folder");+ assert_eq!(first_folder.group.as_deref(), Some("Home"), "the home comes first");+ assert!(first_folder.id.starts_with("home:") && first_folder.id.ends_with("\t/home/dev"));+ assert!(rows.iter().any(|r| r.id.ends_with("\t/home/dev/repo")));+ assert!(!rows.iter().any(|r| r.id.contains("tmp/")), "folders outside the home are not offered: {:?}", rows.iter().map(|r| &r.id).collect::<Vec<_>>());+ }+#[tokio::test]async fn project_search_keeps_the_short_local_machine_name_searchable() {let mut app = app();@@ -2298,7 +2427,7 @@ mod tests {picker.set_query(query);let selected = picker.current().expect("the real machine name and local both work");assert_eq!(selected.id, "at:local\t/home/dev/harnesses/repo", "{query}");- assert_eq!(selected.label, "~/harnesses/repo @ local");+ assert_eq!(selected.label, "~/harnesses/repo @ M2", "the real machine name, not '@ local'");assert!(picker.visible.iter().all(|(i, hits)| hits.iter().all(|at| (*at as usize) < picker.rows[*i].label.chars().count())));}}@@ -2324,7 +2453,8 @@ mod tests {refresh(&mut app);let Some(Modal::NewHarness(form)) = &app.modal else { panic!() };assert_eq!(form.draft.machine, if pending { shell } else { "local" });- assert_eq!(form.project_label(), "repo @ local");+ // The machine by its name, renamed with it — not "local".+ assert_eq!((form.project_name().as_str(), form.machine_label.as_str()), ("repo", "office"));if pending { assert_eq!(form.attempt.as_ref().unwrap().machine, shell); }}}@@ -2583,13 +2713,22 @@ mod tests {assert_eq!(form.area.intersection(area), form.area);}if form.child_area.width > 0 {- assert!(active, "a chooser drops down only when entered");assert_eq!(form.child_area.intersection(area), form.child_area);- assert_eq!(form.child_area.intersection(form.area), form.child_area, "inside the form: no side panel");- if form.child_area != form.area && focus != Field::Task {- assert!(form.task_area.intersection(form.child_area).is_empty(), "over the task in {area:?}");+ if form.child_area.x >= form.area.right() {+ // Room beside the form (as before 0.1.17): the choices stand there,+ // entered or not, and the form stays whole.+ assert!(form.child_area.intersection(form.area).is_empty(), "beside, not over the form in {area:?}");+ } else {+ assert!(active, "where there is no room beside, a chooser drops down only when entered");+ assert_eq!(form.child_area.intersection(form.area), form.child_area, "inside the form when narrow");+ if form.child_area != form.area && focus != Field::Task {+ assert!(form.task_area.intersection(form.child_area).is_empty(), "over the task in {area:?}");+ }}}+ if width >= 150 && height >= 24 && form.child.is_some() {+ assert!(form.child_area.x >= form.area.right(), "a wide terminal shows the choices beside the form ({area:?})");+ }if width >= 80 && height >= 24 && form.child_area != form.area {assert_eq!(form.hits.len(), form.fields().len(), "all settings stay visible");}diff --git a/tui/src/new_harness/view.rs b/tui/src/new_harness/view.rsindex 9551bc84b..36889a6a4 100644--- a/tui/src/new_harness/view.rs+++ b/tui/src/new_harness/view.rs@@ -60,6 +60,7 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {form.hits.clear();form.area = Rect::default();form.child_area = Rect::default();+ form.cancel_area = Rect::default();form.task_area = Rect::default();if body.width < 22 || body.height < 5 {put(@@ -89,14 +90,24 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {let dropped = form.child.is_some() && form.child_active;let message = if form.error.is_empty() || dropped { live_error.as_deref().unwrap_or("") } else { &form.error };let errors = error_lines(message, form_w.saturating_sub(4) as usize);- let footer_h = if message.is_empty() { 2 } else { errors.len().max(2) as u16 }- .min(r.bottom().saturating_sub(fields_y + 1 + u16::from(spacious)).max(1));- let footer_y = r.bottom().saturating_sub(footer_h + u16::from(spacious));+ // The dialog's Start is a button, as every dialog ends with one, on its last line: one blank+ // row under it, as there is one over the title, its hint or error just above it. (Under two+ // footer rows and a pad it hung in the middle, three blank rows below it.) The page keeps its+ // Start row and its footer.+ let start_y = r.bottom().saturating_sub(1 + u16::from(spacious));+ let start_button = !page && start_y > fields_y + 2;+ let footer_h = if start_button {+ if message.is_empty() { 1 } else { errors.len().max(1) as u16 }.min(start_y.saturating_sub(fields_y + 1).max(1))+ } else {+ if message.is_empty() { 2 } else { errors.len().max(2) as u16 }+ .min(r.bottom().saturating_sub(fields_y + 1 + u16::from(spacious)).max(1))+ };+ let footer_y = if start_button { start_y.saturating_sub(footer_h) } else { r.bottom().saturating_sub(footer_h + u16::from(spacious)) };form.area = r;let capacity = footer_y.saturating_sub(fields_y);let mut row: u16 = 0;let mut recent_header = None;- let rows: Vec<_> = form.fields().into_iter().map(|field| {+ let rows: Vec<_> = form.fields().into_iter().filter(|field| !(start_button && *field == Field::Create)).map(|field| {if spacious && matches!(field, Field::Branch | Field::Create) { row += 1; }if page && field == Field::Browse {if spacious { row += 1; }@@ -115,8 +126,15 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {let fy = fields_y + row - skip;fy + if *field == Field::Task { task_h.min(footer_y.saturating_sub(fy)) } else { 1 }});- let chooser = form.child.as_ref().filter(|_| form.child_active)- .map(|c| under.and_then(|at| dropdown(c, x + 1, at, form_w - 2, r.bottom() - 1)).unwrap_or(r));+ // Where there is room, the focused field's choices stand beside the form, entered or not, as they+ // did before 0.1.17: the form stays whole and the choices are in view while moving between fields.+ let side_w = body.right().saturating_sub(r.right() + 4).min(60);+ let chooser = if side_w >= 32 {+ form.child.as_ref().map(|_| Rect::new(x + form_w + 2, y, side_w, body.bottom().saturating_sub(y + 1).min(22).max(form_h.min(22))))+ } else {+ form.child.as_ref().filter(|_| form.child_active)+ .map(|c| under.and_then(|at| dropdown(c, x + 1, at, form_w - 2, r.bottom() - 1)).unwrap_or(r))+ };if chooser != Some(r) {panel(buf, r, base);if form_h >= 9 {@@ -155,15 +173,6 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {form.task_area = Rect::new(value_x, fy, value_width, height);task_cursor = form.task_editor.draw(buf, form.task_area, &form.draft.task,active && !form.child_active && !form.starting && form.attempt.is_none(), base, muted);- } else if field == Field::Project && !page {- let suffix = format!(" @ {}", form.machine_label);- let suffix_width = suffix.width() as u16;- if value_width > suffix_width + 2 {- let name = form.project_name();- let name_width = (name.width() as u16).min(value_width - suffix_width);- put(buf, value_x, fy, name_width, &name, st);- put(buf, value_x + name_width, fy, suffix_width, &suffix, st);- } else { put(buf, value_x, fy, value_width, &format!("@ {}", form.machine_label), st); }} else if let Field::Recent(i) = field {// The chosen row as the panel's lists mark it, as the welcome page's Recent does.let st = if active { selected } else { st };@@ -195,6 +204,23 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {put(buf, x + 2, footer_y + row as u16, form_w - 4, line, base.patch(theme::fg(theme::DANGER)));}}+ if start_button {+ // `[ Cancel ] [ Start Codex ]`, right-aligned as every dialog's buttons, the way out first:+ // Start bright when it is the focus, the panel's own colours otherwise. Enter on Start, or+ // a click, starts as the row did; a click on Cancel closes the form, as Esc does.+ let (label, _) = form.describe(Field::Create);+ let row = crate::buttons::Row {+ buttons: vec![crate::buttons::Button { label: "Cancel".into(), key: None }, crate::buttons::Button { label, key: None }],+ chosen: if form.cancel_chosen { 0 } else { 1 }, hint: String::new(),+ };+ let mut chrome = crate::settings::chrome();+ if form.focus != Field::Create { chrome.selected = base.add_modifier(Modifier::BOLD); }+ let area = Rect::new(x + 2, start_y, form_w.saturating_sub(4), 1);+ row.view(&chrome).render(area, buf);+ let at = row.areas(area);+ if let Some(cancel) = at.first() { form.cancel_area = *cancel; }+ if let Some(start) = at.get(1) { form.hits.push((*start, Field::Create)); }+ }}match chooser {Some(at) => draw_child(buf, at, form).or(task_cursor),diff --git a/tui/src/new_harness/welcome_view.rs b/tui/src/new_harness/welcome_view.rsindex da4136707..a49101de5 100644--- a/tui/src/new_harness/welcome_view.rs+++ b/tui/src/new_harness/welcome_view.rs@@ -86,9 +86,8 @@ pub(super) fn draw(buf: &mut Buffer, app: &App, body: Rect, form: &mut Form) ->let agent = format!("[ {} ▾ ]", form.draft.what.label);let agent_w = (agent.width() as u16).min(26).min(width / 3);control(buf, form, Rect::new(x, y, agent_w, 1), Field::Agent, &agent, plain, accent);- let machine = if app.fleet.machine(&form.draft.machine).is_some_and(|m| m.local) {- if cfg!(target_os = "macos") { "This Mac" } else { "This Computer" }- } else { &form.machine_label };+ // The machine by its name; "This computer" only until it has one (machine_label).+ let machine = &form.machine_label;let machine = format!("[ {machine} ▾ ]");let machine_w = (machine.width() as u16).min(24).min(width / 3);control(buf, form, Rect::new(x + agent_w + gap, y, machine_w, 1), Field::Machine, &machine, plain, accent);diff --git a/tui/src/preview.rs b/tui/src/preview.rsindex 397178bc5..ecaa25d48 100644--- a/tui/src/preview.rs+++ b/tui/src/preview.rs@@ -14,6 +14,19 @@ fn dim(text: impl Into<String>) -> Span<'static> { Span::styled(text.into(), Styfn bold(text: impl Into<String>) -> Span<'static> { Span::styled(text.into(), Style::default().add_modifier(Modifier::BOLD)) }fn kv(k: &str, v: impl Into<String>) -> Line<'static> { Line::from(vec![dim(format!("{k:<9}")), Span::raw(v.into())]) }+/// A harness's model as people read it. The daemon sends a runtime profile+/// (`runtime-v1:<session>:<engine>:<model, URL-encoded>@<effort>`): its last `:` part was shown+/// as it came — `opencode%2Fmimo-v2.6-flash-free@auto` for `opencode/mimo-v2.6-flash-free`.+fn model_name(a: &crate::fleet::Agent) -> String {+ if let Some(d) = crate::runtime_model::details(&a.model, &a.id, &a.engine) { return d.name }+ match a.model.strip_prefix("runtime-v1:") {+ // A profile that is not this agent's own (another session id): still its model, decoded.+ Some(rest) => rest.splitn(3, ':').nth(2).and_then(|m| m.rsplit_once('@').map(|(m, _)| m))+ .and_then(crate::runtime_model::decode).unwrap_or_default(),+ None => a.model.clone(),+ }+}+pub fn lines(app: &App, kind: &PickerKind, id: &str) -> Vec<Line<'static>> {lines_with_actions(app, kind, id, true)}@@ -72,7 +85,7 @@ fn harness(app: &App, machine_id: &str, agent_id: &str, actions: bool) -> Vec<Li// at the bottom (where the preview starts), what it asks you below them.if let Some(tail) = app.tails.get(&a.session_id) {// Its facts on one line: where, which model, its PR, what it has used.- let model = a.model.rsplit(':').next().unwrap_or("").to_string();+ let model = model_name(a);let pr = a.pr.as_ref().map(|p| format!("#{} {}", p.number, p.state)).unwrap_or_default();let tokens = if a.tokens > 0 { format!("{} tokens", crate::fleet::compact(a.tokens)) } else { String::new() };let facts = [app.fleet.machine_name(machine_id), cwd.clone(), a.branch.clone(), model, pr, tokens].into_iter().filter(|s| !s.is_empty()).collect::<Vec<_>>().join(" · ");@@ -129,7 +142,7 @@ fn harness(app: &App, machine_id: &str, agent_id: &str, actions: bool) -> Vec<Liout.push(kv("machine", app.fleet.machine_name(machine_id)));if !cwd.is_empty() { out.push(kv("folder", cwd)) }if !a.branch.is_empty() { out.push(kv("branch", a.branch.clone())) }- let model = a.model.rsplit(':').next().unwrap_or("").to_string();+ let model = model_name(a);if !model.is_empty() { out.push(kv("model", model)) }if !a.dsh.is_empty() { out.push(kv("harness", a.dsh.clone())) }if let Some(pr) = &a.pr { out.push(Line::from(vec![dim(format!("{:<9}", "pr")), Span::raw(format!("#{} {}", pr.number, pr.state)), dim(format!(" {}", pr.url))])) }@@ -475,3 +488,17 @@ fn message(text: &str) -> Vec<Line<'static>> {out.extend(tail.iter().map(|l| line(l)));out}++#[cfg(test)]+mod model_name_tests {+ /// The runtime profile reads as its model: `opencode/mimo-v2.6-flash-free`, not+ /// `opencode%2Fmimo-v2.6-flash-free@auto` (seen on a real machine).+ #[test]+ fn a_runtime_profile_reads_as_its_model() {+ let agent = |model: &str| crate::fleet::agent_from("local", &serde_json::json!({ "id": "a1", "engine": "opencode", "selectedModel": model }), None);+ assert_eq!(super::model_name(&agent("runtime-v1:a1:opencode:opencode%2Fmimo-v2.6-flash-free@auto")), "opencode/mimo-v2.6-flash-free");+ assert_eq!(super::model_name(&agent("runtime-v1:other-session:opencode:opencode%2Fmimo@auto")), "opencode/mimo", "another session's profile, still decoded");+ assert_eq!(super::model_name(&agent("opus")), "opus", "a plain model name as it is");+ assert_eq!(super::model_name(&agent("")), "");+ }+}diff --git a/tui/src/runtime_model.rs b/tui/src/runtime_model.rsindex 38a0e4179..4b321bdbb 100644--- a/tui/src/runtime_model.rs+++ b/tui/src/runtime_model.rs@@ -6,7 +6,7 @@ use regex::Regex;#[derive(Clone, Debug, PartialEq, Eq)]pub struct Details { pub name: String, pub effort: String }-fn decode(value: &str) -> Option<String> {+pub(crate) fn decode(value: &str) -> Option<String> {let mut bytes = Vec::with_capacity(value.len());let mut input = value.bytes();while let Some(b) = input.next() {diff --git a/tui/src/shell_context.rs b/tui/src/shell_context.rsindex 5c9ba5476..f87f8ea17 100644--- a/tui/src/shell_context.rs+++ b/tui/src/shell_context.rs@@ -87,6 +87,16 @@ pub struct State {catalog_started: Option<Instant>,pub catalog_notice: String,composition: Option<composition::Catalog>,+ /// Computers whose home folder a composer asked for: asked once, not on every keystroke.+ homes_asked: HashSet<String>,+}++/// A system temporary folder (`/tmp`, macOS's `/private/tmp` and `/var/folders`): where test runs+/// and throwaway agents work, not a project to start in again — a computer whose recent agents all+/// ran there (a test matrix) offered nothing else, and its daemon refuses to open them (FORBIDDEN).+pub fn scratch_folder(path: &str) -> bool {+ ["/tmp", "/private/tmp", "/var/folders", "/private/var/folders"].iter()+ .any(|root| path == *root || path.starts_with(&format!("{root}/")))}fn path() -> std::path::PathBuf { crate::app::sessions_path(None).with_extension("shell-context.json") }@@ -649,9 +659,11 @@ fn show(app: &mut App, query: &str) {fn context_rows(app: &App, host: bool) -> Vec<Row> {if host {- app.fleet.machines.iter().filter(|m| !m.shared).map(|m| {+ // ("This computer" only until this computer has its own name: then it would be it twice.)+ let named = app.fleet.registered_local_machine().is_some();+ app.fleet.machines.iter().filter(|m| !m.shared && !(named && crate::local::is_local(&m.id))).map(|m| {let mut row = Row::new(m.id.clone(), m.name.clone()).extra(m.id.clone())- .right(if m.usable() { if m.local { "this computer" } else { "connected" } } else { "unavailable" });+ .right(if m.usable() { "connected" } else { "unavailable" });row.disabled = !m.usable(); row}).collect()} else {diff --git a/tui/src/shell_context/composition.rs b/tui/src/shell_context/composition.rsindex 133ff2b64..588296e41 100644--- a/tui/src/shell_context/composition.rs+++ b/tui/src/shell_context/composition.rs@@ -187,11 +187,14 @@ pub(super) fn list(app: &mut App, request: Request) {);}if kind == "host" {+ // "This computer" stands in for this computer only until it has its own name: once the+ // daemon has registered it, that row is the same computer a second time.+ let named = app.fleet.registered_local_machine().is_some();let rows = app.fleet.machines.iter()- .filter(|m| !m.shared)+ .filter(|m| !m.shared && !(named && crate::local::is_local(&m.id))).map(|m| {let unique = app.fleet@@ -206,15 +209,7 @@ pub(super) fn list(app: &mut App, request: Request) {} else {m.id.as_str()};- let mut row = Row::new(id, &m.name).extra(&m.id).right(if m.usable() {- if m.local {- "this computer"- } else {- "connected"- }- } else {- "offline"- });+ let mut row = Row::new(id, &m.name).extra(&m.id).right(if m.usable() { "connected" } else { "offline" });row.disabled = !m.usable();row})@@ -234,6 +229,12 @@ pub(super) fn list(app: &mut App, request: Request) {.map(str::to_string).or_else(|| app.homes.get(&machine).cloned()).unwrap_or_default();+ // Another computer's home is read when its folders are first asked for. Nothing else did here+ // (only New Harness read it), so its folders stayed "still loading" and only its agents'+ // scratch folders were offered.+ if kind == "folder" && !app.homes.contains_key(&machine) && app.shell_context.homes_asked.insert(machine.clone()) {+ crate::input::load_dsh(app, machine.clone());+ }let browsing = kind == "folder" && crate::shell_picker::folder_parts(query).0.is_some();let parent = if kind == "folder" {match folder_parent(query, &cwd, app.homes.get(&machine).map(String::as_str)) {@@ -260,6 +261,7 @@ pub(super) fn list(app: &mut App, request: Request) {.agents.values().filter(|a| a.machine_id == machine && !a.cwd.is_empty())+ .filter(|a| !super::scratch_folder(&a.cwd)).collect();recent.sort_by_key(|a| std::cmp::Reverse(a.recency()));let mut seen = HashSet::new();diff --git a/tui/tests/fresh-user-journeys.py b/tui/tests/fresh-user-journeys.pyindex 345ef0c98..1989b1410 100644--- a/tui/tests/fresh-user-journeys.py+++ b/tui/tests/fresh-user-journeys.py@@ -148,12 +148,13 @@ def folders(u):# Invalid paths remain in the picker and can be corrected without dismissing the form.u.form('codex')u.choose('Project', 'open folder', 'Search projects')- u.wait('Choose a machine'); u.keys('Enter'); u.wait('Use this folder')+ # No machine question (the Machine field has it); the first row names the folder.+ u.wait('Use ~')u.keys('C-l', 'C-u'); u.text(str(u.home / 'does-not-exist')); u.keys('Enter')u.wait('Could not')u.record('missing-folder-browse-error')u.keys('C-l', 'C-u'); u.text('~/harnesses/Retry-Project'); u.keys('Enter')- u.wait('Use this folder'); u.keys('Enter')+ u.wait('Use ~/harnesses/Retry-Project'); u.keys('Enter')session = u.launch('codex', 'tilde-path-recovery-agent-reuse')assert session['cwd'] == '~/harnesses/Retry-Project'u.close_view()diff --git a/tui/tests/fresh-user.py b/tui/tests/fresh-user.pyindex e45ee1968..25d9f3649 100644--- a/tui/tests/fresh-user.py+++ b/tui/tests/fresh-user.py@@ -139,16 +139,16 @@ class User:self.choose('Agent', engine, 'Search agents')def project(self, action, value):+ # The machine is its own field already chosen: Open, New and Clone ask for no machine.self.choose('Project', action, 'Search projects')- self.wait('Choose a machine')- self.keys('Enter')if action == 'open folder':- self.wait('Use this folder')+ # The browser's first row names the folder: "Use ~/…", not "Use this folder".+ self.wait('Use ~')self.keys('C-l', 'C-u')self.wait('/path/to/project')self.text(value)self.keys('Enter')- self.wait('Use this folder')+ self.wait('Use ')self.keys('Enter')else:self.wait('Folder name' if action == 'new folder' else 'GitHub URL')diff --git a/tui/tests/local-shells.py b/tui/tests/local-shells.pyindex 68cbe43c3..756624d45 100644--- a/tui/tests/local-shells.py+++ b/tui/tests/local-shells.py@@ -189,7 +189,8 @@ try:wait(lambda: hn('display-message', '-p', '#{local_machine}|#{pane_machine}').stdout.strip() == 'mock-local|mock-local','local shell and status share the machine name from the app')hn('workspace-menu', 'new-harness')- wait(lambda: ' @ local' in tm('capture-pane', '-p', '-t', 'outer').stdout, 'New Harness identifies the local destination')+ # Its own Machine row, by the name the app gave it (not "@ local" after the project).+ wait(lambda: 'Machine mock-local' in tm('capture-pane', '-p', '-t', 'outer').stdout, 'New Harness identifies the local destination')tm('send-keys', '-t', 'outer', 'Escape')print('PASS daemon arrival preserves local shell and identifies the local destination', flush=True)diff --git a/tui/tests/new-harness.py b/tui/tests/new-harness.pyindex f12f6361a..fd1858108 100644--- a/tui/tests/new-harness.py+++ b/tui/tests/new-harness.py@@ -94,6 +94,12 @@ def wait(fn, label, seconds=8):time.sleep(.05)raise AssertionError(label + '\n' + screen())def shows(text): wait(lambda: text in screen(), text)+# The folder browser's first row names the folder: "Use ~/projects", not "Use this folder".+def shows_use(): wait(lambda: re.search(r'\bUse [~/]', screen()), 'Use <folder>')+# The machine is its own row, by name, and the project its own: never "project @ machine".+def project_at(project, machine):+ shows(f'Machine {machine}'); shows(f'Project {project}')+ assert f'{project} @ ' not in screen(), screen()def snapshot(name):time.sleep(.1)if OUTPUT:@@ -121,7 +127,15 @@ def field(label):click(*field_position(label))def choose_field(label, query):field(label); type_text(query); keys('Enter')- wait(lambda: re.search(r'› Start ', form_screen()), 'choice accepted; launch action focused')+ wait(lambda: re.search(r'\[ Start ', form_screen()), 'choice accepted; the Start button in view')+def press_button(label):+ # The dialog's Start is a button, `[ Start … ]`: clicked at its middle.+ def at():+ for y, line in enumerate(screen().splitlines()):+ i = line.find(f'[ {label} ]')+ if i >= 0: return i + 2, y+ wait(at, f'button {label}')+ click(*at())def form_visible(): return re.search(field_at('Task'), form_screen()) is not Nonedef new_form():wait(lambda:'+' in screen().splitlines()[-1], 'footer controls after status message')@@ -191,17 +205,19 @@ try:before = create_count()input_before = len(state('reconnect')['inputs'])keys('Right'); assert create_count() == before, 'Right on New Harness must not launch'- field('Project'); type_text('office ml-lab'); keys('Enter'); shows('ml-lab @ office')- field('Project'); type_text('m2 webapp'); keys('Enter'); shows('webapp @ local')+ # The machine is chosen in its own field; the projects are then that machine's.+ choose_field('Machine', 'office'); field('Project'); type_text('ml-lab'); keys('Enter'); project_at('ml-lab', 'office')+ choose_field('Machine', 'M2'); field('Project'); type_text('webapp'); keys('Enter'); project_at('webapp', 'M2')assert create_count() == before, 'searching projects across machines only changes the draft'print('PASS New Harness: short local machine name and remote folders after a large local history', flush=True)- # Moving over a field drops nothing down; entering it drops its chooser under it, in the form.+ # Where there is room, the focused field's choices stand beside the form (as before 0.1.17),+ # while moving over it too; entering it keeps the form whole.keys('Down', 'Tab')# (Wait for the redraw that moved the pointer to Agent before reading what it shows.)wait(lambda: re.search(r'›\s+(Agent|Harness)\s', form_screen()), 'Tab reaches Agent')- assert 'Search agents' not in screen(), 'arrowing over a field shows no chooser'+ shows('Search agents and harnesses')+ assert 'Search agents and harnesses' not in form_screen(), 'the choices stand beside the form, not over it'keys('Right'); shows('Search agents and harnesses')- assert 'Search agents and harnesses' in form_screen(), 'the chooser drops down inside the form'assert field_position('Task') == anchor, 'entering a chooser keeps the form visible'# (The dropdown shows a dozen rows; the harnesses follow the agents.)keys('PageDown', 'PageDown'); assert 'Blender' in screen(), 'the agent chooser lists the harnesses'@@ -210,14 +226,16 @@ try:shows('Approvals'); keys('Right'); shows('Search agents and harnesses')keys('Escape'); type_text('codex'); keys('Enter'); shows('Start Codex')field('Project'); shows('Search projects'); snapshot('new-harness-project')- type_text('clone'); keys('Enter'); shows('Choose a machine'); keys('Enter'); shows('GitHub URL')+ # Clone, New and Open act on the machine already chosen: no second machine question.+ type_text('clone'); keys('Enter'); shows('GitHub URL'); assert 'Choose a machine' not in screen()raw('\x1b[200~autonomous-ai/openharness\x1b[201~'); keys('Enter')shows('Clone: autonomous-ai/')assert create_count() == before, 'choosing fields must not launch'- field('Project'); type_text('new folder'); keys('Enter'); shows('Choose a machine'); keys('Enter'); shows('Folder name')+ field('Project'); type_text('new folder'); keys('Enter'); shows('Folder name')type_text('fail-once'); keys('Enter'); shows('New Folder: fail-once')shows('Approvals'); shows('Model'); shows('Profile')- assert not re.search(field_at('Options|Machine'), form_screen()), 'settings are direct fields; machine belongs in Project'+ assert not re.search(field_at('Options'), form_screen()), 'settings are direct fields'+ assert re.search(field_at('Machine'), form_screen()), 'the machine is its own field, not "project @ machine"'choose_field('Approvals', 'read only'); shows('Read only')task_text = 'Fix café login.\n\nKeep 界 and 🦀 intact.\nAdd a regression test.'field('Task'); assert 'Enter start' not in form_screen() and 'Task is optional' not in form_screen()@@ -227,10 +245,10 @@ try:keys('M-Enter'); type_text('Add a regression test.'); keys('BTab')assert create_count() == before, 'leaving the task editor does not launch'snapshot('new-harness-settings')- field('Task'); keys('Enter')- assert create_count() == before, 'first task Enter only highlights Start'- keys('Enter', 'Enter'); shows('Fixture launch failure')- assert create_count() == before + 1, 'busy popup prevents double submission'+ # With a task, Enter in it starts the harness (#1130: the second Enter, on Start, was where a+ # newcomer stopped); the busy popup then keeps another Enter from submitting twice.+ field('Task'); keys('Enter', 'Enter'); shows('Fixture launch failure')+ assert create_count() == before + 1, f'Enter starts it once; a second Enter while it starts does not submit again ({create_count() - before} created)'shows('fail-once'); shows('Read only')request = state()['created'][-1]assert request['engine'] == 'codex', request@@ -248,8 +266,8 @@ try:assert len(state('reconnect')['inputs']) == input_before, 'form input must never reach a working pane'print('PASS New Harness: desktop fields, keyboard, search, paste, retry and no duplicate/input leak', flush=True)- new_form(); field('Project'); type_text('open folder'); keys('Enter'); shows('Choose a machine'); keys('Enter'); shows('Use this folder')- type_text('projects'); keys('Enter'); shows('Use this folder'); keys('Enter'); shows('projects @ local')+ new_form(); field('Project'); type_text('open folder'); keys('Enter'); shows_use()+ type_text('projects'); keys('Enter'); shows_use(); keys('Enter'); project_at('projects', 'M2')shows('[x]'); choose_field('Branch', 'feature')submit(before + 3)request = state()['created'][-1]@@ -313,10 +331,10 @@ try:# A review capture with the requested project label, through the real folder chooser.choose_field('Approvals', 'auto-approve')- field('Project'); type_text('open folder'); keys('Enter'); shows('Choose a machine'); keys('Enter'); shows('Use this folder')+ field('Project'); type_text('open folder'); keys('Enter'); shows_use()keys('C-l', 'C-a', 'C-k'); type_text('/home/dev/autonomous-harness'); keys('Enter')- shows('Use this folder'); keys('Enter')- shows('autonomous-harness @ local'); shows('[x]')+ shows_use(); keys('Enter')+ project_at('autonomous-harness', 'M2'); shows('[x]')tmux('resize-window', '-t', 'test', '-x', '150', '-y', '42'); settle_ui()snapshot('new-harness-flat')field('Task'); assert 'Enter start' not in form_screen() and 'Task is optional' not in form_screen()@@ -348,7 +366,7 @@ try:shows('Improve the New Harness keyboard flow.')assert 'This agent cannot start with a task' not in screen(), 'keyboard-only agent correction clears the live error'field('Task'); keys('C-Home', 'C-k', 'C-k', 'C-k', 'C-k', 'Tab'); choose_field('Agent|Harness', 'claude')- field('Task'); type_text('x' * 2001); keys('Enter'); field('Start Claude Code'); shows('Task is too long')+ field('Task'); type_text('x' * 2001); keys('Enter'); press_button('Start Claude Code'); shows('Task is too long')assert create_count() == count, 'an overlong task is rejected before creating a harness'field('Task'); keys('C-Home', 'C-k', 'BTab')tmux('resize-window', '-t', 'test', '-x', '150', '-y', '42'); settle_ui()@@ -357,7 +375,7 @@ try:snapshot('new-harness-light'); keys('Escape')print('PASS New Harness: draft restoration, narrow/light rendering and cancellation', flush=True)- new_form(); field('Project'); type_text('new folder'); keys('Enter'); shows('Choose a machine'); keys('Enter'); shows('Folder name')+ new_form(); field('Project'); type_text('new folder'); keys('Enter'); shows('Folder name')type_text('lose-reply'); keys('Enter'); shows('New Folder: lose-reply')count = create_count()before_recovery = placement()@@ -377,7 +395,7 @@ try:checks = state()['creationChecks'][-2:]assert len(checks) == 2 and all(c['creationId'] == request['creationId'] for c in checks)- new_form(); field('Project'); type_text('new folder'); keys('Enter'); shows('Choose a machine'); keys('Enter'); shows('Folder name')+ new_form(); field('Project'); type_text('new folder'); keys('Enter'); shows('Folder name')type_text('unknown-launch'); keys('Enter'); keys('Enter'); shows('Launch outcome unknown')count = create_count()keys('Enter'); shows('Launch outcome unknown')diff --git a/tui/tests/welcome-composer.py b/tui/tests/welcome-composer.pyindex 9eedd1162..cb6f41240 100644--- a/tui/tests/welcome-composer.py+++ b/tui/tests/welcome-composer.py@@ -12,7 +12,8 @@ assert 19780 <= PORT <= 19789NAME = 'hn-welcome-composer-' + str(os.getpid())HN = BASE / 'hn'; shutil.copy2(os.environ.get('HN_WELCOME_TEST_BINARY', ROOT / 'target/release/harness-tui'), HN)TMUX = shutil.which('tmux'); assert TMUX-LOCAL_LABEL = 'This Mac' if os.uname().sysname == 'Darwin' else 'This Computer'+# This computer by its name (the mock's, under MOCK_DEMO): never "This Mac" once it has one.+LOCAL_LABEL = 'studio'ENV = {k: os.environ[k] for k in ('PATH', 'LANG', 'LC_ALL', 'TZ') if k in os.environ}ENV.update(HOME=str(BASE), HN_TMPDIR=str(BASE), HN_SOCKET_NAME=NAME, PORT=str(PORT),TERM='xterm-256color', COLORTERM='truecolor', SHELL='/bin/sh', HN_DESKTOP='off',@@ -56,6 +57,8 @@ def wait(fn, label, seconds=12):time.sleep(.07)raise AssertionError(label+'\n'+re.sub(r'https://\S+', '[sign-in link]', screen()))def shows(text): wait(lambda:text in screen(),text)+# The folder browser's first row names the folder: "Use ~/projects", not "Use this folder".+def shows_use(): wait(lambda:re.search(r'\bUse [~/]',screen()),'Use <folder>')def keys(*args):for key in args: tm('send-keys','-t','test',key); time.sleep(.10)def type_text(text): tm('send-keys','-l','-t','test',text)@@ -95,8 +98,9 @@ try:initial_header=header()assert initial_header.index('OpenCode') < initial_header.index(LOCAL_LABEL) < initial_header.rfind('[ '), initial_headertask='Keep this task while choosing computers'- type_text(task); shows(task); keys('Enter')- assert not created(), 'Task Enter must focus Start without submitting'+ # (Enter with a task starts it since #1130; this keeps the task typed while choosing computers.)+ type_text(task); shows(task)+ assert not created(), 'typing the task submits nothing'snapshot('welcome-wide')choose_machine('gpu-box'); assert '[ gpu-box ▾ ]' in header(),header()@@ -113,7 +117,7 @@ try:type_text('ml-lab'); keys('Enter'); shows('[ ml-lab ▾ ]'); shows(task)choose_machine('studio'); assert header()==initial_header,(header(),initial_header)choose_machine('gpu-box'); shows('[ ml-lab ▾ ]'); shows(task)- click('ml-lab'); shows('Search projects'); click('Open Folder'); shows('Use this folder')+ click('ml-lab'); shows('Search projects'); click('Open Folder'); shows_use()assert 'Choose a machine' not in screen(), 'Open Folder must use the header destination directly'keys('Escape','Escape'); shows(task)assert not created()@@ -143,8 +147,8 @@ try:snapshot('welcome-final-dark')tm('send-keys','-l','-t','test','\x1b]10;rgb:2020/2020/2020\x1b\\\x1b]11;rgb:ffff/ffff/ffff\x1b\\')snapshot('welcome-light')- click('ml-lab'); shows('Search projects'); click('Open Folder'); shows('Use this folder')- keys('C-l','C-a','C-k'); type_text('/home/demo/plain'); keys('Enter'); shows('Use this folder'); keys('Enter')+ click('ml-lab'); shows('Search projects'); click('Open Folder'); shows_use()+ keys('C-l','C-a','C-k'); type_text('/home/demo/plain'); keys('Enter'); shows_use(); keys('Enter')wait(lambda:'Worktree' not in screen(),'non-Git folder hides Git controls')assert 'Not a Git repository' not in screen()shows('Default account'); shows(task)@@ -165,14 +169,13 @@ try:print('PASS keyboard traversal, All action, wide/narrow/light rendering, preserved task, New Terminal',flush=True)hn('workspace-menu','new-tab'); shows('What should it do?')task="what's 1+1"- type_text(task); keys('Enter')- assert len(created())==count, 'first task Enter only highlights New Harness'- snapshot('welcome-ready-to-start')+ type_text(task); snapshot('welcome-ready-to-start')+ # With a task, Enter starts it (#1130: the second Enter, on Start, was where a newcomer stopped).keys('Enter')- wait(lambda:len(created())==count+1 and 'New Terminal' not in screen(),'second Enter creates and opens the harness')+ wait(lambda:len(created())==count+1 and 'New Terminal' not in screen(),'task Enter creates and opens the harness')assert created()[-1]['prompt']==task, created()[-1]snapshot('welcome-created')- print('PASS task Enter highlights New Harness; second Enter creates exactly one harness with the task',flush=True)+ print('PASS task Enter creates exactly one harness with the task',flush=True)print('Captures: '+str(OUTPUT),flush=True)finally:if HN.exists(): hn('kill-server',ok=False)diff --git a/tui/tests/welcome.py b/tui/tests/welcome.pyindex e143d9a33..c47c316e8 100644--- a/tui/tests/welcome.py+++ b/tui/tests/welcome.py@@ -69,6 +69,8 @@ def wait(fn, description, seconds=10):def shows(text): wait(lambda: text in screen(), text)+# The folder browser's first row names the folder: "Use ~/projects", not "Use this folder".+def shows_use(): wait(lambda: re.search(r'\bUse [~/]', screen()), 'Use <folder>')def keys(*args):@@ -349,9 +351,9 @@ try:new_tab()choose('Agent', 'codex')choose('Machine', 'mock-remote')- choose('Project', 'open folder'); shows('Use this folder')+ choose('Project', 'open folder'); shows_use()keys('C-l', 'C-a', 'C-k'); type_text('/srv/remote-project'); keys('Enter')- shows('Use this folder'); keys('Enter'); shows('[ remote-project ▾ ]'); shows('[ mock-remote ▾ ]')+ shows_use(); keys('Enter'); shows('[ remote-project ▾ ]'); shows('[ mock-remote ▾ ]')shows('[x]'); click('Worktree'); click('New Harness'); shows('Mock codex (mock)')assert state()['created'][-1]['gitSource'] == '/srv/remote-project'assert hn('display', '-p', '#{pane_machine}') == 'mock-remote'@@ -359,9 +361,9 @@ try:remote = 'mock0000000000000000000000000002'new_tab()choose('Machine', 'mock-remote')- choose('Project', 'open folder'); shows('Use this folder')+ choose('Project', 'open folder'); shows_use()keys('C-l', 'C-a', 'C-k'); type_text('/srv/remote-project'); keys('Enter')- shows('Use this folder'); keys('Enter'); shows('[ remote-project ▾ ]'); shows('[x]')+ shows_use(); keys('Enter'); shows('[ remote-project ▾ ]'); shows('[x]')state('reconnect', {'action': 'offline', 'machine': remote})wait(lambda: hn('display', '-p', '-t', remote_pane, '#{pane_agent_state}') == 'offline', 'remote disconnect reaches the client')count = len(state().get('created', []))