From 6ce2e34e3e2163345b563f00841f80bed06e04e2 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 17 Sep 2026 01:22:23 -0700 Subject: [PATCH] fix(agent-status): stop a session-boundary row clearing a sleeping record Resolving the merge with main, this branch's turn-complete predicate replaced main's plain done check in the worktree-scoped arm of the resume claim. That was the wrong half to keep. A launch-membership row carries no provider session, and the equality guard above the arm returns false whenever either side is undefined, so a membership row can never reach it; the substitution had no effect on membership at all. What it did reach were the rows that do carry a provider session and a session boundary -- SessionStart, Grok and remote compact completion, all of which predate this branch. Claiming there runs clearSleepingAgentSession, so a pending auto-resume was deleted rather than deferred, with nothing left to retry from. main's live-PTY ownership arm is untouched. --- src/renderer/src/lib/resume-sleeping-agent-session.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/lib/resume-sleeping-agent-session.ts b/src/renderer/src/lib/resume-sleeping-agent-session.ts index ae437d2fbc3..297f320e3f5 100644 --- a/src/renderer/src/lib/resume-sleeping-agent-session.ts +++ b/src/renderer/src/lib/resume-sleeping-agent-session.ts @@ -23,7 +23,6 @@ import { import { parkUntilHostMirrorHandleLands } from './host-mirror-handle-gap-wait' import { resolveWorkspaceTerminalHostAuthority } from './workspace-terminal-host-authority' import { parkUntilHostSessionMirrorHydrates } from '@/runtime/host-session-mirror-hydration' -import { isAgentStatusTurnComplete } from '../../../shared/agent-completion-time' export type { ResumeSleepingAgentSessionsOptions } from './sleeping-agent-session-launch' @@ -137,10 +136,12 @@ function activeOrQueuedResumeClaimsProviderSession( ) { return true } - // A launch-membership boundary row is a `done` that never carried a turn, so it must keep - // claiming the provider session rather than read as a finished one and release the record. + // Deliberately `state`, not the turn-complete predicate: a launch-membership row carries no + // provider session, so the equality guard above already excludes it and widening this arm to + // boundary rows would only reach SessionStart/compact rows — whose records this claim then + // clears, turning a pending auto-resume into a deleted one. if ( - !isAgentStatusTurnComplete(entry) && + entry.state !== 'done' && worktreeTabIds.has(tabId ?? '') && entry.worktreeId === record.worktreeId ) {