The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): only the primary window's boot snapshot carries the update hold
Tekniumd12e19510e99
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 7e8cc963e3e..565a4ded13b 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -16015,6 +16015,7 @@ ipcMain.handle('hermes:bootstrap:repair', async (): Promise<{ ok: boolean; bundlregisterUpdateHoldIpc(ipcMain, {isPrimaryBootSender: event =>Boolean(mainWindow && !mainWindow.isDestroyed() && event.sender === mainWindow.webContents),+ bootProgress: () => bootProgressState,currentHold: updateHoldScreen.current,log: rememberLog,flushLog: flushDesktopLogBufferSync,@@ -16043,7 +16044,6 @@ ipcMain.handle('hermes:bootstrap:cancel', async () => {return { ok: false, cancelled: false }})-ipcMain.handle('hermes:boot-progress:get', async () => bootProgressState)ipcMain.handle('hermes:bootstrap:get', async () => getBootstrapState())ipcMain.handle('hermes:local-backend:probe', async () => {// Resolution only. ensureRuntime/runBootstrap must not start from a hoverdiff --git a/apps/desktop/electron/update-hold-wiring.test.ts b/apps/desktop/electron/update-hold-wiring.test.tsnew file mode 100644index 00000000000..8b899fd9bf4--- /dev/null+++ b/apps/desktop/electron/update-hold-wiring.test.ts@@ -0,0 +1,58 @@+import assert from 'node:assert/strict'++import { test } from 'vitest'++import { registerUpdateHoldIpc, type UpdateHoldWire } from './update-hold-wiring'++const HOLD: UpdateHoldWire = {+ holdId: 'hold-1',+ verdict: 'held',+ ownerPid: 4242,+ since: 1,+ checkedAt: 2,+ logPath: '/logs/desktop.log'+}++function register(state: { phase: string; updateHold: UpdateHoldWire | null }) {+ const handlers = new Map<string, (event: any, ...args: any[]) => Promise<any>>()+ const primary = { id: 'main' }+ let quits = 0++ registerUpdateHoldIpc({ handle: (channel: string, fn: any) => handlers.set(channel, fn) } as any, {+ isPrimaryBootSender: (event: any) => event.sender === primary,+ bootProgress: () => state,+ currentHold: () => null,+ log: () => {},+ flushLog: () => {},+ quit: () => {+ quits += 1+ }+ })++ return { handlers, primary, quits: () => quits }+}++// Review G3: boot-progress pushes (the hold clearing included) reach only the+// main window and Quit/Check again refuse every other sender, so a HUD or+// session window that mounted the blocked screen from its snapshot pull could+// never take it down. Only the primary window's snapshot carries the hold.+test('the boot snapshot carries the update hold to the primary window only', async () => {+ const state = { phase: 'backend.update-hold', updateHold: HOLD }+ const { handlers, primary } = register(state)+ const get = handlers.get('hermes:boot-progress:get')++ assert.ok(get, 'registerUpdateHoldIpc owns the boot snapshot channel')+ assert.deepEqual(await get({ sender: primary }), state)+ assert.deepEqual(await get({ sender: { id: 'hud' } }), { phase: 'backend.update-hold', updateHold: null })+ assert.equal(state.updateHold, HOLD, 'main.ts state is never mutated')+})++test('a non-primary window cannot quit from the update-hold screen', async () => {+ const { handlers, primary, quits } = register({ phase: 'x', updateHold: HOLD })+ const quit = handlers.get('hermes:update-hold:quit')!++ assert.deepEqual(await quit({ sender: { id: 'session' } }), { ok: false })+ assert.equal(quits(), 0)+ assert.deepEqual(await quit({ sender: primary }), { ok: true })+ assert.equal(quits(), 1)+})diff --git a/apps/desktop/electron/update-hold-wiring.ts b/apps/desktop/electron/update-hold-wiring.tsindex d5d11a120b3..d15929a97cb 100644--- a/apps/desktop/electron/update-hold-wiring.ts+++ b/apps/desktop/electron/update-hold-wiring.ts@@ -183,6 +183,8 @@ export function createUpdateHoldScreen(host: UpdateHoldScreenHost) {export interface UpdateHoldIpcHost {/** Only the primary window's boot surface may drive the hold. */isPrimaryBootSender: (event: IpcMainInvokeEvent) => boolean+ /** main.ts's boot progress snapshot (`hermes:boot-progress:get`). */+ bootProgress: () => { updateHold?: UpdateHoldWire | null }currentHold: () => HeldState | nulllog: (line: string) => voidflushLog: () => void@@ -192,6 +194,16 @@ export interface UpdateHoldIpcHost {// The blocked boot screen's three ways out (R8 D3). Only the primary window's// boot surface can drive them, and only for the hold it is showing.export function registerUpdateHoldIpc(ipc: IpcMain, host: UpdateHoldIpcHost) {+ // The boot snapshot every window pulls on mount. Only the primary window+ // gets the hold: boot-progress pushes (the hold clearing included) reach the+ // main window alone and the ways out refuse every other sender, so a HUD or+ // session window that mounted the blocked screen would keep it forever.+ ipc.handle('hermes:boot-progress:get', async event => {+ const state = host.bootProgress()++ return host.isPrimaryBootSender(event) ? state : { ...state, updateHold: null }+ })+ipc.handle('hermes:update-hold:recheck', async event => {const hold = host.currentHold()