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: prevent unhandled promise rejections by catching dial errors in remoteRelay

0xken1522ac19285466
diff --git a/cli/src/lib/remoteRelay.ts b/cli/src/lib/remoteRelay.ts
index 6adfee5fb..929b8554a 100644
--- a/cli/src/lib/remoteRelay.ts
+++ b/cli/src/lib/remoteRelay.ts
@@ -102,7 +102,12 @@ export class RemoteRelayPool {
throw err
})
this.pending.set(machineId, promise)
- void promise.finally(() => { if (this.pending.get(machineId) === promise) this.pending.delete(machineId) })
+ // `.finally()` re-throws on rejection, producing a SECOND promise distinct from the one returned
+ // below (which callers already await/catch) — left un-caught, every failed dial (e.g. NO_PEER_LINK
+ // on an unlinked machine) becomes an unhandledRejection, one per attempt.
+ void promise
+ .finally(() => { if (this.pending.get(machineId) === promise) this.pending.delete(machineId) })
+ .catch(() => {})
return promise
}