[Bug] Ghost sessions: empty '(no messages)' rows undeletable from agents view, orphaned leases never reclaimed, partial fix #1079 has a regression #1531
Replies: 2 comments
|
Re-diagnosed this on 0.8.1 (current main, c718bf3). The undeletable What I measuredThree undeletable rows on my machine, and the daemon list explains all three: {"id":"814345482e92","activeSessionId":"814345482e92","lifecycle":"draft","activity":"working",
"messageCount":0,"attachedClients":0,"isStreaming":false,"isBashRunning":false,
"hasRunningRlmChildren":false,"workerState":"ready","workerPid":7764,
"sessionFile":"~/.prime/agent/sessions/01a0580a-25dc-....jsonl"}Live workers, ready, zero messages, zero attached clients. Mechanism
Why the file exists at all: PatchBranch: artgas1/prime-agent@main...artgas1:prime-agent:fix/agents-view-hidden-draft-rows Saved-catalog rows get the same live-only rule as daemon rows, reusing export function shouldShowAgentsViewSavedSession(saved: AgentConnectionSavedSessionInfo): boolean {
return inactiveLifecycleForSession(saved) === "live";
}applied to the saved-only branch of Validation: What this does not fixThe ghost files still accumulate on disk, now invisibly. Two follow-ups are worth separating from the view fix:
Immediate workaround for anyone stuck: over the daemon socket, Filed the 0.8.1 mechanism as its own report with a clean-state reproduction (three daemon commands, no dead process involved): #1921. Keeping this thread for the lease half, which is a different failure mode. |
|
@stanleytejakusuma if you still see the ghosts on 0.8.1, this one-liner separates your mechanism from the one I hit, no scripts needed:
For the first case the removal is two daemon commands per ghost, Worth knowing which one you have, because the fixes differ and only one of them is a lease sweep. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
The agents view shows ghost rows labelled
(no messages)that cannot be deleted from the UI. Ctrl+X either does nothing or reports "Session became active; stop it before deleting" because the daemon resolves them active from orphaned session leases. These are empty session files (no messages) whose owning process died, leaving the lease unclaimed.Environment
Symptoms
(no messages).Root cause (verified by bisection, 2026-08-14)
Two distinct defects:
A. Orphaned leases are never reclaimed. When the owning process dies without cleanup, the lease dir survives and the daemon continues to resolve the session as active, blocking UI deletion. There is no sweep that reclaims leases whose owner PID is dead.
B. The partial upstream fix (PR #1079) is broken. Cherry-picked and bisected locally:
shouldPersistWithoutAssistantexcludessession_state, keeps onlysession_info) is the REGRESSION: reverting just that line restores 193/193; with it, 20 daemon-mode tests fail with ~30s timeouts.readSessionInfo()(session-manager.ts:1005) readssession_stateentries to discover passive/draft sessions; callers include daemon-catalog-process.ts:70/74/99/247 and daemon-mode.ts:1088/2067/2128/3723 for RLM heartbeat restore, passive-child hydration, and saved-session catalog. Excludingsession_statefrom the persist bypass makes legitimate passive sessions undiscoverable. A ghost draft and a legitimate passive RLM child share the same on-disk shape (session_state, no assistant message), so the exclusion breaks passive-session discovery.Suggested fix
Workaround
Deleting the orphaned files with rm works (the ghosts on disk are safely removable once their lease PIDs are dead), and a standalone cleanup script externalizing 153b291's sweep logic survives Homebrew upgrades. But the UI-level deletion should work without manual file surgery.
Related
All reactions