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.

Type into a busy Codex at once; route a dial notification to its tab; keep Voice on the tile

0xdiego25d9bd13c710c6
diff --git a/cli/src/lib/sessionInput.spec.ts b/cli/src/lib/sessionInput.spec.ts
index ce548e5c0..ed808c98a 100644
--- a/cli/src/lib/sessionInput.spec.ts
+++ b/cli/src/lib/sessionInput.spec.ts
@@ -17,10 +17,33 @@ function session(engine: 'claude' | 'codex' | 'cursor' | 'commandcode' = 'codex'
describe('SessionInputController', () => {
afterEach(() => vi.useRealTimers())
- it('queues Codex prompts while busy and drains exactly one after turn end', async () => {
+ it('types into a busy Codex pane at once — the TUI queues the follow-up, not the daemon', async () => {
+ // A voice command spoken while a Codex task ran used to sit in this controller's queue, invisible,
+ // until the task ended. Codex queues composer input itself, so the daemon types straight away.
const injected: string[] = []
const controller = new SessionInputController({
- getSession: () => session(), validateRuntime: async () => true,
+ getSession: () => session('codex'), validateRuntime: async () => true,
+ inject: async (_pane, content) => { injected.push(content); return true },
+ sendKey: async () => true, onError: vi.fn(),
+ // The prompt left the composer (Codex took it as a follow-up); no turn_started until the running
+ // turn ends.
+ capture: async () => '› working…\n',
+ })
+ controller.setTurnOpen('s1', true)
+ controller.submit('s1', 'second')
+ await vi.waitFor(() => expect(injected).toEqual(['second']))
+ controller.submit('s1', 'third')
+ await vi.waitFor(() => expect(injected).toEqual(['second', 'third']))
+ controller.onTurnEnded('s1')
+ controller.onTurnStarted('s1', 'second')
+ expect(injected).toEqual(['second', 'third'])
+ controller.forget('s1')
+ })
+
+ it('queues Command Code prompts while busy and drains exactly one after turn end', async () => {
+ const injected: string[] = []
+ const controller = new SessionInputController({
+ getSession: () => session('commandcode'), validateRuntime: async () => true,
inject: async (_pane, content) => { injected.push(content); return true },
sendKey: async () => true, onError: vi.fn(),
})
diff --git a/cli/src/lib/sessionInput.ts b/cli/src/lib/sessionInput.ts
index 10dc82eb8..8e35c5782 100644
--- a/cli/src/lib/sessionInput.ts
+++ b/cli/src/lib/sessionInput.ts
@@ -53,6 +53,14 @@ const SUBMIT_MAX_RETRIES = 2
// Non-cursor engines re-observe the pane (instead of erroring) while an accepted-but-not-yet-started
// prompt is in flight. Bounded so a truly wedged session eventually reverts to the retry/error path.
const SUBMIT_MAX_OBSERVES = 5
+// Engines whose own TUI queues a message typed while a turn is running, and runs it when the turn ends.
+// For these the daemon types immediately — the follow-up appears in the pane the moment it is spoken,
+// and the TUI's queue is the one the user can see and edit. Every other engine gets this file's FIFO,
+// pasted only once the pane is idle. Codex joined claude here on 2026-09-15 (owner: a voice command
+// spoken while a Codex task ran sat invisible until the task ended); Codex has queued composer input
+// since 0.36, and the retry path below already knows a prompt that left the composer without a
+// turn_started is "queued by the TUI as a follow-up", not lost.
+const TYPES_WHILE_BUSY: ReadonlySet<string> = new Set(['claude', 'codex'])
export interface SessionInputDelivery {
deliveryId: string
@@ -181,7 +189,7 @@ export class SessionInputController {
this.dropExpired(sessionId, state)
if (state.controlLocked
|| (deliveryId && (state.deliveryId || state.dispatching || state.turnOpen || state.awaitingFingerprint || state.settling))
- || (session.engine !== 'claude' && (state.turnOpen || state.awaitingFingerprint || state.settling))) {
+ || (!TYPES_WHILE_BUSY.has(session.engine) && (state.turnOpen || state.awaitingFingerprint || state.settling))) {
console.log(`[inject] ${sid(sessionId)} queued · engine=${session.engine} · depth=${state.queue.length + 1}`)
this.enqueue(sessionId, state, content, deliveryId)
return
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index f2b8ed9ba..9b218d888 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -4291,24 +4291,29 @@ class AppNotifier extends ChangeNotifier {
}
}
- /// Opens a dial notification in this swarm without changing other memberships.
+ /// A dial notification was tapped: bring that agent to the front.
///
- /// Already on screen means FOCUS it, never open it twice: the daemon keeps a
- /// single controller per agent, so a second open is a takeover — the window
- /// would fight itself and the first tile would go dark with
- /// `TERMINAL_TAKEN_OVER`.
+ /// The window is tabs now (owner, 2026-09-15): the tab that already holds
+ /// the agent wins — the current one first, then any other — and the tab
+ /// switches with the pane focused. No tab holds it: it gets a tab of its own
+ /// rather than a tile squeezed into whatever happened to be open, which is
+ /// also what keeps a full tab from turning a tap into a capacity error.
///
- /// At capacity, the usual visible capacity error asks for another swarm.
+ /// Never opened twice: the daemon keeps a single controller per agent, so a
+ /// second open is a takeover — the window would fight itself and the first
+ /// tile would go dark with `TERMINAL_TAKEN_OVER`. [revealAgentView] is what
+ /// Open Harness uses for the same reason.
Future<void> openAgentFromDial(String machineId, String agentId) async {
- // Already on the desk: it has its tile, so this is only "look at it".
- final existing = paneOfAgent(machineId, agentId);
- if (existing != null) {
- focusPane(existing.id);
+ if (revealAgentView(machineId, agentId)) {
selectedMachineId = machineId;
notifyListeners();
return;
}
- await addAgentToSwarm(machineId, agentId);
+ // Its own tab. newSwarm reuses an unused start page when there is one, and
+ // at the tab limit leaves the current tab selected — the agent then lands
+ // there, with the usual capacity message if that tab is full.
+ newSwarm();
+ await addAgentToSwarm(machineId, agentId, swarmId: activeSwarmId);
}
/// Enable-time fallback: preserve the user's current choice and acknowledge it.
diff --git a/desktop/test/dial_desk_test.dart b/desktop/test/dial_desk_test.dart
index 8c6ee4160..b3358d101 100644
--- a/desktop/test/dial_desk_test.dart
+++ b/desktop/test/dial_desk_test.dart
@@ -117,17 +117,32 @@ void main() {
// Turning the dial says where the eye is and a tile moves to match. Tapping a
// notification is a different verb: the turn just FINISHED, so it is something
// new to look at, not a replacement for what the person was already watching.
- test('a notification opens a NEW tile, leaving the others alone', () async {
- final app = await _withTiles(['a1', 'a2']);
- await app.openAgentFromDial('m1', 'a3');
+ test(
+ 'a notification for an agent in no tab opens a NEW tab for it',
+ () async {
+ // The window is tabs (owner, 2026-09-15): an agent nobody has open gets a
+ // tab of its own, and the tab it was tapped from is left as it was.
+ final app = await _withTiles(['a1', 'a2']);
+ final before = app.activeSwarmId;
+ await app.openAgentFromDial('m1', 'a3');
- expect(_desk(app), ['a1', 'a2', 'a3']);
- expect(app.focusedPane?.agentId, 'a3');
- app.dispose();
- });
+ expect(app.activeSwarmId, isNot(before));
+ expect(_desk(app), ['a3']);
+ expect(app.focusedPane?.agentId, 'a3');
+ expect(
+ app.swarms
+ .firstWhere((s) => s.id == before)
+ .panes
+ .map((p) => p.agentId),
+ ['a1', 'a2'],
+ reason: 'the tab it came from is untouched',
+ );
+ app.dispose();
+ },
+ );
test(
- 'at capacity a notification reports the limit without evicting a view',
+ 'a full tab is not a capacity error — the agent gets its own tab',
() async {
final app = _notifier();
_machine(app, 'm1', [
@@ -136,16 +151,42 @@ void main() {
for (var i = 0; i < AppNotifier.maxPanes; i++) {
await app.assignAgentToPane(null, 'm1', 'a$i');
}
+ final full = app.activeSwarmId;
final before = List.of(app.panes);
- final focus = app.focusedPaneId;
await app.openAgentFromDial('m1', 'a${AppNotifier.maxPanes}');
- expect(app.panes, before);
- expect(app.focusedPaneId, focus);
- expect(app.lastError, contains('Open another tab'));
+ expect(app.activeSwarmId, isNot(full));
+ expect(_desk(app), ['a${AppNotifier.maxPanes}']);
+ expect(app.swarms.firstWhere((s) => s.id == full).panes, before);
+ expect(app.lastError, isNull);
app.dispose();
},
);
+ test('a notification for an agent open in ANOTHER tab switches to it', () async {
+ final app = await _withTiles(['a1', 'a2']);
+ final first = app.activeSwarmId;
+ app.newSwarm();
+ await app.addAgentToSwarm('m1', 'a3', swarmId: app.activeSwarmId);
+ final second = app.activeSwarmId;
+ expect(second, isNot(first));
+
+ // Back on the first tab, a tap for a3 goes to the second — no second tile.
+ app.selectSwarm(first);
+ await app.openAgentFromDial('m1', 'a3');
+ expect(app.activeSwarmId, second);
+ expect(app.focusedPane?.agentId, 'a3');
+ expect(app.allPanes.where((p) => p.agentId == 'a3').length, 1);
+
+ // And the CURRENT tab wins when both hold it.
+ app.selectSwarm(first);
+ await app.addAgentToSwarm('m1', 'a3', swarmId: first);
+ app.focusPane(app.panes.first.id);
+ await app.openAgentFromDial('m1', 'a3');
+ expect(app.activeSwarmId, first);
+ expect(app.focusedPane?.agentId, 'a3');
+ app.dispose();
+ });
+
test('a notification for a tile already open only focuses it', () async {
final app = await _withTiles(['a1', 'a2', 'a3']);
app.focusPane(app.panes.first.id);
@@ -240,20 +281,21 @@ void main() {
// The two verbs side by side, driven through the app's own handler: the same
// agent, one frame each, and the grid ends up a different size.
final app = await _withTiles(['a1', 'a2']);
+ final first = app.activeSwarmId;
await app.handleEventForTest('m1', {
'type': 'dial_open',
'payload': {'machineId': 'm1', 'agentId': 'a4'},
});
- expect(_desk(app), ['a1', 'a2', 'a4']);
+ // dial_open: a tab of its own, the first tab intact.
+ expect(_desk(app), ['a4']);
+ expect(
+ app.swarms.firstWhere((s) => s.id == first).panes.map((p) => p.agentId),
+ ['a1', 'a2'],
+ );
- app.focusPane(app.panes.last.id);
+ // dial_focus: a tile in the CURRENT tab.
await dialFocus(app, 'a5');
- expect(_desk(app), [
- 'a1',
- 'a2',
- 'a4',
- 'a5',
- ], reason: 'neither event removes a view');
+ expect(_desk(app), ['a4', 'a5'], reason: 'neither event removes a view');
app.dispose();
});
diff --git a/device/esp32-circle/main/ui/ui_screens.c b/device/esp32-circle/main/ui/ui_screens.c
index 161685ca1..2a0c7b6b1 100644
--- a/device/esp32-circle/main/ui/ui_screens.c
+++ b/device/esp32-circle/main/ui/ui_screens.c
@@ -1241,6 +1241,13 @@ static void busy_dots_tick(lv_timer_t *t)
// Sending: march the green highlight across the 3 sparkles (~3 Hz ≈ Figma's 0.8s/3 sweep).
if (s_vic_state == VIC_SEND) { s_send_idx = (s_send_idx + 1) % 3; voice_send_apply_idx(); }
notif_badge_apply(); // keep the unread pill in sync (screen/settings/asleep)
+ // The Voice cluster too. Its show/hide used to run only on a swipe, a turn edge and the end of a
+ // voice overlay — and its condition includes "awake" and "drawer closed". A turn that ended while
+ // the dial slept (or the drawer was open) hid it, and nothing re-showed it on wake: the tile came
+ // back without Voice until the next swipe (owner, 2026-09-15: "lâu lâu tao thấy màn hình agent
+ // mất icon voice, swipe qua lại thì xuất hiện lại"). LVGL ignores a flag that does not change,
+ // so this costs nothing when it agrees.
+ agent_actions_apply();
}
// Keep the screen awake through a voice turn: voice uses the PWR key (not the touchscreen), so
// recording + upload + the agent working produces NO touch and the idle timer would auto-off the
@@ -5568,7 +5575,20 @@ static void notif_row_tap(lv_event_t *e)
// EVERY machine's agents share one carousel, so the notified tile is almost always already on it —
// whichever machine sent the notification. Go straight there: switching machines first would land on
// that machine's FIRST agent, which is rarely the one the notification is about.
- if (id[0] && ui_project_known(id)) { open_agent_detail(id); ui_report_active_agent(); return; }
+ //
+ // THE OPEN NAMES THE NOTIFICATION'S AGENT, NOT THE TILE. It used to land the carousel first and then
+ // report whatever was active. The ring is the window's CURRENT TAB, so an agent open in another tab
+ // is known but not on the ring: the landing was held for a list that never came, and the report
+ // named the tile the dial happened to be on — the window then opened the wrong agent (owner,
+ // 2026-09-15: "bấm noti vào agent Kinh Te, nó không focus qua tab chứa Kinh Te"). Now the id goes
+ // up as-is; the window finds the tab that holds it (or opens one), pushes the ring, and the held
+ // landing below lands then.
+ if (id[0] && ui_project_known(id)) {
+ s_notif_open_pending = false;
+ cable_client_send_open(id);
+ open_agent_detail(id);
+ return;
+ }
// It is not on the carousel yet — a notification that arrived ahead of the list it belongs to. Select
// its machine and defer the focus to ui_land_after_reload, which is the one path that runs once the