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.

Agent Messages: a sender on another machine sees that its message was read (#1226)

Dee74279c166c06
diff --git a/cli/src/messages/service.spec.ts b/cli/src/messages/service.spec.ts
index 4b495325a..990460bfc 100644
--- a/cli/src/messages/service.spec.ts
+++ b/cli/src/messages/service.spec.ts
@@ -310,6 +310,28 @@ describe('harness send', () => {
expect((history.messages as Array<{ statuses: unknown[] }>)[0].statuses).toEqual([expect.objectContaining({ machineId: 'm2', agentId: 'phone', state: 'delivered', via: 'hook' })])
t.service.stop()
})
+
+ it('keeps how another machine\'s agent got a message, read with `harness send` too, and nothing else', async () => {
+ vi.useFakeTimers()
+ let via: unknown = 'read'
+ const t = setup({ rpc: async (target, payload) => {
+ if (payload.action === 'who') return { agents: [{ agentId: 'phone', name: 'phone', engine: 'claude' }] }
+ if (payload.action === 'deliver') return { statuses: [{ messageId: (payload.message as { id: string }).id, agentId: 'phone', state: 'queued' }] }
+ return { statuses: (payload.ids as string[]).map((messageId) => ({ messageId, agentId: 'phone', state: 'delivered', via })) }
+ } })
+ t.service.start()
+ await t.ask({ action: 'send', pane: '%1', to: 'phone', text: 'when you have a minute' })
+ t.tick(60_000)
+ await vi.advanceTimersByTimeAsync(TICK_MS)
+ const statuses = async () => ((await t.ask({ action: 'history' })).messages as Array<{ statuses: unknown[] }>).at(-1)!.statuses
+ expect(await statuses()).toEqual([expect.objectContaining({ machineId: 'm2', agentId: 'phone', state: 'delivered', via: 'read' })])
+ via = 'typed'
+ await t.ask({ action: 'send', pane: '%1', to: 'phone', text: 'and another' })
+ t.tick(60_000)
+ await vi.advanceTimersByTimeAsync(TICK_MS)
+ expect(await statuses()).toEqual([expect.not.objectContaining({ via: expect.anything() })])
+ t.service.stop()
+ })
})
describe('a harness and the harnesses it started', () => {
diff --git a/cli/src/messages/service.ts b/cli/src/messages/service.ts
index 79203b4d8..566c2fc2a 100644
--- a/cli/src/messages/service.ts
+++ b/cli/src/messages/service.ts
@@ -423,12 +423,16 @@ export function startAgentMessages(core: CoreApi, options: MessagesOptions = {})
if (due.length) saveQuietly()
}
- /** What another machine said became of its agents' deliveries. */
+ /**
+ * What another machine said became of its agents' deliveries. Every way one arrives is kept: a message an agent
+ * read with `harness send` came back as a bare "delivered" to the machine that sent it, so its sender never saw
+ * that it was read (two machines, 2026-10-12).
+ */
function applyRemote(machineId: string, statuses: unknown): void {
for (const s of Array.isArray(statuses) ? statuses as Record<string, unknown>[] : []) {
if (typeof s.messageId !== 'string' || typeof s.agentId !== 'string' || !['queued', 'delivered', 'failed'].includes(String(s.state))) continue
const status: DeliveryStatus = { messageId: s.messageId, machineId, agentId: s.agentId, state: s.state as DeliveryStatus['state'],
- ...(s.via === 'hook' || s.via === 'prompt' ? { via: s.via } : {}), ...(typeof s.reason === 'string' ? { reason: s.reason } : {}), at: now() }
+ ...(s.via === 'hook' || s.via === 'prompt' || s.via === 'read' ? { via: s.via } : {}), ...(typeof s.reason === 'string' ? { reason: s.reason } : {}), at: now() }
if (store.status(status)) tellWindows(status.messageId)
}
}