-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Session lane stays stuck indefinitely when orphaned task has no active embedded run handle #99847
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Problem
When a session lane has an orphaned task (active task whose promise will never settle) but no active embedded run handle,
recoverStuckDiagnosticSession()unconditionally returnskeep_laneon every heartbeat cycle. This creates an infinite recovery loop that blocks the session lane for up to 48 hours.Symptoms
stuck session recovery outcome: skipped/keep_lane/active_lane_taskactiveCountremains > 0 indefinitelyAffected Scenarios
EmbeddedAttemptSessionTakeoverError, the embedded run handle is cleaned up, but the parent cron run session's lane task promise remains pending for 48 hoursRoot Cause
In the recovery decision tree at
recoverStuckDiagnosticSession(), Step 6 (active_lane_task branch) has no time-based escape hatch. Steps 4-5 checkisActiveRunProgressStale()againststaleActiveProgressAbortMsbefore deciding to skip. Step 6 unconditionally returnskeep_lanewhenactiveCount > 0and no active embedded run handle is found.Proposed Fix
Add a time-based escape hatch: when the stuck session age exceeds
staleActiveProgressAbortMs(~360s) orallowActiveAbortis true, force-reset the lane viaresetCommandLane()and returnrelease_lane/stale_lane_task.The fix uses
params.ageMsdirectly rather thanisActiveRunProgressStale()because the orphaned task scenario typically hasqueueDepth === 0, which would causeisActiveRunProgressStale()to incorrectly return false.