Skip to content

The agent that grows with you

fix(desktop): Screen on a managed Cloud backend says the release lacks it, not 'update the bot's Hermes'

Brooklyn Nicholson252402dfa2d6
diff --git a/apps/desktop/src/plugins/hermes-bots/i18n.ts b/apps/desktop/src/plugins/hermes-bots/i18n.ts
index c4c270a5938..7916da55fc9 100644
--- a/apps/desktop/src/plugins/hermes-bots/i18n.ts
+++ b/apps/desktop/src/plugins/hermes-bots/i18n.ts
@@ -386,6 +386,8 @@ type BotsMessages = {
portalNotInstalled: string
portalUnsupported: string
portalUnavailable: string
+ /** Managed runtimes (Hermes Cloud): updates are the platform's job, not the user's. */
+ portalUnavailableManaged: string
unavailableTitle: string
autoOpenMenu: string
autoOpenOnToast: (name: string) => string
@@ -819,6 +821,7 @@ const en: BotsMessages = {
portalNotInstalled: 'Not installed on host',
portalUnsupported: 'Not available on this host',
portalUnavailable: 'Update the bot\u2019s Hermes to use Screen',
+ portalUnavailableManaged: 'Screen is not available on this managed Hermes release yet',
unavailableTitle: 'Screen needs a newer Hermes',
autoOpenMenu: 'Open Screen when the bot uses it',
autoOpenOnToast: name => `${name}’s Screen opens when it starts using its desktop`,
@@ -1252,6 +1255,7 @@ const ja: BotsMessages = {
portalNotInstalled: 'ホストに未インストール',
portalUnsupported: 'このホストでは利用できません',
portalUnavailable: 'Screen を使うにはボットの Hermes を更新してください',
+ portalUnavailableManaged: 'この管理された Hermes リリースではまだ Screen を利用できません',
unavailableTitle: 'Screen には新しい Hermes が必要です',
autoOpenMenu: 'ボットが画面を使い始めたら Screen を開く',
autoOpenOnToast: name => `${name} がデスクトップを使い始めると Screen が開きます`,
@@ -1669,6 +1673,7 @@ const zh: BotsMessages = {
portalNotInstalled: '主机未安装',
portalUnsupported: '此主机不可用',
portalUnavailable: '更新机器人的 Hermes 以使用屏幕',
+ portalUnavailableManaged: '此托管 Hermes 版本尚不支持屏幕',
unavailableTitle: '屏幕需要更新版的 Hermes',
autoOpenMenu: '机器人使用屏幕时自动打开',
autoOpenOnToast: name => `${name} 开始使用桌面时会自动打开屏幕`,
@@ -2086,6 +2091,7 @@ const zhHant: BotsMessages = {
portalNotInstalled: '主機未安裝',
portalUnsupported: '此主機不可用',
portalUnavailable: '更新機器人的 Hermes 以使用螢幕',
+ portalUnavailableManaged: '此託管 Hermes 版本尚不支援螢幕',
unavailableTitle: '螢幕需要較新版的 Hermes',
autoOpenMenu: '機器人使用螢幕時自動開啟',
autoOpenOnToast: name => `${name} 開始使用桌面時會自動開啟螢幕`,
diff --git a/apps/desktop/src/plugins/hermes-bots/screen-connection.ts b/apps/desktop/src/plugins/hermes-bots/screen-connection.ts
index 48c773d1dbb..13c8ce7a7c0 100644
--- a/apps/desktop/src/plugins/hermes-bots/screen-connection.ts
+++ b/apps/desktop/src/plugins/hermes-bots/screen-connection.ts
@@ -64,6 +64,14 @@ export function isDisplayUnavailable(error: unknown): boolean {
return message.includes('method not found') || message.includes('method-not-found')
}
+/** The bot's backend is a Portal-managed runtime (Hermes Cloud): its Hermes is updated by the
+ * platform, never by the user, so "update the bot's Hermes" is not an instruction the user
+ * can follow. A `display.*` method-not-found from a managed release simply means Screen has
+ * not reached that release yet (#120852). */
+export function isManagedBackend(bot: RosterRow): boolean {
+ return bot.connectionKind === 'cloud'
+}
+
/**
* Where `display.*` for `bot` goes. Passive resolution (the typed resolver, never
* the throwing dispatch wrapper): a source-scoped row whose connection was deleted
diff --git a/apps/desktop/src/plugins/hermes-bots/screen-hero.tsx b/apps/desktop/src/plugins/hermes-bots/screen-hero.tsx
index aaded3c42e4..95a159557ba 100644
--- a/apps/desktop/src/plugins/hermes-bots/screen-hero.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/screen-hero.tsx
@@ -12,7 +12,7 @@ import { useEffect, useRef, useState } from 'react'
import { botSelectionKey } from './data'
import { useBots } from './i18n'
-import { displayRequest, type DisplayThumbnail } from './screen-connection'
+import { displayRequest, isManagedBackend, type DisplayThumbnail } from './screen-connection'
import { openBotScreen } from './screen-open'
import { type PortalTone, useScreenPortalState } from './screen-portal'
import type { BotMeta, RosterRow } from './types'
@@ -131,7 +131,7 @@ function ScreenHeroContent({ bot, meta }: { bot: RosterRow; meta?: BotMeta | nul
off: t.screen.heroStopped,
missing: t.screen.heroNotInstalled,
unsupported: t.screen.portalUnsupported,
- unavailable: t.screen.portalUnavailable,
+ unavailable: isManagedBackend(bot) ? t.screen.portalUnavailableManaged : t.screen.portalUnavailable,
unknown: t.screen.heroConnecting
}[tone]
diff --git a/apps/desktop/src/plugins/hermes-bots/screen-managed-copy.test.tsx b/apps/desktop/src/plugins/hermes-bots/screen-managed-copy.test.tsx
new file mode 100644
index 00000000000..fb431c46692
--- /dev/null
+++ b/apps/desktop/src/plugins/hermes-bots/screen-managed-copy.test.tsx
@@ -0,0 +1,87 @@
+/**
+ * A `display.*` method-not-found from a Portal-managed (Hermes Cloud) backend must not be
+ * rendered as "Update the bot's Hermes": the user cannot update a managed release, and the
+ * managed Cloud tab already reports it is on the latest release (#120852). A self-upgradable
+ * (git/remote) backend keeps the update instruction.
+ */
+import { act, render } from '@testing-library/react'
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+import { afterEach, beforeEach, expect, it, vi } from 'vitest'
+
+import type { RosterRow } from './types'
+
+vi.mock('@hermes/plugin-sdk', async () => {
+ const { useStore } = await import('@nanostores/react')
+ const { onGatewayEvent } = await import('../../contrib/events')
+
+ return {
+ Button: (props: ButtonHTMLAttributes<HTMLButtonElement>) => <button {...props} />,
+ Codicon: () => null,
+ GlyphSpinner: () => null,
+ Tip: ({ children }: { children: ReactNode }) => <>{children}</>,
+ EmptyState: ({ title, description }: { title: string; description: string }) => (
+ <div>
+ <h2>{title}</h2>
+ <p>{description}</p>
+ </div>
+ ),
+ useValue: useStore,
+ host: { onEvent: onGatewayEvent, requestProfile: vi.fn() }
+ }
+})
+vi.mock('./routing', () => {
+ const route = { connectionId: 'cloud-a', mode: 'remote', profile: 'default', targetProfile: 'default' }
+
+ return { botConnectionRoute: () => route, resolveBotConnectionRoute: () => ({ status: 'resolved', route }) }
+})
+vi.mock('./data', () => ({ botSelectionKey: (bot: RosterRow) => bot.name }))
+vi.mock('./i18n', () => ({
+ useBots: () => ({
+ screen: {
+ title: 'Screen',
+ portalUnavailable: 'Update the bot’s Hermes to use Screen',
+ portalUnavailableManaged: 'Screen is not available on this managed Hermes release yet',
+ unavailableTitle: 'Screen needs a newer Hermes'
+ }
+ })
+}))
+
+import { host } from '@hermes/plugin-sdk'
+
+import { BotScreenPane } from './screen-pane'
+import { $screenState } from './screen-state'
+
+const cloudBot: RosterRow = { name: 'default', connectionId: 'cloud-a', connectionKind: 'cloud' }
+const gitBot: RosterRow = { name: 'default', connectionId: 'host-a', connectionKind: 'remote' }
+
+beforeEach(() => {
+ $screenState.set({})
+ vi.mocked(host.requestProfile).mockReset()
+})
+
+afterEach(() => {
+ vi.restoreAllMocks()
+})
+
+const methodNotFound = () =>
+ Promise.reject(Object.assign(new Error('Method not found: display.status'), { code: -32601 }))
+
+it('a managed Cloud backend gets the managed-release copy, not a self-update instruction', async () => {
+ vi.mocked(host.requestProfile).mockImplementation(() => methodNotFound())
+ const view = render(<BotScreenPane bot={cloudBot} />)
+ await act(async () => {})
+
+ expect(view.getByText('Screen is not available on this managed Hermes release yet')).toBeTruthy()
+ expect(view.queryByText('Update the bot’s Hermes to use Screen')).toBeNull()
+ view.unmount()
+})
+
+it('a self-upgradable backend keeps the update instruction', async () => {
+ vi.mocked(host.requestProfile).mockImplementation(() => methodNotFound())
+ const view = render(<BotScreenPane bot={gitBot} />)
+ await act(async () => {})
+
+ expect(view.getByText('Update the bot’s Hermes to use Screen')).toBeTruthy()
+ expect(view.queryByText('Screen is not available on this managed Hermes release yet')).toBeNull()
+ view.unmount()
+})
diff --git a/apps/desktop/src/plugins/hermes-bots/screen-pane.tsx b/apps/desktop/src/plugins/hermes-bots/screen-pane.tsx
index 0dc6d21f548..75da5808fe7 100644
--- a/apps/desktop/src/plugins/hermes-bots/screen-pane.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/screen-pane.tsx
@@ -24,6 +24,7 @@ import {
type DisplayStatus,
isDisplayUnavailable,
isEventForBotScreen,
+ isManagedBackend,
leaseHeldBy,
resolveScreenWsUrl,
retainBotScreen,
@@ -364,7 +365,13 @@ export function BotScreenPane({ bot }: { bot: RosterRow }) {
)
if (state?.unavailable) {
- return <EmptyState description={t.screen.portalUnavailable} title={t.screen.unavailableTitle} />
+ // A managed (Hermes Cloud) backend cannot be self-updated: its release is the platform's
+ // choice, so say Screen has not reached it yet instead of an update instruction (#120852).
+ const description = isManagedBackend(bot)
+ ? t.screen.portalUnavailableManaged
+ : t.screen.portalUnavailable
+
+ return <EmptyState description={description} title={t.screen.unavailableTitle} />
}
if (status && !status.supported) {
diff --git a/apps/desktop/src/plugins/hermes-bots/screen-portal.tsx b/apps/desktop/src/plugins/hermes-bots/screen-portal.tsx
index a5708ddecf4..840fab136d3 100644
--- a/apps/desktop/src/plugins/hermes-bots/screen-portal.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/screen-portal.tsx
@@ -23,6 +23,7 @@ import {
type DisplayStatus,
isDisplayUnavailable,
isEventForBotScreen,
+ isManagedBackend,
leaseHeldBy,
type ScreenViewer
} from './screen-connection'
@@ -174,7 +175,7 @@ export function ScreenPortal({ bot }: { bot: RosterRow }) {
off: t.screen.portalStopped,
missing: t.screen.portalNotInstalled,
unsupported: t.screen.portalUnsupported,
- unavailable: t.screen.portalUnavailable,
+ unavailable: isManagedBackend(bot) ? t.screen.portalUnavailableManaged : t.screen.portalUnavailable,
unknown: status?.display ?? ''
}[tone]