fix: handle undefined sessionStatus in pollRunningTasks (#2387)#2388
Merged
code-yeongyu merged 1 commit intodevfrom Mar 8, 2026
Merged
fix: handle undefined sessionStatus in pollRunningTasks (#2387)#2388code-yeongyu merged 1 commit intodevfrom
code-yeongyu merged 1 commit intodevfrom
Conversation
When a completed session is no longer returned by session.status(), allStatuses[sessionID] is undefined. Previously this fell through to a 'still running' log, leaving the task stuck as running forever. Match the sync-session-poller pattern: only continue (skip completion check) when sessionStatus EXISTS and is not idle. When undefined, fall through to validateSessionHasOutput + checkSessionTodos + tryCompleteTask, same as idle.
Owner
Author
|
@cubicdev please review |
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Fixes a bug where tasks got stuck by treating undefined session status as potentially completed, with safety checks and tests included. Matches existing poller patterns.
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
pollRunningTasks()inBackgroundManagerto handleundefinedsessionStatus (when completed sessions are no longer in the status response)sync-session-pollerpattern: only skip completion check when status EXISTS and is not idle; when undefined, fall through to completion detectionRoot Cause
When
session.status()stops returning a completed session,allStatuses[sessionID]isundefined. The old code only handledidleexplicitly, treatingundefinedas "still running" — which left the task stuck in running status forever.Fix
Restructured the control flow in
pollRunningTasks():retryfirst (preserve existing retry handling)if (sessionStatus && sessionStatus.type !== "idle") { continue }— only continue if status exists AND is not idlevalidateSessionHasOutput+checkSessionTodos+tryCompleteTaskfor both idle AND undefined casesThis matches the pattern already used in
sync-session-poller.ts:75.Closes #2387
Summary by cubic
Fixes background task polling so a missing session status no longer leaves tasks stuck in "running". Matches
sync-session-pollerbehavior and adds tests for undefined, idle, and busy states.pollRunningTasks()inBackgroundManagerto handleundefinedsessionStatusby running completion checks (validate output, check todos, then complete).idle; keepretryhandling and improve logs.Written for commit dc370f7. Summary will update on new commits.