Conversation
…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 <noreply@anthropic.com>
Contributor
🚫 This PR is missing its before/after evidenceEvery pull request here has to show its work. Screenshots or a short screen recording, before the change and after it.
How to fix it: edit the description, keep the A bug fix with no visible surface still needs it: show the failing behaviour, then the same steps passing. A terminal recording is fine. Genuinely nothing to show — a CI tweak, a typo, a dependency bump? A maintainer can apply the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
archiveOrphanedAgents()(run once at startup to clean up stalearchived:falseentries with no live PTY) calls the rawhive.setArchived(id, true)directly. Every other archival path in the app — PTY exit teardown,killAgent, thehive:setArchivedIPC handler — follows that same call with:so the renderer's local roster store (a separate cache built from session IPC events, not read from
registry.jsondirectly) learns the agent was archived.archiveOrphanedAgents()doesn't send it.Net effect: an agent can end up
archived: trueinregistry.jsonwhile the Command Center's roster never received the event that would let it appear anywhere — not the live strip, not "restorable", not the "ARCHIVED (N)" section. It's simply gone, with no user-visible trace, even though it's still fully present in the backing data.Repro (what I hit)
Two agents (
toby-mtzzd9yw,vic-muoakmx8gx) hadarchived: trueinregistry.jsonbut appeared in none of the Command Center's tabs, while ~13 other archived agents (archived through normal paths) showed up correctly in "ARCHIVED" with working restore buttons. Traced it to these two having been swept up byarchiveOrphanedAgents()on a prior boot.Fix
hive.setArchived(id, true); + try { liveWebContents()?.send('hive:agentArchived', { id }); } catch { /* window torn down */ } console.log('[migration] archived orphaned agent (no live PTY):', id);Mirrors exactly what the other archival paths already do a few hundred lines down.
Test plan
npm run typecheckpassesnpm run buildsucceedsregistry.jsonagainstroster.json's known ids to confirm this exact orphan condition and find affected agents (happy to share if useful, but it's outside the scope of this diff)🤖 Generated with Claude Code
Before
Directly observed live:
toby-mtzzd9ywandvic-muoakmx8gxboth had"archived": trueinregistry.json, but were absent from every Command Center tab - not in the live agent list, and not in the "ARCHIVED (13)" expandable section either (which correctly listed ~13 other archived agents with working restore buttons). Cross-checked with a small read-only diff script againstroster.json:After
Same diff script, run immediately after a full mass-archive event on a rebuilt install with this fix applied (44 agents archived at once by
archiveOrphanedAgents()on a cold boot):Zero orphans, even immediately after an archive sweep that size - versus 2 silently-orphaned agents observed before the fix.