fix(bot-mode): unwrap connections registry object so 'Create on' picker renders

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.
This commit is contained in:
Tom
2026-08-19 17:40:57 +02:00
committed by Teknium
parent 8430c1b4da
commit 7b25941b0e
2 changed files with 16 additions and 1 deletions
@@ -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])
@@ -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 : \[\]\)/)
})