From d0390e940cbd3fb84559d8f894c05a2e6a6bbfb6 Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 15 Sep 2026 05:49:17 +0300 Subject: [PATCH] Fix: agents archived by the boot-time orphan sweep vanish from every UI tab archiveOrphanedAgents() (run once at startup) calls the raw hive.setArchived(id, true) directly on the Hive class when it finds a registry entry with no live PTY. Every OTHER archival path in the app - PTY teardown, killAgent, the hive:setArchived IPC handler - follows that same call with liveWebContents()?.send('hive:agentArchived', { id }) so the renderer's local roster store (a separate, session-event-driven cache from registry.json) learns the agent was archived. This one path didn't. Net effect: an agent can end up archived:true in registry.json while the Command Center never received the event that would let it show up in the 'ARCHIVED' section - it silently disappears from the live list, the restorable list, and the archived list alike, with no user-visible trace it ever existed. Sending the same notification here closes that gap. Co-Authored-By: Claude Sonnet 5 --- src/main/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/index.ts b/src/main/index.ts index 40634ac6f..8eef35f4d 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -903,6 +903,13 @@ function archiveOrphanedAgents(): void { if (id === reg.godId) continue; // god is never archived if (ptyForAgent(id)) continue; // has a live PTY → genuinely active hive.setArchived(id, true); // stale archived:false orphan → archive + // Every other archival path notifies the renderer's local roster store + // via 'hive:agentArchived' (see the wrapper a few hundred lines down). + // This one didn't - so an agent archived here could end up archived:true + // in registry.json while the Command Center's roster never learns it + // exists, making it permanently invisible in every tab (live, restorable, + // and archived alike). + try { liveWebContents()?.send('hive:agentArchived', { id }); } catch { /* window torn down */ } console.log('[migration] archived orphaned agent (no live PTY):', id); } } catch (e) {