Skip to content

fix: prevent cleanup from removing sessions with open PRs#283

Closed
bhavikprit wants to merge 2 commits intoComposioHQ:mainfrom
bhavikprit:fix/cleanup-open-pr-146
Closed

fix: prevent cleanup from removing sessions with open PRs#283
bhavikprit wants to merge 2 commits intoComposioHQ:mainfrom
bhavikprit:fix/cleanup-open-pr-146

Conversation

@bhavikprit
Copy link

Before this fix, cleanup would kill sessions with dead runtimes regardless of whether they had an open PR. This caused orphaned PRs where no session owned them anymore.

Now when cleanup detects a dead runtime, it checks if the session has an associated PR that is still open. If so, the session is skipped (preserved for human attention) rather than silently removed.

Conservative fallback: if the PR state check fails (API error), the session is also preserved to avoid data loss.

Added two regression tests:

  • Dead runtime + open PR → session skipped
  • Dead runtime + PR check fails → session conservatively skipped

Closes #146

Before this fix, cleanup would kill sessions with dead runtimes
regardless of whether they had an open PR. This caused orphaned PRs
where no session owned them anymore.

Now when cleanup detects a dead runtime, it checks if the session has
an associated PR that is still open. If so, the session is skipped
(preserved for human attention) rather than silently removed.

Conservative fallback: if the PR state check fails (API error), the
session is also preserved to avoid data loss.

Added two regression tests:
- Dead runtime + open PR → session skipped
- Dead runtime + PR check fails → session conservatively skipped

Closes ComposioHQ#146
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

When session.pr exists but plugins.scm is null (SCM plugin not
configured or not loaded), the cleanup code now assumes the PR
is open instead of killing the session. This prevents accidentally
removing sessions with open PRs when the SCM plugin is unavailable.
@bhavikprit
Copy link
Author

Closing — superseded by upstream #453 (fix: protect orchestrators from session cleanup), merged Mar 13. The session cleanup logic has been significantly refactored and our PR's hasOpenPR guard pattern no longer matches the current codebase.

@bhavikprit bhavikprit closed this Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: cleanup removes sessions with open PRs that never left 'starting' state

1 participant