Reaper: sticky blocked/waiting_input prevents termination on conclusive ProbeDead (Cursor)
Summary
When a Cursor worker is in a sticky activity state (blocked, waiting_input), the reaper can report ProbeDead while isTerminated stays false indefinitely.
RCA status: Confirmed on upstream main at 038547a74 (2026-10-14).
Sticky states are treated as always having “recent” activity. runtimeClearlyDead requires both ProbeDead and !hasRecentActivity, so a conclusive dead probe never satisfies termination while activity remains sticky.
Stickiness is meant to block time-based demotion, not to override a conclusive runtime death fact from the reaper.
Evidence scope: This issue is code / unit-repro only.
Affected code (backend/internal/lifecycle/runtime.go on main)
func runtimeClearlyDead(f ports.RuntimeFacts, activity domain.Activity, now time.Time, window time.Duration) bool {
observedAt := timeOr(f.ObservedAt, now)
return f.Runtime == ports.ProbeDead && !hasRecentActivity(activity, observedAt, window)
}
func hasRecentActivity(a domain.Activity, now time.Time, window time.Duration) bool {
switch {
// ...
case a.State.IsSticky():
return true
ApplyRuntimeObservation (manager.go) only sets IsTerminated when runtimeClearlyDead is true (plus launch/mutation guards).
Expected behavior
If the runtime adapter returns ProbeDead (definitively gone—not ProbeFailed), the reaper should terminate even when activity is blocked or waiting_input (e.g. Cursor dies while paused on an AO permission hook).
Actual behavior
Session remains isTerminated: false while activity is sticky and runtime probes are conclusively dead.
Reproduction
Code / unit level
- Persist activity
blockedorwaiting_input(e.g. permission hook underdefaultpermission mode). - Apply
RuntimeFacts{Runtime: ProbeDead}via reaper orApplyRuntimeObservation. - Observe no termination on
main.
Proposed fix direction
In runtimeClearlyDead: if f.Runtime == ProbeDead and activity.State.IsSticky(), return true; otherwise keep existing non-sticky logic. Unit tests; optional integration test: permission → blocked → dead probe → reaper tick → terminated.
Environment
- Harness: cursor,
worker.agentConfig.permissions: default - Runtime handles:
ptyhost-v1:<session-id>(no tmux on machine)
Related
- #6727
I'd like to take this. Plan, following the fix direction above: in runtimeClearlyDead (backend/internal/lifecycle/runtime.go), treat a conclusive ProbeDead as death when the activity state is sticky (blocked / waiting_input). Stickiness keeps blocking the time-based demotion, and ProbeFailed / ProbeAlive still never count as death. Tests: a table test in internal/lifecycle covering sticky and non-sticky states against dead/failed/alive probes, plus an ApplyRuntimeObservation case where a blocked session with a dead probe gets terminated. @LaibaFirdouse, if you were planning to send this yourself, let me know and I'll step back.