Skip to content

Conversation

@mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Jan 16, 2026

Pretty sure i fixed this at some point but don't see that work at all. This fixes diagnostics by fixing the reconnecting LSP logic.

Fixes #7867

@vercel
Copy link

vercel bot commented Jan 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jan 16, 2026 8:53pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes LSP diagnostics by ensuring that event subscriptions are properly maintained across WebSocket reconnections. The fix addresses an issue where LSP event handlers (for notifications, responses, etc.) were lost when the WebSocket connection was re-established.

Changes:

  • Added subscription tracking and re-registration on reconnection in ReconnectingWebSocketTransport
  • Added comprehensive test coverage for subscribe/unsubscribe functionality

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
frontend/src/core/lsp/transport.ts Added Subscription interface, pendingSubscriptions tracking array, and overridden subscribe/unsubscribe methods to maintain subscriptions across reconnections
frontend/src/core/lsp/tests/transport.test.ts Added mock methods for subscribe/unsubscribe and comprehensive test suites covering subscription tracking, delegate registration, and reconnection scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -134,6 +146,42 @@ export class ReconnectingWebSocketTransport extends Transport {
this.connectionPromise = undefined;
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

Consider clearing the pendingSubscriptions array in the close method to prevent potential memory leaks. When the transport is closed, there's no need to keep the subscription handlers in memory, as they won't be used for future reconnections (since isClosed prevents reconnection). Adding this.pendingSubscriptions = []; would ensure cleanup.

Suggested change
this.connectionPromise = undefined;
this.connectionPromise = undefined;
this.pendingSubscriptions = [];
Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't hit, but good to reset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this gets called once. I think it's safer having this around in case it reconnects

@mscolnick mscolnick merged commit f72e8f6 into main Jan 18, 2026
39 of 42 checks passed
@mscolnick mscolnick deleted the ms/fix-diagnostics branch January 18, 2026 05:02
@github-actions
Copy link

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.19.5-dev13

botterYosuke pushed a commit to botterYosuke/marimo that referenced this pull request Jan 18, 2026
mscolnick added a commit that referenced this pull request Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

3 participants