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.

fix: a question on the dial brings the agent forward, never opens a tab

0xdiego25cb9855e934f5
diff --git a/cli/src/cable/cableHost.spec.ts b/cli/src/cable/cableHost.spec.ts
index 1133a8785..388726b71 100644
--- a/cli/src/cable/cableHost.spec.ts
+++ b/cli/src/cable/cableHost.spec.ts
@@ -370,7 +370,10 @@ describe('DaemonCableHost.listAgentsFlat across machines, and the tab the dial g
host.noteAgent('other', 'r9')
expect(host.describe('r9')).toEqual({ name: '', engine: '', machine: 'office-imac' })
host.openAgent('r9')
- expect(opened).toHaveBeenCalledWith('other', 'r9')
+ expect(opened).toHaveBeenCalledWith('other', 'r9', undefined)
+ // A question screen's own open says so, and the window hears it.
+ host.openAgent('r9', 'question')
+ expect(opened).toHaveBeenLastCalledWith('other', 'r9', 'question')
})
it('forks a local agent through the daemon and opens the fork in the window', async () => {
diff --git a/cli/src/cable/cableHost.ts b/cli/src/cable/cableHost.ts
index 110e0ab1d..fc4cb47e2 100644
--- a/cli/src/cable/cableHost.ts
+++ b/cli/src/cable/cableHost.ts
@@ -16,7 +16,7 @@ import { fetchRelease, loadImage, shouldOffer } from './fwPush.js'
import { routeVoiceTask, type RouterAgent, type RouterContinuity } from '../lib/voiceRouter.js'
import { env } from '../config/env.js'
-import type { AppSwarms, CableAgent, CableHost, CableMachine, CableMachineSource, CableSwarm, DialStatus, RouteDecision } from './cableSession.js'
+import type { AppSwarms, CableAgent, CableHost, CableMachine, CableMachineSource, CableSwarm, DialStatus, OpenReason, RouteDecision } from './cableSession.js'
import type { WindowRoute } from './windowRoute.js'
import { FleetError, type FleetMachine, type MachineFleet } from './machineFleet.js'
@@ -50,8 +50,11 @@ export interface CableHostWiring {
listModels?: (agentId: string) => Promise<Array<{ id: string }>>
/** The dial moved to another agent — the desktop window should show that agent on its own machine. */
focused?: (machineId: string, agentId: string) => void
- /** A notification was tapped: the window gives that agent a tile of its own. */
- opened?: (machineId: string, agentId: string) => void
+ /**
+ * A notification was tapped: the window gives that agent a tile of its own. With `reason`
+ * `'question'` it was a question screen instead, and the window only brings the agent forward.
+ */
+ opened?: (machineId: string, agentId: string, reason?: OpenReason) => void
/** A fork the dial asked for is open: the window puts it beside its source and focuses it. */
forked?: (machineId: string, agentId: string, sourceAgentId: string) => void
/** The dial asked for a fork of a LOCAL agent — see lib/forkAgent.ts. Resolves to the new agent's id. */
@@ -533,7 +536,7 @@ export class DaemonCableHost implements CableHost {
return this.agentMachine.get(agentId) ?? this.seenOn.get(agentId) ?? ''
}
- openAgent(agentId: string): void {
+ openAgent(agentId: string, reason?: OpenReason): void {
const machineId = this.machineOf(agentId)
if (!machineId) {
// Same rule as focus: an agent id without its machine is not routable, and guessing is how a
@@ -541,8 +544,8 @@ export class DaemonCableHost implements CableHost {
this.wiring.log(`cable: ignored open for unknown agent ${agentId}`)
return
}
- this.wiring.log(`cable: open ${machineId}/${agentId} (notification)`)
- this.wiring.opened?.(machineId, agentId)
+ this.wiring.log(`cable: open ${machineId}/${agentId} (${reason ?? 'notification'})`)
+ this.wiring.opened?.(machineId, agentId, reason)
}
/**
diff --git a/cli/src/cable/cableSession.spec.ts b/cli/src/cable/cableSession.spec.ts
index f4259dfc6..b55757099 100644
--- a/cli/src/cable/cableSession.spec.ts
+++ b/cli/src/cable/cableSession.spec.ts
@@ -397,6 +397,23 @@ describe('cable session', () => {
await session.stop()
})
+ it('hands an open to the host with why the dial sent it — a tap says nothing, a question says so', async () => {
+ // A question screen that came up on its own opens with reason 'question'; the window then only brings
+ // the agent forward. A tap carries no reason, and so does anything the daemon does not know.
+ const host = makeHost()
+ const { session, port } = await connect(host)
+ port.say({ t: 'hello', product: 'harness', mac: 'aa:bb' })
+ await settle()
+
+ port.say({ t: 'agent.open', agentId: 'a2' })
+ port.say({ t: 'agent.open', agentId: 'a2', reason: 'question' })
+ port.say({ t: 'agent.open', agentId: 'a2', reason: 'whim' })
+ await settle()
+
+ expect(vi.mocked(host.openAgent).mock.calls).toEqual([['a2', undefined], ['a2', 'question'], ['a2', undefined]])
+ await session.stop()
+ })
+
it("never echoes the dial's own move back at it", async () => {
// THE RING: the dial's carousel reports `focus` up, the daemon hands that to the window, the window
// opens that agent's terminal, and a window opening a terminal is exactly what calls followApp. Left
diff --git a/cli/src/cable/cableSession.ts b/cli/src/cable/cableSession.ts
index 2cf629381..86caf4f8c 100644
--- a/cli/src/cable/cableSession.ts
+++ b/cli/src/cable/cableSession.ts
@@ -185,6 +185,8 @@ export interface AppSwarms {
/** Why the list is as short as it is. The dial renders this, instead of drawing an empty wheel. */
export type CableMachineSource = 'backend' | 'local' | 'signed-out'
+/** Why the dial sent an `agent.open`: a tap (absent) or a question screen that came up on its own. */
+export type OpenReason = 'question'
export type { WindowRoute } from './windowRoute.js'
import type { WindowRoute } from './windowRoute.js'
@@ -243,8 +245,12 @@ export interface CableHost {
* says where the eye is and the window moves a tile to match, while this asks
* for a tile of its own. A turn that just finished is a new thing to look at,
* not a replacement for whatever the person was already watching.
+ *
+ * `reason` is why the dial sent it: absent for a person's tap; `'question'` when a question screen
+ * came up on its own — the window then only brings the agent forward if it is already on screen,
+ * because a reconnect re-shows every unanswered question and each used to open a tab.
*/
- openAgent(agentId: string): void
+ openAgent(agentId: string, reason?: OpenReason): void
/** The dial asked for a fork of this agent — a second one with its history, opened in the window. */
forkAgent(agentId: string): Promise<{ ok: true; agentId: string } | { ok: false; error: string; detail?: string }>
/**
@@ -815,7 +821,8 @@ export class CableSession {
}
return
case 'agent.open':
- if (str('agentId')) this.host.openAgent(str('agentId')!)
+ // Only the one reason the window knows; anything else reads as a tap, the older frame's meaning.
+ if (str('agentId')) this.host.openAgent(str('agentId')!, str('reason') === 'question' ? 'question' : undefined)
return
case 'agent.fork': {
// The dial's Fork action. The host opens the new agent in the window itself; the dial only needs
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index bfd71b800..ef89ae6f3 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -5301,8 +5301,11 @@ async function runForeground(session: AuthSession): Promise<void> {
// Both of these are LOCAL-ONLY on purpose (backend.sendLocal, not backend.send): they describe a hand
// at this desk, not a change in what the machine is doing, and the cloud web audience may be sitting
// at another computer entirely.
- // A notification tap, which asks for a tile of its OWN — see CableHost.openAgent.
- opened: (machineId, agentId) => backend.sendLocal({ type: 'dial_open', payload: { machineId, agentId } }),
+ // A notification tap, which asks for a tile of its OWN — see CableHost.openAgent. `reason` rides
+ // along only when the dial gave one ('question'): the window then brings the agent forward rather
+ // than opening a tab, and an older window that does not know the field opens one as before.
+ opened: (machineId, agentId, reason) =>
+ backend.sendLocal({ type: 'dial_open', payload: { machineId, agentId, ...(reason ? { reason } : {}) } }),
forked: (machineId, agentId, sourceAgentId) => backend.sendLocal({ type: 'dial_forked', payload: { machineId, agentId, sourceAgentId } }),
// The dial's Fork: the same path the window's `agent_fork` takes, then `forked` above lands on it.
forkAgent: async (agentId) => {
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 40d376dce..32385d73f 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -7745,12 +7745,30 @@ class AppNotifier extends ChangeNotifier {
return known();
}
- Future<void> openAgentFromDial(String machineId, String agentId) async {
+ /// The dial asked for this agent on screen. A tap (a notification, the
+ /// question's eyebrow, the carousel) gets a tile of its own when none shows
+ /// the agent. A question screen that came up on its own ([fromQuestion])
+ /// only brings the agent forward when it is already on screen: every
+ /// unanswered question is re-shown on each reconnect, and a blink in the
+ /// link used to open a row of tabs — on every Mac, once tabs were shared
+ /// (owner, 2026-09-21).
+ Future<void> openAgentFromDial(
+ String machineId,
+ String agentId, {
+ bool fromQuestion = false,
+ }) async {
if (revealAgentView(machineId, agentId)) {
selectedMachineId = machineId;
notifyListeners();
return;
}
+ if (fromQuestion) {
+ appLog.debug(
+ 'dial',
+ 'question for $agentId not on screen — tabs left as they are',
+ );
+ return;
+ }
// 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.
@@ -9325,7 +9343,13 @@ class AppNotifier extends ChangeNotifier {
if (openId is String && openId.isNotEmpty) {
final targetMachineId = _dialFocusMachine(payload, openId);
if (targetMachineId != null) {
- unawaited(openAgentFromDial(targetMachineId, openId));
+ unawaited(
+ openAgentFromDial(
+ targetMachineId,
+ openId,
+ fromQuestion: payload['reason'] == 'question',
+ ),
+ );
}
}
break;
diff --git a/desktop/test/dial_desk_test.dart b/desktop/test/dial_desk_test.dart
index b3358d101..8388a0222 100644
--- a/desktop/test/dial_desk_test.dart
+++ b/desktop/test/dial_desk_test.dart
@@ -299,6 +299,34 @@ void main() {
app.dispose();
});
+ test('a question on the dial brings the agent forward, and never opens a tab', () async {
+ // The same frame with reason 'question': an agent on another tab is switched
+ // to; one on no tab is left alone. A reconnect re-shows every unanswered
+ // question, and each used to open a tab.
+ final app = await _withTiles(['a1', 'a2']);
+ final first = app.activeSwarmId;
+ await app.handleEventForTest('m1', {
+ 'type': 'dial_open',
+ 'payload': {'machineId': 'm1', 'agentId': 'a4', 'reason': 'question'},
+ });
+ expect(app.swarms.length, 1, reason: 'not on screen: nothing opens');
+ expect(app.activeSwarmId, first);
+ expect(_desk(app), ['a1', 'a2']);
+
+ // On screen, on another tab: that tab comes forward with the agent focused.
+ app.newSwarm();
+ await app.addAgentToSwarm('m1', 'a4', swarmId: app.activeSwarmId);
+ app.selectSwarm(first);
+ await app.handleEventForTest('m1', {
+ 'type': 'dial_open',
+ 'payload': {'machineId': 'm1', 'agentId': 'a4', 'reason': 'question'},
+ });
+ expect(app.swarms.length, 2);
+ expect(app.activeSwarmId, isNot(first));
+ expect(app.focusedPane?.agentId, 'a4');
+ app.dispose();
+ });
+
test(
'a dial focus adds a missing view while preserving existing members',
() async {
diff --git a/devices/harness-device/firmware/main/cable_client.c b/devices/harness-device/firmware/main/cable_client.c
index decac3059..df207ba8d 100644
--- a/devices/harness-device/firmware/main/cable_client.c
+++ b/devices/harness-device/firmware/main/cable_client.c
@@ -176,12 +176,14 @@ void cable_client_send_focus(const char *agent_id)
send_json(root);
}
-void cable_client_send_open(const char *agent_id)
+void cable_client_send_open(const char *agent_id, const char *reason)
{
if (!agent_id || !agent_id[0]) return;
cJSON *root = msg("agent.open");
if (!root) return;
cJSON_AddStringToObject(root, "agentId", agent_id);
+ // Absent for a tap: an older daemon reads the frame exactly as before.
+ if (reason && reason[0]) cJSON_AddStringToObject(root, "reason", reason);
send_json(root);
}
diff --git a/devices/harness-device/firmware/main/cable_client.h b/devices/harness-device/firmware/main/cable_client.h
index 150d0c6a1..4bd5ddb47 100644
--- a/devices/harness-device/firmware/main/cable_client.h
+++ b/devices/harness-device/firmware/main/cable_client.h
@@ -176,7 +176,12 @@ void cable_client_send_focus(const char *agent_id);
// dial to a tile. Focus says where the eye is and the window moves a tile to match; this asks for a tile
// of its own, because the turn that just finished is a new thing to look at, not a replacement for what
// the person was already watching. The window opens a new one, or reuses its last when the grid is full.
-void cable_client_send_open(const char *agent_id);
+// `agent.open`: ask the window for a tile of this agent's own. `reason` says why the dial sent it —
+// NULL for a person's tap (notification, question eyebrow, carousel), "question" when a question screen
+// came up on its own. The window opens a tab for a tap; for a question it only brings the agent forward
+// when it is already on screen, and otherwise leaves the desk alone (a reconnect re-shows every
+// unanswered question, and each used to open a tab).
+void cable_client_send_open(const char *agent_id, const char *reason);
// One report of a finger on the glass, on its way to the window on the computer.
//
diff --git a/devices/harness-device/firmware/main/ui/ui_screens.c b/devices/harness-device/firmware/main/ui/ui_screens.c
index bafeac41f..5685c8a1f 100644
--- a/devices/harness-device/firmware/main/ui/ui_screens.c
+++ b/devices/harness-device/firmware/main/ui/ui_screens.c
@@ -747,7 +747,7 @@ void ui_report_active_agent(void)
if (!s_proj[s_active_idx].id[0]) return;
if (s_notif_open_pending) {
s_notif_open_pending = false;
- cable_client_send_open(s_proj[s_active_idx].id);
+ cable_client_send_open(s_proj[s_active_idx].id, NULL);
} else {
cable_client_send_focus(s_proj[s_active_idx].id);
}
@@ -5822,7 +5822,7 @@ static void notif_row_tap(lv_event_t *e)
// rarely the one the notification was about.
if (id[0]) {
s_notif_open_pending = false;
- cable_client_send_open(id);
+ cable_client_send_open(id, NULL);
open_agent_detail(id); // held until the list arrives when the agent is off this tab
return;
}
@@ -7014,7 +7014,7 @@ static void q_open_tap(lv_event_t *e)
{
(void)e;
if (!s_q.project[0]) return;
- cable_client_send_open(s_q.project);
+ cable_client_send_open(s_q.project, NULL);
machine_toast("Opening in the app");
}
@@ -7243,9 +7243,11 @@ void ui_question_show(const char *project_id, const char *agent_name, const char
display_unlock();
audio_notify_done(); // audible alert so the user notices a question is waiting
// …and bring the window to the same agent, so the question can be judged against what it is doing.
- // The same `open` a notification tap sends: the window finds the tab that holds the agent — the
- // current one first — or opens one for it (owner, 2026-09-15, "rule vẫn như cũ").
- if (s_q.project[0]) cable_client_send_open(s_q.project);
+ // Said as a "question" open: the window brings the agent forward when it is on screen and does
+ // nothing when it is not. It used to be the same `open` a tap sends, which opened a tab — and a
+ // reconnect re-shows every unanswered question, so a blink in the link opened a row of tabs
+ // (owner, 2026-09-21). A tap on the eyebrow (q_open_tap) still opens one.
+ if (s_q.project[0]) cable_client_send_open(s_q.project, "question");
}
// ── Machine picker (Settings → Machines) ──────────────────────────────────────────────────────────────