The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(bot-mode): a ✕ on Scheduled jobs survives a group-room round trip
teknium1581ae5b7cac5
diff --git a/apps/desktop/src/plugins/hermes-bots/plugin-panes.test.tsx b/apps/desktop/src/plugins/hermes-bots/plugin-panes.test.tsxindex 38fd1a883a5..6e93a8391be 100644--- a/apps/desktop/src/plugins/hermes-bots/plugin-panes.test.tsx+++ b/apps/desktop/src/plugins/hermes-bots/plugin-panes.test.tsx@@ -28,7 +28,8 @@ const mocks = vi.hoisted(() => ({botChatOwnsWorkspace: vi.fn(() => false),paneVisibility: vi.fn(),sessionOwnsWorkspace: vi.fn(() => false),- setWorkspaceScope: vi.fn()+ setWorkspaceScope: vi.fn(),+ undismissPane: vi.fn()}))vi.mock('@hermes/plugin-sdk', async importOriginal => {@@ -40,7 +41,8 @@ vi.mock('@hermes/plugin-sdk', async importOriginal => {...original.host,onEvent: undefined,paneVisibility: mocks.paneVisibility,- setWorkspaceScope: mocks.setWorkspaceScope+ setWorkspaceScope: mocks.setWorkspaceScope,+ undismissPane: mocks.undismissPane}}})@@ -247,6 +249,43 @@ describe('the Scheduled jobs pane', () => {harness.dispose()})+ it('drops a remembered Close only on entering Bot Mode, not on every ownership regain', async () => {+ const store = paneStores()+ const harness = recordingContext()++ mocks.botChatOwnsWorkspace.mockReturnValue(true)+ store(`hermes-bots:pane`).set(true)+ plugin.register(harness.ctx)+ await settle()++ // Boot straight into a bot chat: the pane arrives and a Close from a past+ // launch is dropped once (#102224).+ expect(mocks.undismissPane).toHaveBeenCalledTimes(1)+ expect(mocks.undismissPane).toHaveBeenCalledWith('hermes-bots:routines')++ // The user ✕-es the pane, opens a group room (the tile must not sit+ // beside a group chat) and comes back to the bot chat — all inside one+ // Bots session. Re-registration must not undo their Close.+ const { $groupChatWorkspace } = await import('./group-chat')+ mocks.botChatOwnsWorkspace.mockReturnValue(false)+ $groupChatWorkspace.set({ id: 'room' } as never)+ expect(harness.find('routines')).toBeUndefined()++ mocks.botChatOwnsWorkspace.mockReturnValue(true)+ $groupChatWorkspace.set(null)+ expect(harness.find('routines')).toBeTruthy()+ expect(mocks.undismissPane).toHaveBeenCalledTimes(1)++ // Leaving Bot Mode and coming back is the ask for the bot's chrome again.+ mocks.botChatOwnsWorkspace.mockReturnValue(false)+ store(`hermes-bots:pane`).set(false)+ mocks.botChatOwnsWorkspace.mockReturnValue(true)+ store(`hermes-bots:pane`).set(true)+ expect(mocks.undismissPane).toHaveBeenCalledTimes(2)++ harness.dispose()+ })+it('stops every lifecycle listener when the plugin is disabled', async () => {const store = paneStores()const harness = recordingContext()diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.tsx b/apps/desktop/src/plugins/hermes-bots/plugin.tsxindex 271134cc27c..0ede39b119f 100644--- a/apps/desktop/src/plugins/hermes-bots/plugin.tsx+++ b/apps/desktop/src/plugins/hermes-bots/plugin.tsx@@ -416,7 +416,7 @@ export default {// keeps the pane's spot, so re-registering re-adopts it where it was.// host.paneVisibility is feature-detected: older desktops without the SDK// export keep the always-registered behavior.- const registerRoutinesPane = () => {+ const registerRoutinesPane = (restoreDismissed: boolean) => {const dispose = ctx.register({id: 'routines',area: 'panes',@@ -445,8 +445,11 @@ export default {// shows this pane again — it only comes back by being registered here.// Entering Bot Mode is the user asking for their bot's chrome, so a// remembered Close is dropped and the pane returns the way it first- // arrived: as the collapsed right-edge tab (#102224).- if (typeof host.undismissPane === 'function') {+ // arrived: as the collapsed right-edge tab (#102224). Only on ENTRY:+ // the pane also re-registers whenever a bot chat regains the workspace+ // inside one Bots session (a group room and back), and a ✕ from that+ // same session must survive those.+ if (restoreDismissed && typeof host.undismissPane === 'function') {host.undismissPane(`${ID}:routines`)}@@ -457,10 +460,15 @@ export default {// The contribution-scoped pane id (`register` prefixes `${ID}:`).const $sidebarVisible = host.paneVisibility(`${ID}:pane`)let unregisterRoutines: null | (() => void) = null+ // Armed by each Bots-tab entry, spent by the first registration after it.+ let restoreDismissedOnRegister = trueconst syncRoutinesPane = () => {if (botChatOwnsWorkspace()) {- unregisterRoutines ??= registerRoutinesPane()+ if (!unregisterRoutines) {+ unregisterRoutines = registerRoutinesPane(restoreDismissedOnRegister)+ restoreDismissedOnRegister = false+ }} else if (unregisterRoutines) {// Clicking the Cronjobs tile moves focus onto the tile itself, which// drops bot-chat workspace ownership for a beat. While Bot Mode is@@ -482,6 +490,8 @@ export default {$botsPaneVisible.set(Boolean(visible))if (visible) {+ restoreDismissedOnRegister = true+const group = $groupChatWorkspace.get()const selected = selectedRosterBot($lastRoster.get(), $selectedRosterKey.get())@@ -623,7 +633,7 @@ export default {})}} else {- registerRoutinesPane()+ registerRoutinesPane(true)}// A bot's chat before it has spoken: core's splash is Hermes' wordmark and