Skip to content

Conversation

@mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Nov 25, 2025

This listens on notifications GitHub copilot status and logs and forwards them to the UI and browser console, respectively.

This also fixes an issue with the LazyTransport to forward subscriptions to get the notifications wired up.

@vercel
Copy link

vercel bot commented Nov 25, 2025

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

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Dec 1, 2025 2:31pm

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 enhances the GitHub Copilot integration by implementing real-time status forwarding from the Copilot language server to the footer UI icon. The implementation listens to LSP notifications (status updates and log messages) and displays them to users through visual indicators and tooltips. A key improvement is the fix to LazyTransport to properly forward subscriptions to the underlying WebSocket delegate, which enables the notification system to work correctly.

  • Added notification handling for Copilot status updates (statusNotification and didChangeStatus)
  • Implemented log message forwarding from Copilot LSP to browser console with appropriate log levels
  • Enhanced footer icon to display status through color changes (yellow for warnings/errors) and dynamic labels
  • Fixed subscription forwarding in LazyWebsocketTransport to ensure notifications are properly registered on the delegate

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/core/codemirror/copilot/types.ts Added GitHubCopilotStatusNotificationParams interface to define the structure of status notifications from the Copilot LSP
frontend/src/core/codemirror/copilot/transport.ts New file implementing LazyWebsocketTransport with proper subscription forwarding to delegate, extracted from inline class in client.ts
frontend/src/core/codemirror/copilot/state.ts Added copilotStatusState atom to store and reactively update Copilot status across the application
frontend/src/core/codemirror/copilot/language-server.ts Implemented handleNotification method to process incoming LSP notifications and update state/logs accordingly
frontend/src/core/codemirror/copilot/client.ts Refactored to use extracted LazyWebsocketTransport class with dependency injection pattern for better testability
frontend/src/core/codemirror/copilot/tests/transport.test.ts Comprehensive test suite covering subscription handling, reconnection logic, and error scenarios for the transport layer
frontend/src/components/editor/chrome/wrapper/footer-items/copilot-status.tsx Enhanced footer icon with dynamic status display based on busy, kind, and message fields from status notifications

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

Comment on lines +280 to +324
/**
* Handle notifications from the Copilot language server.
* Uses onNotification to listen for statusNotification, didChangeStatus, and window/logMessage.
*/
private handleNotification: Parameters<
LanguageServerClient["onNotification"]
>[0] = (notif) => {
if (!notif.params) {
return;
}

const notification = notif as unknown as EnhancedNotification;

// Handle statusNotification
if (notification.method === "statusNotification") {
store.set(copilotStatusState, notification.params);
}

// Handle didChangeStatus
if (notification.method === "didChangeStatus") {
store.set(copilotStatusState, notification.params);
}

// Handle window/logMessage
if (notification.method === "window/logMessage") {
const params = notification.params as { type: number; message: string };
const { type, message } = params;
// Map LSP log types to console methods
// type: 1 = Error, 2 = Warning, 3 = Info, 4 = Log
switch (type) {
case 1: // Error
logger.error("[GitHub Copilot]", message);
break;
case 2: // Warning
logger.warn("[GitHub Copilot]", message);
break;
case 3: // Info
logger.debug("[GitHub Copilot]", message);
break;
default: // Log (type 4 and others)
logger.log("[GitHub Copilot]", message);
break;
}
}
};
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

Missing test coverage for the new notification handling functionality. The handleNotification method handles three different notification types (statusNotification, didChangeStatus, and window/logMessage) but there are no tests for this behavior. Consider adding tests to verify that:

  1. Status notifications properly update the copilotStatusState
  2. Log messages are correctly routed to the appropriate logger methods based on type
  3. Notifications without params are ignored

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@Light2Dark Light2Dark left a comment

Choose a reason for hiding this comment

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

looks good, much cleaner 👍🏾

@mscolnick mscolnick merged commit c54359d into main Dec 1, 2025
26 checks passed
@mscolnick mscolnick deleted the ms/forward-status-to-copilot branch December 1, 2025 15:57
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.

3 participants