Skip to content

The agent that grows with you

fix(desktop): preserve cross-realm Bot registry errors

David Dudok de Wit9ff7f3325c24
diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.js b/apps/desktop/src/plugins/hermes-bots/plugin.js
index 0c97b25a4be..9357b94e38f 100644
--- a/apps/desktop/src/plugins/hermes-bots/plugin.js
+++ b/apps/desktop/src/plugins/hermes-bots/plugin.js
@@ -5149,7 +5149,11 @@ async function findExistingCanonicalChat(owner) {
include_hidden: true
})
} catch (error) {
- const detail = error instanceof Error && error.message ? ` (${error.message})` : ''
+ // Plugin tests and host bridges can return Error-like values from another
+ // JS realm, where `instanceof Error` is false. Preserve the provider/RPC
+ // message so update-required classification and diagnostics still work.
+ const message = typeof error?.message === 'string' ? error.message : ''
+ const detail = message ? ` (${message})` : ''
throw new Error(`Could not check ${name}'s Bot Chat registry${detail} — not starting a new chat`)
}
diff --git a/apps/desktop/src/plugins/hermes-bots/tests/hide-bot-chats.test.mjs b/apps/desktop/src/plugins/hermes-bots/tests/hide-bot-chats.test.mjs
index b37c29cbe49..e66069014e6 100644
--- a/apps/desktop/src/plugins/hermes-bots/tests/hide-bot-chats.test.mjs
+++ b/apps/desktop/src/plugins/hermes-bots/tests/hide-bot-chats.test.mjs
@@ -278,6 +278,6 @@ test('the canonical-chat adoption scan lists with include_hidden', () => {
// and fails CLOSED: a thrown lookup never falls through to minting.
assert.match(
source,
- /requestForBot\(bot, 'session\.list', \{\s*profile: backendTargetProfile\(route, name\),\s*title: CANONICAL_CHAT_TITLE,[\s\S]{0,200}?include_hidden: true\s*\}\)\s*\} catch \(error\) \{[\s\S]{0,400}?const rows = res\?\.sessions \?\? \[\]\s*return rows\.find\(row => isCanonicalBotChatHistory\(row\)\)/
+ /requestForBot\(bot, 'session\.list', \{\s*profile: backendTargetProfile\(route, name\),\s*title: CANONICAL_CHAT_TITLE,[\s\S]{0,200}?include_hidden: true\s*\}\)\s*\} catch \(error\) \{[\s\S]{0,800}?const rows = res\?\.sessions \?\? \[\]\s*return rows\.find\(row => isCanonicalBotChatHistory\(row\)\)/
)
})