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(cli): a dial that says hello before the devices reach a new core still gets its cards (#1107)

0xdiego25dcc07fc3576c
diff --git a/cli/src/services/devicesProcess.spec.ts b/cli/src/services/devicesProcess.spec.ts
index ee528bcc2..d391ff146 100644
--- a/cli/src/services/devicesProcess.spec.ts
+++ b/cli/src/services/devicesProcess.spec.ts
@@ -236,6 +236,27 @@ describe('the core\'s doors, across the link', () => {
expect(api.clients.sendToWindow('w1', { type: 'dial_form', payload: {} })).toBe(false)
expect(f.notices).toHaveLength(8)
})
+
+ // A dial says hello before its process is connected to a core that just started (2026-10-09, a user's
+ // log: hello at 14:22:54.141, connected at 14:22:54.525): the core must still hear that it watches, or it
+ // makes no cards for it and the dial shows Working for turns that ended, and no recaps.
+ it('tell a core that connects whether a dial is watching, as they last said it', () => {
+ const f = setup()
+ const api = f.api()
+ api.clients.dialWatching(true)
+ expect(f.notices).toEqual([])
+ f.connect()
+ expect(f.notices).toEqual([['dialWatching', { watching: true }]])
+ // A core that restarts while the dial stays is told again.
+ f.options().onDisconnected!()
+ f.connect()
+ expect(f.notices).toEqual([['dialWatching', { watching: true }], ['dialWatching', { watching: true }]])
+ // No dial any more: a new core starts out knowing that, and is told nothing.
+ api.clients.dialWatching(false)
+ f.options().onDisconnected!()
+ f.connect()
+ expect(f.notices).toHaveLength(3)
+ })
})
describe('what the core tells the devices, reaching their port', () => {
diff --git a/cli/src/services/devicesProcess.ts b/cli/src/services/devicesProcess.ts
index 711639266..a098720a9 100644
--- a/cli/src/services/devicesProcess.ts
+++ b/cli/src/services/devicesProcess.ts
@@ -74,6 +74,12 @@ function faultsOf(value: string | undefined): ReadonlySet<string> {
export function runDevicesService(options: DevicesServiceOptions): ServiceProcess {
const processEnv = options.processEnv ?? process.env
let core: CoreConnection | null = null
+ /** Whether a dial watches, as the cable last said: told again to every core this process connects to.
+ * A dial says hello as soon as its port opens, which is often before a core that just started has
+ * this process connected (2026-10-09, a user's log: hello 14:22:54.141, connected 14:22:54.525). Told
+ * only then, the notice was lost: the core made no cards for the dial, which showed Working for turns
+ * that had ended, and no recaps, until the next restart. */
+ let dialWatching = false
let view: View = { agents: [], machine: { id: '', computerId: options.machineId, name: 'This machine' }, signedIn: false, environment: '', hasWindow: false }
/** One ask of the core's view at a time: the dial's tick and ⌘K asking together share it. */
let viewing: Promise<void> | null = null
@@ -164,7 +170,10 @@ export function runDevicesService(options: DevicesServiceOptions): ServiceProces
sendToWindow: (connId, frame) => { tell('sendToWindow', { connId, frame }); return core !== null },
hasWindow: () => view.hasWindow,
devicesChanged: (payload) => tell('devicesChanged', payload),
- dialWatching: (watching) => tell('dialWatching', { watching }),
+ dialWatching: (watching) => {
+ dialWatching = watching
+ tell('dialWatching', { watching })
+ },
windows: () => {},
},
daemon: DAEMON_UNKNOWN,
@@ -241,6 +250,7 @@ export function runDevicesService(options: DevicesServiceOptions): ServiceProces
},
onConnected: (connection) => {
core = connection
+ if (dialWatching) tell('dialWatching', { watching: true })
void refresh()
},
onDisconnected: () => { core = null },