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.

hn 0.1.16: a pane's title names no agent or model; a subscription shows no key (#1000)

lingrd4d65f3e8a124
diff --git a/tui/Cargo.lock b/tui/Cargo.lock
index 2a2614599..0a758424e 100644
--- a/tui/Cargo.lock
+++ b/tui/Cargo.lock
@@ -654,7 +654,7 @@ dependencies = [
[[package]]
name = "harness-tui"
-version = "0.1.15"
+version = "0.1.16"
dependencies = [
"alacritty_terminal",
"base64",
diff --git a/tui/Cargo.toml b/tui/Cargo.toml
index 82ad646e7..860a56eb7 100644
--- a/tui/Cargo.toml
+++ b/tui/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "harness-tui"
-version = "0.1.15"
+version = "0.1.16"
edition = "2024"
[dependencies]
diff --git a/tui/src/agent_switch.rs b/tui/src/agent_switch.rs
index 9861d6b7a..48f591511 100644
--- a/tui/src/agent_switch.rs
+++ b/tui/src/agent_switch.rs
@@ -275,9 +275,6 @@ pub fn pane_supports(app: &App, pane: u64) -> bool {
&& app.fleet.machine(&a.machine_id).is_some_and(|m| !m.shared))
}
-pub fn pane_label(app: &App, pane: u64) -> String {
- source_for(app, pane).map(|a| theme::engine_label(&a.engine).to_string()).unwrap_or_else(|| "Agent".into())
-}
fn engines(app: &App, source: &Agent) -> Vec<String> {
let all = crate::modal::ENGINES.iter().filter(|e| **e != "terminal").map(|e| e.to_string()).collect::<Vec<_>>();
diff --git a/tui/src/main.rs b/tui/src/main.rs
index c44ac11c9..a631ea0a7 100644
--- a/tui/src/main.rs
+++ b/tui/src/main.rs
@@ -70,7 +70,6 @@ mod bar;
mod bar_more;
// ── models: the Models view (step 6) ──
mod models;
-mod runtime_model;
mod autoname;
use std::io::{self, BufWriter, Write};
diff --git a/tui/src/models.rs b/tui/src/models.rs
index ad1ff7cca..612b28346 100644
--- a/tui/src/models.rs
+++ b/tui/src/models.rs
@@ -429,15 +429,6 @@ pub fn pane_supports(app: &App, pane: u64) -> bool {
&& app.fleet.agent(&p.machine_id, &p.agent_id).is_some_and(|a| a.status != "stopped" && ["codex", "claude", "opencode"].contains(&a.engine.as_str()))
}
-pub fn pane_label(app: &App, pane: u64) -> String {
- let observed = app.panes.get(&pane).and_then(|p| app.fleet.agent(&p.machine_id, &p.agent_id)).and_then(|a| {
- if !a.grid_model.is_empty() { Some(a.grid_model.clone()) }
- else { crate::runtime_model::details(&a.model, &a.id, &a.engine).map(|m| m.name) }
- });
- let label = observed.unwrap_or_else(|| "Model".into()).chars().filter(|c| !c.is_control()).collect::<String>();
- crate::format::clip_middle(&label, 24)
-}
-
pub fn target(app: &App) -> Option<Target> {
let of = |machine: String, agent: String| -> Option<Target> {
if app.fleet.machine(&machine).is_some_and(|m| m.shared) { return None }
@@ -1836,7 +1827,8 @@ pub fn preview(app: &App, id: &str) -> Vec<Line<'static>> {
if let Some(rest) = id.strip_prefix("mv:sub:") {
let Some(sub) = subscriptions(app).into_iter().find(|s| format!("{}\t{}", s.engine, s.account) == rest) else { return vec![] };
let low = sub.left.is_some_and(|l| l <= LOW_WATER);
- let mut out = vec![bold(if sub.account.is_empty() { sub.title.clone() } else { format!("{} · key ···{}", sub.title, sub.account) })];
+ // (The subscription's name alone: its key is not shown.)
+ let mut out = vec![bold(sub.title.clone())];
out.push(match sub.left { Some(_) if low => warn(format!("{} · Running low", sub.status)), Some(_) => Line::raw(format!("{} · Healthy", sub.status)), None => Line::raw(sub.status.clone()) });
match sub_word(app, &sub, t).as_str() {
SWITCHING => out.push(Line::raw(format!("{SWITCHING} this harness is going back to its own login"))),
diff --git a/tui/src/runtime_model.rs b/tui/src/runtime_model.rs
deleted file mode 100644
index 38a0e4179..000000000
--- a/tui/src/runtime_model.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-//! The desktop's observed model label contract. Metadata is scoped to an agent and engine;
-//! absent or stale metadata must not invent a model or an effort.
-use std::sync::OnceLock;
-use regex::Regex;
-
-#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct Details { pub name: String, pub effort: String }
-
-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() {
- bytes.push(if b == b'%' {
- let high = (input.next()? as char).to_digit(16)?;
- let low = (input.next()? as char).to_digit(16)?;
- (high * 16 + low) as u8
- } else { b });
- }
- String::from_utf8(bytes).ok()
-}
-
-fn title(value: &str) -> String {
- let mut chars = value.chars();
- chars.next().map(|first| first.to_uppercase().collect::<String>() + chars.as_str()).unwrap_or_default()
-}
-
-pub fn details(value: &str, agent: &str, engine: &str) -> Option<Details> {
- if value.encode_utf16().count() > 1024 { return None }
- static WIRE: OnceLock<Regex> = OnceLock::new();
- static CLAUDE: OnceLock<Regex> = OnceLock::new();
- static GPT: OnceLock<Regex> = OnceLock::new();
- static PATH: OnceLock<Regex> = OnceLock::new();
- let found = WIRE.get_or_init(|| Regex::new(r"(?i)^runtime-v1:([^:]+):([a-z0-9_-]+):([^@]+)@([a-z0-9_-]+)$").unwrap()).captures(value)?;
- if !found[2].eq_ignore_ascii_case(engine) || decode(&found[1])? != agent { return None }
- let mut name = decode(&found[3])?.trim().to_string();
- if engine.eq_ignore_ascii_case("opencode") {
- if let Some(path) = PATH.get_or_init(|| Regex::new(r" {3,}(?:/|~/|[A-Za-z]:[\\/])").unwrap()).find(&name) {
- name.truncate(path.start());
- }
- }
- if name.is_empty() || name == "<synthetic>" || name.encode_utf16().count() > 256 || name.chars().any(|c| c <= '\u{1f}' || c == '\u{7f}') { return None }
- if let Some(c) = CLAUDE.get_or_init(|| Regex::new(r"(?i)^(?:claude-)?(fable|opus|sonnet|haiku)(?:-(\d+(?:[-.]\d{1,2})*))?(\[1m\])?$").unwrap()).captures(&name) {
- name = format!("{}{}{}", title(&c[1].to_lowercase()), c.get(2).map(|v| format!(" {}", v.as_str().replace('-', "."))).unwrap_or_default(), c.get(3).map(|s| s.as_str()).unwrap_or(""));
- } else if let Some(c) = GPT.get_or_init(|| Regex::new(r"(?i)^gpt-(\d+(?:\.\d+)*)(?:-(astra|sol|terra|luna|codex))?$").unwrap()).captures(&name) {
- name = format!("GPT-{}{}", &c[1], c.get(2).map(|s| format!(" {}", title(&s.as_str().to_lowercase()))).unwrap_or_default());
- }
- Some(Details { name, effort: found[4].to_lowercase() })
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn names_match_desktop_and_never_infer_versions() {
- for (engine, raw, want) in [
- ("codex", "gpt-6-astra", "GPT-6 Astra"), ("codex", "gpt-5.6-sol", "GPT-5.6 Sol"), ("codex", "gpt-5.6", "GPT-5.6"),
- ("claude", "fable", "Fable"), ("claude", "opus", "Opus"), ("claude", "claude-opus-5", "Opus 5"),
- ("claude", "claude-sonnet-4-6%5B1m%5D", "Sonnet 4.6[1m]"),
- ("claude", "claude-haiku-4-5-20251001", "claude-haiku-4-5-20251001"), ("opencode", "provider%2FModel-Next", "provider/Model-Next"),
- ] {
- let parsed = details(&format!("runtime-v1:a%3A1:{engine}:{raw}@HIGH"), "a:1", engine).unwrap();
- assert_eq!(parsed, Details { name: want.into(), effort: "high".into() });
- }
- assert_eq!(details("runtime-v1:a:opencode:Model%20%20%20%20%2Fprivate%2Fwork@auto", "a", "opencode").unwrap().name, "Model");
- assert_eq!(details("runtime-v1:a:opencode:Model%20%20%20C%3A%5Cwork@auto", "a", "opencode").unwrap().name, "Model");
- assert_eq!(details("runtime-v1:a:opencode:provider%2FModel+Next@auto", "a", "opencode").unwrap().name, "provider/Model+Next");
- }
-
- #[test]
- fn malformed_or_foreign_metadata_has_no_label() {
- for value in ["", "gpt-6-astra", "runtime-v2:a:codex:gpt-6-astra@high", "runtime-v1:a:claude:opus@high", "runtime-v1:other:codex:model@high",
- "runtime-v1:%ZZ:codex:model@high", "runtime-v1:a:codex:%ZZ@high", "runtime-v1:a:codex:%FF@high", "runtime-v1:a:codex:%C0%80@high",
- "runtime-v1:a:codex:%20@high", "runtime-v1:a:codex:%3Csynthetic%3E@high", "runtime-v1:a:codex:model%0Aname@high"] {
- assert!(details(value, "a", "codex").is_none(), "{value}");
- }
- for raw in ["x".repeat(257), "x".repeat(1025)] { assert!(details(&format!("runtime-v1:a:codex:{raw}@high"), "a", "codex").is_none()); }
- }
-}
diff --git a/tui/src/workspace_controls.rs b/tui/src/workspace_controls.rs
index f85bc42a1..437f08a8d 100644
--- a/tui/src/workspace_controls.rs
+++ b/tui/src/workspace_controls.rs
@@ -9,7 +9,7 @@ use unicode_width::UnicodeWidthStr;
use crate::{app::App, draw::RangeKind, theme, workspace_menu as menu};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum Action { New, Menu, Account, Header(u64), PaneMenu(u64), Agent(u64), Model(u64), Close(u64) }
+pub enum Action { New, Menu, Account, Header(u64), PaneMenu(u64), Close(u64) }
#[derive(Default)]
pub struct State {
@@ -39,22 +39,8 @@ pub fn register(app: &App, rect: Rect, action: Action) {
pub fn title_reserve(app: &App, window: usize, pane: u64, width: u16) -> u16 {
let tab = app.tabs.get(window).map(|t| t.id.as_str()).unwrap_or("");
if !enabled(app) || !app.mouse || width < 20 || app.options.has_window_override("pane-border-format", tab, pane) { return 0 }
- 6 + identity_labels(app, pane, width).iter().map(|(label, _)| label.width() as u16 + 2).sum::<u16>()
-}
-
-fn identity_labels(app: &App, pane: u64, width: u16) -> Vec<(String, Action)> {
- let mut labels = Vec::new();
- let mut available = width.saturating_sub(30);
- if crate::agent_switch::pane_supports(app, pane) {
- let label = crate::agent_switch::pane_label(app, pane);
- let size = label.width() as u16 + 2;
- if size <= available { available -= size; labels.push((label, Action::Agent(pane))); }
- }
- if crate::models::pane_supports(app, pane) {
- let label = crate::models::pane_label(app, pane);
- if label.width() as u16 + 2 <= available { labels.push((label, Action::Model(pane))); }
- }
- labels
+ // (No agent or model label: the … menu changes both.)
+ 6
}
/// Return the title's remaining space. The controls never add a row or resize a terminal.
@@ -64,13 +50,6 @@ pub fn title(buf: &mut Buffer, app: &App, pane: u64, rect: Rect, style: Style) -
register(app, rect, Action::Header(pane));
let quiet = style.remove_modifier(Modifier::BOLD | Modifier::DIM).fg(theme::paint(theme::pane_palette().muted));
let x = rect.right() - 6;
- let mut start = rect.right() - reserve;
- for (label, action) in identity_labels(app, pane, rect.width) {
- let size = label.width() as u16 + 2;
- buf.set_stringn(start, rect.y, format!(" {label} "), size as usize, quiet);
- register(app, Rect::new(start, rect.y, size, 1), action);
- start += size;
- }
buf.set_stringn(x, rect.y, " … × ", 6, quiet);
register(app, Rect::new(x, rect.y, 3, 1), Action::PaneMenu(pane));
register(app, Rect::new(x + 3, rect.y, 3, 1), Action::Close(pane));
@@ -119,8 +98,6 @@ pub fn activate(app: &mut App, action: Action, at: Option<(u16, u16)>) {
Action::Account => crate::account::open(app),
Action::Header(pane) => { select_pane(app, pane); }
Action::PaneMenu(pane) => pane_menu(app, pane, at),
- Action::Agent(pane) => if select_pane(app, pane) { crate::agent_switch::open(app, pane); },
- Action::Model(pane) => if crate::models::pane_supports(app, pane) && select_pane(app, pane) { crate::input::run(app, "models"); },
Action::Close(pane) => crate::session_close::pane(app, pane),
}
}
@@ -162,7 +139,7 @@ pub fn mouse(app: &mut App, mouse: &MouseEvent) -> bool {
let at = Some((mouse.column, mouse.row.saturating_add(1)));
// A title is a border in line layouts and a pane's first row in boxed layouts.
// Either explicit binding takes precedence over the added header controls.
- let places: &[&str] = if matches!(action, Some(Action::Header(_) | Action::PaneMenu(_) | Action::Agent(_) | Action::Model(_) | Action::Close(_))) { &["Border", "Pane"] } else { &["Status"] };
+ let places: &[&str] = if matches!(action, Some(Action::Header(_) | Action::PaneMenu(_) | Action::Close(_))) { &["Border", "Pane"] } else { &["Status"] };
if let MouseEventKind::Down(button @ (MouseButton::Left | MouseButton::Right)) = mouse.kind {
let defaults = crate::keys::Keymap::tmux_defaults();
for place in places {
@@ -183,7 +160,7 @@ pub fn mouse(app: &mut App, mouse: &MouseEvent) -> bool {
return true;
},
MouseEventKind::Down(MouseButton::Right) => {
- let pane = match action { Some(Action::Header(p) | Action::PaneMenu(p) | Action::Agent(p) | Action::Model(p) | Action::Close(p)) => Some(p), _ => None };
+ let pane = match action { Some(Action::Header(p) | Action::PaneMenu(p) | Action::Close(p)) => Some(p), _ => None };
if let Some(pane) = pane { begin_press(app, MouseButton::Right); pane_menu(app, pane, at); return true; }
let tab = crate::bar::hit_at(app, mouse.column, mouse.row).and_then(|hit| match hit { crate::bar::Hit::Window(i) => Some(i), _ => None }).or_else(|| {
let top = if app.status_top { 0 } else { app.size.1.saturating_sub(app.status_lines()) };
@@ -426,8 +403,8 @@ mod tests {
click(&mut app, MouseButton::Left, body.x + 4, body.y + 4);
match control {
"header" => {
- let agent = hit(&app, Action::Agent(1));
- click(&mut app, MouseButton::Left, agent.x + 1, agent.y);
+ let menu = hit(&app, Action::PaneMenu(1));
+ click(&mut app, MouseButton::Left, menu.x + 1, menu.y);
}
"dialog" => {
crate::account::open(&mut app); render(&mut app);
@@ -561,24 +538,25 @@ mod tests {
}
#[tokio::test]
- async fn plain_agent_and_model_labels_open_the_captured_panes_picker() {
+ async fn the_pane_title_names_no_agent_or_model_and_its_menu_changes_both() {
let mut app = app(120);
app.fleet.agents.get_mut(&("local".into(), "a1".into())).unwrap().model = "runtime-v1:a1:codex:gpt-6-astra@max".into();
let buf = render(&mut app);
- let model = hit(&app, Action::Model(1));
- let text: String = (model.x..model.right()).map(|x| buf[(x, model.y)].symbol()).collect();
- assert!(text.contains("GPT-6 Astra"), "{text}");
- click(&mut app, MouseButton::Left, model.x + 1, model.y);
+ let menu = hit(&app, Action::PaneMenu(1));
+ let title: String = (0..buf.area.width).map(|x| buf[(x, menu.y)].symbol()).collect();
+ assert!(!title.contains("GPT-6 Astra") && !title.contains("Codex"), "{title}");
+ pane_menu(&mut app, 1, None);
+ let token = app.controls.target.as_ref().unwrap().token.clone();
+ run(&mut app, &token, "models");
assert!(matches!(app.modal, Some(crate::modal::Modal::Picker { kind: crate::modal::PickerKind::Models, .. })));
assert_eq!(crate::models::target(&app).unwrap().agent, "a1");
app.modal = None;
- render(&mut app);
- let agent = hit(&app, Action::Agent(1));
- click(&mut app, MouseButton::Left, agent.x + 1, agent.y);
+ pane_menu(&mut app, 1, None);
+ let token = app.controls.target.as_ref().unwrap().token.clone();
+ run(&mut app, &token, "agent");
assert!(matches!(app.modal, Some(crate::modal::Modal::Picker { kind: crate::modal::PickerKind::AgentSwitch, .. })));
app.modal = None;
app.size.0 = 32; app.fit_panes(); render(&mut app);
- assert!(app.controls.hits.borrow().iter().all(|(_, a)| !matches!(a, Action::Agent(_) | Action::Model(_))));
assert!(app.controls.hits.borrow().iter().any(|(_, a)| *a == Action::PaneMenu(1)), "narrow panes retain the menu");
}
diff --git a/tui/tests/pane-ui.py b/tui/tests/pane-ui.py
index 28475c8c0..8ccca5ad8 100644
--- a/tui/tests/pane-ui.py
+++ b/tui/tests/pane-ui.py
@@ -303,7 +303,7 @@ try:
x, y, w = map(int, value('#{pane_left} #{pane_top} #{pane_width}', second).split())
def waiting_heading():
return tmux('capture-pane', '-p', '-t', 'test').splitlines()[y - 1][x:x + w].strip()
- wait(lambda: re.search(r'\(2\) \?\s+Codex\s+(?:default\s+)?…\s+×$', waiting_heading()), 'long pane names retain their suffix and waiting indicator before the mouse controls')
+ wait(lambda: re.search(r'\(2\) \?\s+…\s+×$', waiting_heading()), 'long pane names retain their suffix and waiting indicator before the mouse controls')
assert '…' in waiting_heading()
assert value('#{pane_title}', second) == long_title, 'raw pane title must remain unchanged'
hn('select-pane', '-t', second, '-T', original_title)
@@ -335,7 +335,7 @@ try:
def context_before_controls():
heading = tmux('capture-pane', '-p', '-t', 'test').splitlines()[y - 1][x:x + w].rstrip()
suffix = heading.partition(branch_context)[2]
- return branch_context in heading and bool(re.fullmatch(r'\s+(?:Claude Code\s+default\s+)?…\s+×', suffix))
+ return branch_context in heading and bool(re.fullmatch(r'\s+…\s+×', suffix))
wait(context_before_controls, 'machine, project, branch and PR align beside the right-hand controls')
snapshot('panes-zoomed' if target == first else 'panes-remote-zoomed')
keys('C-b', 'z')
diff --git a/tui/tests/workspace-controls.py b/tui/tests/workspace-controls.py
index d23b6ea04..6a8050a66 100644
--- a/tui/tests/workspace-controls.py
+++ b/tui/tests/workspace-controls.py
@@ -183,6 +183,13 @@ def painted_workspace(alpha, beta):
for name, (x, y, w) in positions)
+def pane_menu_item(item, row):
+ """The first pane's … in title row [row], then [item]: the agent and the model change there."""
+ click_text('…', row=row)
+ shown(item)
+ click_text(item)
+
+
def alpha_agent_picker():
wait(lambda: any('Change agent' in line and 'Alpha task' in line for line in screen().splitlines()),
'the visible agent picker belongs to Alpha')
@@ -332,13 +339,15 @@ def mirror_journey(command, source):
shown(source)
wait(lambda: value('#{client_width} #{client_height}') == ' '.join(original_size), 'second client reaches the owner viewport size')
before_launches = len(requests('agent_create'))
- click_text('Codex', row=0)
+ pane_menu_item('Change agent…', row=0)
shown('Change agent')
tmux('send-keys', '-l', '-t', TARGET, 'Claude')
shown('› Claude')
click_text('Claude Code', before=85)
- wait(lambda: 'Claude Code' in tmux('capture-pane', '-p', '-t', 'test:0').splitlines()[0], 'agent replacement reaches session owner')
- shown('Claude Code')
+ # (The title names no agent: the replacement is the daemon's new Claude harness, and the Stop
+ # below, from the owner's same pane, reaches it.)
+ wait(lambda: any(a['engine'] == 'claude' and a['name'] == source and a['status'] != 'stopped' for a in api()['agents'][api()['local']]),
+ 'agent replacement reaches session owner')
assert len(requests('agent_create')) == before_launches + 1
assert value('#{pane_id}') == original_pane
assert value('#{window_layout}') == original_geometry, (original_geometry, value('#{window_layout}'))
@@ -465,12 +474,13 @@ try:
assert not login_events()
wait(lambda: 'Continue with Google' not in screen(), 'back to local workspace')
- # The right header labels act on the captured pane even if external focus changes.
+ # The pane menu's agent and model act on the captured pane even if external focus changes.
x, y = map(int, value('#{pane_left} #{pane_top}', alpha).split())
- click_text('Codex', row=y - 1)
+ assert 'Codex' not in screen().splitlines()[y - 1] and 'GPT-6 Astra' not in screen().splitlines()[y - 1], 'no agent or model label in the title'
+ pane_menu_item('Change agent…', row=y - 1)
alpha_agent_picker()
keys('Escape')
- click_text('GPT-6 Astra', row=y - 1)
+ pane_menu_item('Change model…', row=y - 1)
shown('Fixture local model')
hn('select-pane', '-t', beta)
click_text('Fixture local model', before=85)
@@ -544,7 +554,8 @@ try:
print('PASS workspace: removed computer drops views and resource counts without stopping its harness', flush=True)
# A tab menu and its rename prompt retain the original tab across a focus change.
- click_text('Workspace', button=2, row=43)
+ # (Its tab shows the selected pane's title, the default tab name: found by its number.)
+ click_text(value('#{window_index}', workspace) + ':', button=2, row=43)
shown('Arrange panes')
click_text('Rename')
shown('Tab name')
@@ -615,7 +626,7 @@ try:
assert events[0]['text'] == '\x1b[<0;5;5M', events
assert events[1]['text'] == '\x1b[<0;5;5m', events
before = len(api()['inputs'])
- click_text('Codex', row=y - 1)
+ pane_menu_item('Change agent…', row=y - 1)
shown('Change agent')
assert len(api()['inputs']) == before, 'header clicks do not become program input'
keys('Escape')
@@ -631,7 +642,7 @@ try:
# forces a view-only retry: exactly one new process, unchanged pane id, focus and geometry.
api({'action': 'config', 'patch': {'closeFailure': None, 'pruneOnClose': True, 'closeDelay': 350, 'deskFailures': 1}})
original_layout = value('#{window_layout}')
- click_text('Codex', row=y - 1)
+ pane_menu_item('Change agent…', row=y - 1)
alpha_agent_picker()
tmux('send-keys', '-l', '-t', 'test', 'Claude')
shown('› Claude')