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): the shared-machines read skips the shares notice, which changes no machine's sharing (#1993)

0xken15e28bff81c9df
diff --git a/cli/src/services/sharedMachines.spec.ts b/cli/src/services/sharedMachines.spec.ts
index b2e18206f..850f8ded8 100644
--- a/cli/src/services/sharedMachines.spec.ts
+++ b/cli/src/services/sharedMachines.spec.ts
@@ -191,6 +191,9 @@ describe('shared machines', () => {
expect(live().map((t) => t.ms)).toEqual([15 * 60_000])
notices[0]({ type: 'desk_changed', revision: 1 } as BackendNotice)
expect(live().map((t) => t.ms)).toEqual([15 * 60_000])
+ // A harness shared or taken back changes no machine's sharing: every member's daemon read it again a second after each.
+ notices[0]({ type: 'machines_changed', reason: 'harness_shares' })
+ expect(live().map((t) => t.ms)).toEqual([15 * 60_000])
notices[0]({ type: 'machines_changed', reason: 'updated' })
expect(live().map((t) => t.ms)).toEqual([1_000])
port.shared.mockResolvedValue([studio])
diff --git a/cli/src/services/sharedMachines.ts b/cli/src/services/sharedMachines.ts
index 4c0adf7e0..b7200e6ee 100644
--- a/cli/src/services/sharedMachines.ts
+++ b/cli/src/services/sharedMachines.ts
@@ -259,7 +259,9 @@ export function startSharedMachines(core: CoreApi, overrides: Partial<SharedMach
if (port) {
schedule(port, START_MS)
- core.account.onNotice((notice) => { if (notice.type === 'machines_changed') schedule(port, NOTICE_MS) })
+ // A harness shared or taken back (`harness_shares`) changes no machine's sharing: read again on every one of those, every
+ // member's daemon followed each Swarm agent's invitations with this read (review of #1977, 2026-10-28).
+ core.account.onNotice((notice) => { if (notice.type === 'machines_changed' && notice.reason !== 'harness_shares') schedule(port, NOTICE_MS) })
}
const view = async (): Promise<Record<string, unknown>> => {