From 7b25941b0ecd1a2d367edc7b6ef89a0958c10822 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 19 Aug 2026 17:40:57 +0200 Subject: [PATCH] fix(bot-mode): unwrap connections registry object so 'Create on' picker renders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit host.connections() resolves the IPC handler hermes:connections:list, which returns the registry OBJECT ({version, primary, connections: [...]}) — not a bare array. CreateAgentDialog did setConnections(Array.isArray(value) ? value : []), so on a multi-connection desktop the picker gate (Array.isArray(connections) && connections.length > 1) never fired and the 'Create on' picker stayed hidden, making cross-machine bot creation impossible despite the multi-connection feature being documented. Any new agent is still created on the active gateway (unchanged behaviour); the picker is the only path that regressed. The built-in Connections UI (refreshConnectionsRegistry) consumes the same registry object, so the IPC handler contract is left untouched. Adds a regression test asserting the unwrap and that the IPC contract is preserved. Plugin suite: 309/309 pass. --- apps/desktop/src/plugins/hermes-bots/plugin.js | 2 +- .../tests/cross-connection-bots.test.mjs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.js b/apps/desktop/src/plugins/hermes-bots/plugin.js index cf7b36a5cd..712042ef53 100644 --- a/apps/desktop/src/plugins/hermes-bots/plugin.js +++ b/apps/desktop/src/plugins/hermes-bots/plugin.js @@ -6158,7 +6158,7 @@ function CreateAgentDialog({ open, onClose, roster }) { host .connections() - .then(value => setConnections(Array.isArray(value) ? value : [])) + .then(value => setConnections(Array.isArray(value?.connections) ? value.connections : [])) .catch(() => setConnections([])) }, [open, connections]) diff --git a/apps/desktop/src/plugins/hermes-bots/tests/cross-connection-bots.test.mjs b/apps/desktop/src/plugins/hermes-bots/tests/cross-connection-bots.test.mjs index 876e0a1966..5092884e08 100644 --- a/apps/desktop/src/plugins/hermes-bots/tests/cross-connection-bots.test.mjs +++ b/apps/desktop/src/plugins/hermes-bots/tests/cross-connection-bots.test.mjs @@ -162,3 +162,18 @@ test('source contract: group chat turns route through requestForBot on the membe // Room records persist remote member descriptors. assert.match(pluginSource, /members: Array\.isArray\(room\.members\) \? room\.members : \[\]/) }) + +test('regression: host.connections() registry object is unwrapped before the picker gate', () => { + // host.connections() resolves the IPC handler hermes:connections:list, which + // returns the registry OBJECT ({version, primary, connections: [...]}) — not + // a bare array. The picker gate (Array.isArray(connections) && length > 1) + // never fired, so the "Create on" picker stayed hidden on multi-connection + // desktops. The plugin must unwrap .connections before storing. + assert.match( + pluginSource, + /setConnections\(Array\.isArray\(value\?\.connections\) \? value\.connections : \[\]\)/ + ) + // The built-in Connections UI consumes the registry object, so the IPC + // handler contract must NOT change to a bare array. + assert.doesNotMatch(pluginSource, /setConnections\(Array\.isArray\(value\) \? value : \[\]\)/) +})