Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 11, 2025

Fixes #254495

Currently, the terminalAndTaskState prompt element only tracks terminals created by Copilot using getCopilotTerminals(). This means regular user-created terminals are invisible to the chat context, limiting Copilot's awareness of the user's development environment.

Changes

Core Implementation

  • Expanded terminal tracking: Changed from only showing getCopilotTerminals() to showing all terminals from this.terminalService.terminals
  • Preserved Copilot features: Enhanced metadata (like terminal IDs for tool usage) is still available for Copilot-managed terminals
  • Improved user experience: Updated messaging from "Copilot Terminals" to "Active Terminals" to reflect the broader scope

Enhanced Terminal Information

Each terminal now shows:

  • Terminal name
  • Last executed command with exit code
  • Current working directory
  • Appropriate output access instructions (enhanced tools for Copilot terminals, basic info for others)

Test Updates

  • Updated test cases to expect all terminals to be visible
  • Added coverage for scenarios with mixed Copilot and user terminals
  • Fixed mock functions to properly handle the new terminal merging logic

Before vs After

Before:

Copilot Terminals: No active Copilot terminals found.

Even when the user has active terminals running dev servers, tests, etc.

After:

Active Terminals:
Terminal: bash
Last Command: npm run dev
Cwd: /workspace
Exit Code: 0
Output: Terminal output available via VS Code terminal commands.

Terminal: test-runner  
Last Command: npm test
Cwd: /workspace
Exit Code: 1
Output: Terminal output available via VS Code terminal commands.

Impact

This significantly improves Copilot's contextual awareness by providing visibility into:

  • Development servers running in user terminals
  • Test runners and their status
  • Build processes and their working directories
  • Command history showing recent development activity

The change maintains backward compatibility while extending functionality to cover the user's complete terminal environment.

Warning

Firewall rules blocked me from connecting to one or more addresses

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

  • iojs.org
    • Triggering command: curl --fail --compressed -q -L -s REDACTED -o - (dns block)

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


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@meganrogge meganrogge closed this Jul 11, 2025
@Copilot Copilot AI changed the title [WIP] make a new draft pr to fix this issue @microsoft/vscode/pull/255448 Track all terminals in terminalAndTaskState, not just Copilot terminals Jul 11, 2025
@Copilot Copilot AI requested a review from meganrogge July 11, 2025 17:19
Copilot finished work on behalf of meganrogge July 11, 2025 17:19
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