Skip to content

Conversation

@arthur404dev
Copy link
Contributor

@arthur404dev arthur404dev commented Jan 10, 2026

Problem

When parallel background agent tasks complete, their LSP servers (for repos cloned to /tmp/) remain running until a 5-minute idle timeout. This causes memory accumulation with heavy parallel Sisyphus usage, potentially leading to OOM crashes.

Root cause: SkillMcpManager has disconnectSession() called on session.deleted events, but LSPServerManager has no equivalent cleanup mechanism.

Manager disconnectSession() Called on session.deleted
SkillMcpManager
LSPServerManager MISSING

Solution

Added cleanupTempDirectoryClients() to LSPServerManager (matching the pattern used by SkillMcpManager.disconnectSession()) and call it on session.deleted events.

The cleanup targets idle LSP clients (refCount=0) for temporary directories (/tmp/, /var/folders/) where agent tasks clone repos.

Changes

  • src/tools/lsp/client.ts: Added cleanupTempDirectoryClients() method
  • src/tools/index.ts: Exported lspManager
  • src/index.ts: Call cleanup on session.deleted

Testing

  • Build passes ✅
  • Follows same pattern as MCP cleanup (SkillMcpManager.disconnectSession)

Related Issues


Summary by cubic

Clean up idle LSP servers in temp directories when a session is deleted to prevent memory buildup from background agent tasks. Reduces lingering tsserver processes and lowers OOM risk during heavy parallel runs.

  • Bug Fixes
    • Added LSPServerManager.cleanupTempDirectoryClients() to stop idle (refCount=0) clients in /tmp and /var/folders.
    • Call cleanup on session.deleted; export lspManager for use in index.ts.

Written for commit a8d6cf6. Summary will update on new commits.

I have read the CLA Document and I hereby sign the CLA

When parallel background agent tasks complete, their LSP servers (for
repos cloned to /tmp/) remain running until a 5-minute idle timeout.
This causes memory accumulation with heavy parallel Sisyphus usage,
potentially leading to OOM crashes.

This change adds cleanupTempDirectoryClients() to LSPServerManager
(matching the pattern used by SkillMcpManager.disconnectSession())
and calls it on session.deleted events.

The cleanup targets idle LSP clients (refCount=0) for temporary
directories (/tmp/, /var/folders/) where agent tasks clone repos.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 10, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@arthur404dev
Copy link
Contributor Author

recheck

@arthur404dev
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Jan 10, 2026
@code-yeongyu code-yeongyu merged commit 0c12787 into code-yeongyu:dev Jan 11, 2026
3 of 4 checks passed
renekris pushed a commit to renekris/oh-my-glm that referenced this pull request Jan 11, 2026
KNN-07 pushed a commit to KNN-07/oh-my-opencode that referenced this pull request Jan 11, 2026
…yu#676)

* fix(lsp): cleanup orphaned LSP servers on session.deleted

When parallel background agent tasks complete, their LSP servers (for
repos cloned to /tmp/) remain running until a 5-minute idle timeout.
This causes memory accumulation with heavy parallel Sisyphus usage,
potentially leading to OOM crashes.

This change adds cleanupTempDirectoryClients() to LSPServerManager
(matching the pattern used by SkillMcpManager.disconnectSession())
and calls it on session.deleted events.

The cleanup targets idle LSP clients (refCount=0) for temporary
directories (/tmp/, /var/folders/) where agent tasks clone repos.

* chore: retrigger CI checks
kdcokenny pushed a commit that referenced this pull request Jan 13, 2026
kdcokenny pushed a commit that referenced this pull request Jan 13, 2026
* fix(lsp): cleanup orphaned LSP servers on session.deleted

When parallel background agent tasks complete, their LSP servers (for
repos cloned to /tmp/) remain running until a 5-minute idle timeout.
This causes memory accumulation with heavy parallel Sisyphus usage,
potentially leading to OOM crashes.

This change adds cleanupTempDirectoryClients() to LSPServerManager
(matching the pattern used by SkillMcpManager.disconnectSession())
and calls it on session.deleted events.

The cleanup targets idle LSP clients (refCount=0) for temporary
directories (/tmp/, /var/folders/) where agent tasks clone repos.

* chore: retrigger CI checks
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.

2 participants