Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 22, 2025

This PR implements notification badges for GitHub Copilot coding agent chat sessions to alert users when sessions are completed and need attention. The implementation assumes the VS Code core badge API has been implemented (badge and badgeTooltip properties on ChatSessionItem).

Overview

When coding agent sessions complete, users now see a visual badge indicator (●) next to the session in the chat sessions list. This helps users quickly identify which sessions have finished and need their review, improving the overall workflow experience.

Key Features

1. Badge Visual Indicators

  • Shows a "●" badge symbol for completed sessions that haven't been viewed
  • Displays tooltip "Session completed - click to view results" when hovering over the badge
  • Badges automatically disappear when users open/interact with sessions

2. Persistent State Management

  • Tracks viewed session state using VS Code's globalState API with key copilot.viewedSessions
  • Automatically cleans up old entries (>30 days) to prevent storage bloat
  • State persists across VS Code restarts

3. Real-time Updates

  • New onDidChangeSessionBadges event fires when badge state changes
  • Integrates with existing refreshChatSessions() flow
  • Reactive badge updates without impacting session loading performance

4. Backward Compatibility

  • Gracefully degrades when badge properties are not supported in VS Code
  • No breaking changes to existing chat session functionality
  • Maintains compatibility with current session status tracking

Implementation Details

API Extensions

Extended the ChatSessionItem interface in vscode.proposed.chatSessionsProvider.d.ts:

export interface ChatSessionItem {
  // ... existing properties
  badge?: string;
  badgeTooltip?: string;
}

Core Logic

The badge logic in provideChatSessions() method:

// Badge logic: show badge for completed sessions that haven't been viewed
const hasNewCompletions = status === vscode.ChatSessionStatus.Completed && 
  this.hasUnviewedCompletion(sessionId);

return {
  // ... other properties
  badge: hasNewCompletions ? '●' : undefined,
  badgeTooltip: hasNewCompletions ? vscode.l10n.t('Session completed - click to view results') : undefined
};

State Management Methods

  • markSessionAsViewed(sessionId): Marks a session as viewed and removes badge
  • hasUnviewedCompletion(sessionId): Checks if session has unviewed completion
  • getUnviewedSessionCount(): Returns total count of unviewed sessions

Testing

Added focused unit tests covering:

  • Badge state management methods
  • Event emission for badge changes
  • Session marking and tracking functionality
  • Integration with existing test infrastructure

Files Modified

  • src/@types/vscode.proposed.chatSessionsProvider.d.ts: Extended interface with badge properties
  • src/github/copilotRemoteAgent.ts: Core implementation with state management
  • src/test/github/copilotRemoteAgent.test.ts: Unit tests for badge functionality

This implementation provides a seamless user experience for tracking completed coding agent sessions while maintaining backward compatibility and clean integration with the existing codebase.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: node ./out/src/test/runTests.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Base automatically changed from osortega/refresh-chat-sessions-launch to main August 22, 2025 20:20
@Copilot Copilot AI changed the title [WIP] Implement chat session notification badges using new VS Code badge API Implement chat session notification badges using new VS Code badge API Aug 22, 2025
@Copilot Copilot AI requested a review from osortega August 22, 2025 20:23
Copilot finished work on behalf of osortega August 22, 2025 20:23
@alexr00
Copy link
Member

alexr00 commented Aug 25, 2025

@osortega I haven't looked at the code, but I expect this needs to be done in core. From an extension, you need to be the one to create the tree-view in order to put a badge on it.

@osortega
Copy link
Contributor

@copilot Add more test


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