Skip to content

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.

Keep New Harness compact and centered with side pickers (#534)

Dee9350994911c3
diff --git a/tui/README.md b/tui/README.md
index c88c9058c..4fa880f01 100644
--- a/tui/README.md
+++ b/tui/README.md
@@ -156,13 +156,14 @@ Harness's own, only on keys tmux leaves unbound (every tmux key does what tmux d
| `C-b g` `C-b B` | send a task (Harness picks the harness) / broadcast to the window |
| `C-b R` `C-b P` `C-b K` | restart, pause, clone the harness |
-`C-b N` opens the vertical New Harness form. Agent, Project and optional Task come first,
+`C-b N` opens a compact, centered New Harness form. Agent, Project and optional Task come first,
then a blank row separates Branch, Worktree, Model, Approvals and applicable Profile.
All settings are visible without expanding Options. Project reads `project @ local`, or
`project @ machine` for a remote destination; focusing it shows the full path below.
The initial destination is the connected local Harness machine, with successful agent
and project choices remembered. Explicit project commands keep their destination. Enter starts
-with the displayed choices; Up/Down moves between fields. Enter,
+with the displayed choices; the action names the selected agent (for example, Start Codex).
+Up/Down moves between fields and previews their choices on the right. Enter,
Right or typing enters the chooser. Tab switches between the form and chooser; Enter accepts
an item and returns to New Harness. A second Enter starts it in the current window, splitting
beside the focused pane when needed. Lowercase `C-b n` remains next window.
@@ -174,18 +175,19 @@ a path. Project search includes the 50 most recently active distinct folders per
duplicate sessions in one folder count once. Combine a machine name and folder, such as
`office harness` or `m2 harness`, in either order. The local machine's actual
name remains searchable when its label says `local`.
-Task opens an editor in the same panel: Enter accepts, Alt-Enter inserts a newline,
+Task opens an editor beside the form: Enter accepts, Alt-Enter inserts a newline,
and pasted tasks retain line breaks. Escape preserves the task in the draft. Supported agents
receive it as their first message; an unavailable first task or one exceeding the daemon's
2,000-character limit is explained before launch. A blank task starts an ordinary session.
Git projects default to a new worktree from main, as on desktop; missing main requires a branch
choice. Models and profiles are checked on the selected machine before starting.
-![New Harness with Agent, Project and Task above the visible launch settings](docs/new-harness.png)
+![Compact New Harness form with visible settings and an agent picker on the right](docs/new-harness.png)
<sub>Rendered from the isolated terminal fixture in `tests/new-harness.py`.</sub>
-Choosers open in the form's place without moving the panel. Escape returns through
+The main form stays centered and fixed as agents, fields and choosers change. Choosers extend
+to its right; in narrow terminals they temporarily occupy the form's place. Escape returns through
nested choosers and preserves a dismissed draft. Confirmed failures keep the draft and reuse
any prepared project folder on retry. A lost reply offers Check status for the original launch;
repeated Enter cannot start another harness while its outcome is unknown. Input in the form
diff --git a/tui/docs/new-harness.png b/tui/docs/new-harness.png
index 769134557..89556815d 100644
Binary files a/tui/docs/new-harness.png and b/tui/docs/new-harness.png differ
diff --git a/tui/src/new_harness.rs b/tui/src/new_harness.rs
index 7f4ece101..2481006f9 100644
--- a/tui/src/new_harness.rs
+++ b/tui/src/new_harness.rs
@@ -1,4 +1,4 @@
-//! New Harness: a keyboard-driven form, with a persistent draft and in-place choosers.
+//! New Harness: a compact keyboard-driven form, with a persistent draft and side choosers.
mod data;
mod receipt;
mod task;
@@ -209,7 +209,7 @@ impl Form {
"↑/↓ fields · Enter choose · Esc back".into()
}
}
- fn describe(&self, field: Field) -> (&str, String) {
+ fn describe(&self, field: Field) -> (String, String) {
let (label, value) = match field {
Field::Agent => (
if self.draft.what.dsh.is_some() {
@@ -221,7 +221,7 @@ impl Form {
),
Field::Project => ("Project", self.project_label()),
Field::Task => ("Task", if self.draft.task.trim().is_empty() {
- "Harness anything… (optional)".into()
+ "Add a task (optional)".into()
} else {
self.draft.task.split_whitespace().collect::<Vec<_>>().join(" ")
}),
@@ -284,13 +284,17 @@ impl Form {
} else if self.attempt.is_some() {
"Check status"
} else {
- "New Harness"
+ "Start"
},
String::new(),
),
};
(
- label,
+ if field == Field::Create && !self.starting && self.attempt.is_none() {
+ format!("Start {}", self.draft.what.label)
+ } else {
+ label.into()
+ },
self.blocked(field).map(str::to_string).unwrap_or(value),
)
}
@@ -781,7 +785,7 @@ fn child(app: &mut App, form: &mut Form, kind: Choice, initial: &str) {
Choice::Path => "/path/to/project or ~/project",
Choice::Clone => "GitHub URL or owner/repository",
Choice::NewFolder => "Folder name (optional)",
- Choice::Task => "Harness anything…",
+ Choice::Task => "Describe the task…",
};
let mut picker = Picker::new("", hint);
picker.keep_order = kind != Choice::Project;
@@ -1299,7 +1303,7 @@ pub fn key(app: &mut App, mut form: Box<Form>, key: KeyEvent) {
}
}
KeyCode::Enter | KeyCode::Char(' ') => launch = activate(app, &mut form),
- KeyCode::Right if form.child.is_some() || form.focus == Field::Worktree => {
+ KeyCode::Right if form.focus != Field::Create => {
activate(app, &mut form);
}
KeyCode::Left | KeyCode::PageUp | KeyCode::PageDown
@@ -1312,6 +1316,9 @@ pub fn key(app: &mut App, mut form: Box<Form>, key: KeyEvent) {
.modifiers
.intersects(KeyModifiers::CONTROL | KeyModifiers::ALT) =>
{
+ if form.child.is_none() && form.focus != Field::Create {
+ reveal(app, &mut form);
+ }
if form.child.is_some() {
form.child_active = true;
form.child.as_mut().unwrap().picker.type_char(ch);
@@ -1654,8 +1661,7 @@ mod tests {
app
}
- /// Opening a chooser within the form leaves the panel where it was, on a wide
- /// window and a narrow one.
+ /// Opening a chooser leaves the main form where it was, on a wide window and a narrow one.
#[tokio::test]
async fn the_form_stays_put_when_a_chooser_opens() {
let mut app = app();
@@ -1840,6 +1846,7 @@ mod tests {
let Some(Modal::NewHarness(mut form)) = app.modal.take() else {
panic!()
};
+ form.focus = Field::Agent;
child(&mut app, &mut form, Choice::Agent, "codex");
app.modal = Some(Modal::NewHarness(form));
refresh(&mut app);
@@ -1857,6 +1864,16 @@ mod tests {
};
assert!(form.child.is_none());
assert!(matches!(&form.draft.project, Project::Folder(p) if p == "/home/dev/project"));
+ let Some(Modal::NewHarness(form)) = app.modal.take() else { panic!() };
+ key(&mut app, form, KeyEvent::new(KeyCode::Right, KeyModifiers::NONE));
+ let Some(Modal::NewHarness(form)) = app.modal.take() else { panic!() };
+ assert!(form.child_active);
+ key(&mut app, form, KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
+ let Some(Modal::NewHarness(form)) = app.modal.take() else { panic!() };
+ key(&mut app, form, KeyEvent::new(KeyCode::Char('c'), KeyModifiers::NONE));
+ let Some(Modal::NewHarness(form)) = &app.modal else { panic!() };
+ assert!(form.child_active);
+ assert_eq!(form.child.as_ref().unwrap().picker.query, "c");
app.modal = Some(Modal::Confirm {
prompt: "keep me".into(),
command: "".into(),
@@ -1899,14 +1916,14 @@ mod tests {
}
#[tokio::test]
- async fn the_form_is_the_panel_centered_and_anchored_at_every_terminal_size() {
+ async fn compact_form_and_side_choosers_stay_anchored_at_every_terminal_size() {
let mut app = app();
open(&mut app, None, None);
let Some(Modal::NewHarness(mut form)) = app.modal.take() else {
panic!()
};
for width in [
- 1, 10, 21, 22, 45, 80, 109, 110, 120, 122, 123, 124, 150, 220,
+ 1, 10, 21, 22, 45, 80, 109, 110, 120, 128, 130, 131, 132, 150, 220,
] {
for height in [1, 4, 5, 10, 14, 24, 42] {
let area = Rect::new(3, 2, width, height);
@@ -1924,31 +1941,42 @@ mod tests {
form.child_active = active;
let mut buf = Buffer::empty(area);
if let Some(cursor) = draw(&mut buf, area, &mut form) {
+ assert!(active, "a preview must not take keyboard focus");
assert!(area.contains(cursor), "{area:?} {cursor:?}");
}
for (hit, _) in &form.hits {
assert_eq!(hit.intersection(area), *hit);
}
if form.area.width > 0 {
- // The menus' panel: one size and place whatever is open.
- assert_eq!(form.area, crate::settings::area(area));
+ assert!(form.area.width <= 60 && form.area.height <= 17);
let left = form.area.x - area.x;
let right = area.right() - form.area.right();
assert!(left.abs_diff(right) <= 1, "not centered in {area:?}");
let top = form.area.y - area.y;
let bottom = area.bottom() - form.area.bottom();
assert!(top.abs_diff(bottom) <= 1, "not centered in {area:?}");
- let position = (form.area.x, form.area.y, form.area.width);
assert_eq!(
- *anchor.get_or_insert(position),
- position,
+ *anchor.get_or_insert(form.area),
+ form.area,
"form moved in {area:?}: engine={engine}, active={active}"
);
assert_eq!(form.area.intersection(area), form.area);
}
- // A chooser opens in the form's place, as a section of Appearance does.
if form.child_area.width > 0 {
- assert_eq!(form.child_area, form.area);
+ assert_eq!(form.child_area.intersection(area), form.child_area);
+ assert_eq!(form.child_area.y, form.area.y);
+ if form.child_area.x == form.area.x {
+ assert!(active, "narrow previews must leave the form visible");
+ assert_eq!(form.child_area, form.area);
+ } else {
+ assert_eq!(form.child_area.x, form.area.right() + 2);
+ assert!(form.child_area.width >= 32);
+ }
+ }
+ if width >= 80 && height >= 24
+ && (form.child_area.is_empty() || form.child_area.x > form.area.x)
+ {
+ assert_eq!(form.hits.len(), form.fields().len(), "all settings stay visible");
}
}
}
@@ -1957,6 +1985,28 @@ mod tests {
}
}
+ #[tokio::test]
+ async fn project_chooser_keeps_the_selected_row_visible_past_the_action_separator() {
+ let mut app = app();
+ open(&mut app, None, None);
+ let Some(Modal::NewHarness(mut form)) = app.modal.take() else { panic!() };
+ child(&mut app, &mut form, Choice::Project, "");
+ form.child_active = true;
+ let mut rows = vec![Row::new("clone", "Clone Repository"), Row::new("folder", "Open Folder"), Row::new("new", "New Folder")];
+ rows.extend((0..50).map(|n| Row::new(format!("at:local\t/project-{n}"), format!("project-{n} @ local"))));
+ form.child.as_mut().unwrap().picker.set_rows(rows);
+ for width in [80, 150] {
+ let area = Rect::new(0, 0, width, 42);
+ let count = form.child.as_ref().unwrap().picker.visible.len();
+ for cursor in (0..count).chain((0..count).rev()) {
+ form.child.as_mut().unwrap().picker.cursor = cursor;
+ draw(&mut Buffer::empty(area), area, &mut form);
+ let picker = &form.child.as_ref().unwrap().picker;
+ assert!(picker.row_at.iter().any(|(_, row)| *row == cursor), "selected row {cursor} is hidden at width {width}");
+ }
+ }
+ }
+
#[tokio::test]
async fn terminal_resize_before_its_input_event_keeps_the_form_and_choosers_in_frame() {
for choice in [None, Some(Choice::Agent), Some(Choice::Task)] {
diff --git a/tui/src/new_harness/task.rs b/tui/src/new_harness/task.rs
index 2a934d4d7..b48781f18 100644
--- a/tui/src/new_harness/task.rs
+++ b/tui/src/new_harness/task.rs
@@ -1,4 +1,4 @@
-//! The optional first task, edited in the same panel as the form's other choices.
+//! The optional first task, edited beside the form (in its place on narrow terminals).
use super::*;
// Keep these aligned with cli/src/lib/engineLaunch.ts and desktop/lib/core/first_task.dart.
@@ -112,11 +112,12 @@ pub(super) fn move_vertical(picker: &mut Picker, delta: isize, width: usize) {
fn text_area(r: Rect) -> Rect {
let top = if r.height >= 8 { 4 } else { 1 };
+ let footer = if r.width < 43 && r.height >= 9 { 3 } else { 2 };
Rect::new(
r.x + 3,
r.y + top,
r.width.saturating_sub(6).max(1),
- r.height.saturating_sub(top + 2).max(1),
+ r.height.saturating_sub(top + footer).max(1),
)
}
@@ -135,6 +136,7 @@ pub(super) fn draw(
panel: Rect,
picker: &mut Picker,
error: &str,
+ active: bool,
base: Style,
muted: Style,
accent: Style,
@@ -178,14 +180,26 @@ pub(super) fn draw(
}
}
let y = r.y + (row - picker.scroll) as u16;
- view::put(buf, panel.x + 1, y, 1, "›", accent);
+ if active {
+ view::put(buf, panel.x + 1, y, 1, "›", accent);
+ }
+ let short_footer = panel.width < 43 && panel.height >= 9;
+ if error.is_empty() && short_footer && active {
+ view::put(buf, panel.x + 2, panel.bottom() - 3, panel.width - 4, "Alt-Enter newline", muted);
+ }
view::put(
buf,
panel.x + 2,
panel.bottom() - if panel.height >= 5 { 2 } else { 1 },
panel.width.saturating_sub(4),
if error.is_empty() {
- "Enter done · Alt-Enter newline · Esc back"
+ if !active {
+ "Enter or → to edit"
+ } else if short_footer {
+ "Enter done · Esc back"
+ } else {
+ "Enter done · Alt-Enter newline · Esc back"
+ }
} else {
error
},
diff --git a/tui/src/new_harness/view.rs b/tui/src/new_harness/view.rs
index 930912b8d..616a847cd 100644
--- a/tui/src/new_harness/view.rs
+++ b/tui/src/new_harness/view.rs
@@ -75,21 +75,33 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {
..
} = crate::settings::chrome();
crate::settings::backdrop(buf, body, backdrop);
- // The form is the menus' panel: centred, the one size whatever is open — and a chooser (an
- // agent, a machine, a folder…) opens in its place, as a section of Appearance does, so
- // nothing moves.
- let side = false;
- let r = crate::settings::area(body);
- let (x, y, form_w, form_h) = (r.x, r.y, r.width, r.height);
- let (child_w, child_h) = (form_w, form_h);
+ // Center the form, not the combined form and chooser. Reserve enough rows for every
+ // agent's settings so changing agents or opening an editor never moves the form.
+ let form_w = body.width.saturating_sub(4).min(60);
+ let form_h = body.height.saturating_sub(2).clamp(5, 17);
+ let x = body.x + (body.width - form_w) / 2;
+ let y = body.y + (body.height - form_h) / 2;
+ let r = Rect::new(x, y, form_w, form_h);
+ let side_w = body.right().saturating_sub(r.right() + 4).min(60);
+ let side = side_w >= 32;
+ let child_w = if side { side_w } else { form_w };
+ let child_h = if side {
+ body.bottom().saturating_sub(y + 1).min(22).max(form_h)
+ } else {
+ form_h
+ };
let fields = form.fields();
+ let fields_y = y + if form_h >= 9 { 3 } else { 1 };
let errors = error_lines(&form.error, form_w.saturating_sub(4) as usize);
- let error_h = errors.len().min(form_h.saturating_sub(4).max(1) as usize) as u16;
+ // Even a long error in a tiny terminal leaves one field (the focused action) visible.
+ let error_h = errors.len().min(r.bottom().saturating_sub(fields_y + 2).max(1) as usize) as u16;
form.area = r;
if form.child.is_none() || side || !form.child_active {
panel(buf, r, base);
+ if form_h >= 9 {
+ put(buf, x + 3, y + 1, form_w - 6, "New Harness", base.add_modifier(Modifier::BOLD));
+ }
let error_y = r.bottom() - 1 - error_h;
- let fields_y = r.y + if form_h < 5 { 0 } else { 2 };
let capacity = error_y.saturating_sub(fields_y);
let mut row: u16 = 0;
let rows: Vec<_> = fields
@@ -135,7 +147,7 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {
} else {
label_w
},
- label,
+ &label,
if *field == Field::Create {
st.add_modifier(Modifier::BOLD)
} else {
@@ -205,15 +217,17 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {
form.child_area = r;
panel(buf, r, base);
if c.kind == Choice::Task {
- return Some(task::draw(
+ let cursor = task::draw(
buf,
r,
&mut c.picker,
&form.error,
+ form.child_active,
base,
muted,
accent,
- ));
+ );
+ return form.child_active.then_some(cursor);
}
let query_x = r.x + 4;
let query_y = r.y + 2;
@@ -242,7 +256,14 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {
);
c.picker.row_at.clear();
if !c.kind.editing() {
- let rows = r.height.saturating_sub(6) as usize;
+ // Project's blank line between folder actions and recents occupies a display row too.
+ // Reserve it in the scroll window so the selected item cannot hide under the footer.
+ let separated = c.kind == Choice::Project && c.picker.query.is_empty()
+ && c.picker.visible.windows(2).any(|pair| {
+ !c.picker.rows[pair[0].0].id.starts_with("at:")
+ && c.picker.rows[pair[1].0].id.starts_with("at:")
+ });
+ let rows = r.height.saturating_sub(6 + u16::from(separated)) as usize;
c.picker.page_rows.set(rows as i64);
c.picker.scroll = c
.picker
@@ -319,7 +340,11 @@ pub fn draw(buf: &mut Buffer, body: Rect, form: &mut Form) -> Option<Position> {
let hint = if !form.error.is_empty() {
&form.error
} else {
- c.picker.busy.as_deref().unwrap_or("")
+ c.picker.busy.as_deref().unwrap_or(if form.child_active {
+ "Enter select · Esc back"
+ } else {
+ "Enter or → to choose"
+ })
};
put(buf, r.x + 2, r.bottom() - 2, r.width - 4, hint, muted);
form.child_active.then(|| {
diff --git a/tui/tests/fresh-user.py b/tui/tests/fresh-user.py
index ff5fc41a0..c44688206 100644
--- a/tui/tests/fresh-user.py
+++ b/tui/tests/fresh-user.py
@@ -152,7 +152,7 @@ class User:
def launch(self, engine, label, double_enter=False, click_create=False):
before = {s['id'] for s in self.status()['sessions']}
if click_create:
- self.field('New Harness')
+ self.field('Start ' + {'codex': 'Codex', 'claude': 'Claude Code', 'terminal': 'Terminal'}[engine])
else:
self.keys(*(['Enter', 'Enter'] if double_enter else ['Enter']))
added = self.check(lambda: [s for s in self.status()['sessions'] if s['id'] not in before],
diff --git a/tui/tests/new-harness.py b/tui/tests/new-harness.py
index 2c1256bbf..15d72b892 100644
--- a/tui/tests/new-harness.py
+++ b/tui/tests/new-harness.py
@@ -51,11 +51,19 @@ def state(route='dial'):
return result.get('data', result)
def screen(): return tmux('capture-pane', '-p', '-t', 'test')
+def form_bounds(lines):
+ width, height = max(map(len, lines), default=0), len(lines) - 1
+ form_w, form_h = min(60, max(0, width - 4)), min(17, max(5, height - 2))
+ return (width - form_w) // 2, max(0, (height - form_h) // 2), form_w, form_h
+def form_screen():
+ lines = screen().splitlines()
+ left, top, width, height = form_bounds(lines)
+ return '\n'.join(line[left:left+width] for line in lines[top:top+height])
def settle_ui():
# Wait for chooser content to redraw, not just tmux send-keys returning,
# before taking mouse coordinates.
- # The panel is borderless; crop inside its central 90% surface so animated
- # working panes around it cannot keep it unsettled.
+ # The panels are borderless; crop around the centered form and right-hand chooser
+ # so animated working panes around them cannot keep the fixture unsettled.
previous, changed = None, time.monotonic()
deadline = changed + 3
while time.monotonic() < deadline:
@@ -64,8 +72,16 @@ def settle_ui():
if not any('›' in line for line in lines):
return
width = max(map(len, lines), default=0)
- padx, pady = width // 20 + 2, len(lines) // 20 + 2
- signature = tuple(line[padx:width-padx] for line in lines[pady:len(lines)-pady])
+ height = len(lines) - 1 # hn's bottom status line
+ left, top, form_w, form_h = form_bounds(lines)
+ side = width - (left + form_w) - 4 >= 32
+ signature = tuple(line[left:left+form_w] for line in lines[top:top+form_h])
+ child_left = left + form_w + 2
+ header = lines[top+2][child_left+2:].lstrip() if top + 2 < len(lines) else ''
+ if side and (header.startswith('›') or header.startswith('Task (optional)')):
+ child_right = child_left + min(60, width - left - form_w - 4)
+ bottom = min(height - 1, top + 22)
+ signature += tuple(line[child_left:child_right] for line in lines[top:bottom])
if signature != previous:
previous, changed = signature, time.monotonic()
elif time.monotonic() - changed >= .15:
@@ -73,6 +89,10 @@ def settle_ui():
time.sleep(.025)
raise AssertionError('popup did not settle\n' + screen())
def keys(*args):
+ # Crossterm coalesces adjacent ESC bytes into one event; exercise separate back presses.
+ if len(args) > 1 and 'Escape' in args:
+ for key in args: keys(key)
+ return
tmux('send-keys', '-t', 'test', *args)
settle_ui()
def type_text(text): tmux('send-keys', '-l', '-t', 'test', text)
@@ -97,16 +117,20 @@ def click(x, y):
def field_at(label):
# A field's label: after a space, the pointer or an edge (the form is a borderless panel).
return r'(?<![^\s│›])(' + label + r')(?= {2,}|$)'
+def field_position(label):
+ lines = screen().splitlines()
+ left, top, width, height = form_bounds(lines)
+ for y, line in enumerate(lines[top:top+height], top):
+ # Labels begin at the field column; "Harness" in the dialog title is not a field.
+ m = re.match(r'^[ ›]{3}(' + re.escape(label) + r')(?= {2,}|$)', line[left:left+width])
+ if m: return left + m.start(1), y
def field(label):
- def find():
- for y, line in enumerate(screen().splitlines()):
- m = re.search(field_at(re.escape(label)), line)
- if m: return m.start(1), y
- wait(find, f'field {label}')
- click(*find())
+ wait(lambda: field_position(label), f'field {label}')
+ click(*field_position(label))
def choose_field(label, query):
- field(label); type_text(query); keys('Enter'); shows('New Harness')
-def form_visible(): return re.search(field_at('Task'), screen()) is not None
+ field(label); type_text(query); keys('Enter')
+ wait(lambda: re.search(r'› Start ', form_screen()), 'choice accepted; launch action focused')
+def form_visible(): return re.search(field_at('Task'), form_screen()) is not None
def new_form():
keys('C-b', 'N'); wait(form_visible, 'New Harness form')
def placement():
@@ -150,6 +174,7 @@ try:
keys('C-b', 'n')
wait(lambda: hn('display-message', '-p', '#{window_id}') != first_window, 'lowercase n remains next-window')
keys('C-b', 'p'); new_form()
+ anchor = field_position('Task')
snapshot('new-harness-form')
before = create_count()
input_before = len(state('reconnect')['inputs'])
@@ -158,13 +183,17 @@ try:
field('Project'); type_text('m2 webapp'); keys('Enter'); shows('webapp @ local')
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)
- # The chooser opens in the form's place (the panel stays put), once you go into it.
- keys('Down'); assert 'Search agents and harnesses' not in screen(), 'moving over Agent keeps the form'
+ # Moving over a field previews its choices beside the stationary form.
+ keys('Down'); shows('Search agents and harnesses')
+ assert field_position('Task') == anchor, 'a preview must not move or hide the form'
+ assert any(line.find('Search agents and harnesses') > anchor[0] + 50 for line in screen().splitlines())
keys('Tab'); shows('Search agents and harnesses')
+ assert field_position('Task') == anchor, 'entering a chooser keeps the form visible'
assert 'Blender' in screen(), 'the agent chooser lists the harnesses'
snapshot('new-harness-agent')
type_text('codex'); keys('Escape')
- shows('Approvals'); field('Agent'); type_text('codex'); keys('Enter')
+ 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')
raw('\x1b[200~autonomous-ai/openharness\x1b[201~'); keys('Enter')
@@ -173,10 +202,11 @@ try:
field('Project'); type_text('new folder'); keys('Enter'); shows('Choose a machine'); 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'), screen()), 'settings are direct fields; machine belongs in Project'
+ assert not re.search(field_at('Options|Machine'), form_screen()), 'settings are direct fields; machine belongs in Project'
choose_field('Approvals', 'read only'); shows('Read only')
task_text = 'Fix café login.\n\nKeep 界 and 🦀 intact.\nAdd a regression test.'
field('Task'); shows('Task (optional)')
+ assert field_position('Task') == anchor, 'the task editor keeps the form visible and fixed'
raw('\x1b[200~Fix café login.\r\n\r\nKeep 界 and 🦀 intact.\x1b[201~')
shows('Keep 界 and 🦀 intact.')
keys('M-Enter'); type_text('Add a regression test.'); keys('Enter')
@@ -220,15 +250,16 @@ try:
assert 'codexHome' not in request, request
print('PASS New Harness: machine-scoped profiles and explicit model routes', flush=True)
- # (Blender asks for its coding agent next, in the form's place.)
+ # Blender asks for its coding agent next in the same side chooser.
new_form(); field('Agent'); type_text('Blender'); keys('Enter'); shows('Choose a coding agent'); type_text('codex'); keys('Enter'); shows('Blender · Codex')
submit(before + 6)
assert state()['created'][-1]['dsh'] == 'example/blender'
new_form(); choose_field('Harness', 'Terminal')
- assert not re.search(field_at('Model|Approvals|Profile'), screen()), 'Terminal omits irrelevant settings'
+ snapshot('new-harness-terminal')
+ assert not re.search(field_at('Model|Approvals|Profile'), form_screen()), 'Terminal omits irrelevant settings\n' + screen()
# Return focus to the action without accepting any of the disabled Git rows.
before_terminal = placement()
- field('New Harness')
+ field('Start Terminal')
wait(lambda: create_count() == before + 7 and not form_visible(), 'terminal launch')
placed_in_current_window(before_terminal)
request = state()['created'][-1]
@@ -256,7 +287,7 @@ try:
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]')
- tmux('resize-window', '-t', 'test', '-x', '100', '-y', '26'); settle_ui()
+ tmux('resize-window', '-t', 'test', '-x', '150', '-y', '42'); settle_ui()
snapshot('new-harness-flat')
field('Task'); shows('Task (optional)')
raw('\x1b[200~Improve the New Harness keyboard flow.\nKeep the launch settings visible.\x1b[201~')
@@ -266,10 +297,10 @@ try:
tmux('resize-window', '-t', 'test', '-x', '80', '-y', '24'); settle_ui()
snapshot('new-harness-flat-narrow')
# Clearing the task allows an unsupported engine; it must never silently discard one.
- choose_field('Agent', 'Terminal'); field('New Harness'); shows('This agent cannot start with a task')
+ choose_field('Agent', 'Terminal'); field('Start Terminal'); shows('This agent cannot start with a task')
assert create_count() == count, 'an unsupported task is rejected before creating a harness'
field('Task'); keys('C-a', 'C-k', 'Enter'); choose_field('Agent', 'claude')
- field('Task'); type_text('x' * 2001); keys('Enter'); field('New Harness'); shows('Task is too long')
+ field('Task'); type_text('x' * 2001); keys('Enter'); field('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-a', 'C-k', 'Enter')
tmux('resize-window', '-t', 'test', '-x', '150', '-y', '42'); settle_ui()