Skip to content

Drop unregistered terminal service in TerminalServiceManager - #491

Open
Lars Vogel (vogella) wants to merge 1 commit into
microsoft:mainfrom
vogellacompany:terminal-service-removed
Open

Lars Vogel (vogella) wants to merge 1 commit into
microsoft:mainfrom
vogellacompany:terminal-service-removed

Conversation

@vogella

@vogella Lars Vogel (vogella) commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

TerminalServiceManager cached the IRunInTerminalTool in a separate field and its ServiceTracker had an empty removedService, so once the terminal bundle was stopped, updated or uninstalled, getCurrentService() kept handing the dead service to ChatView and RunInTerminalToolAdapter, and the service reference obtained in addingService was never released. getCurrentService() now reads the service directly from the ServiceTracker, which drops removed services itself, and removedService calls ungetService for the removed reference. Dropping the cache also avoids keeping it consistent across concurrent tracker callbacks. Callers already handle a null service, so a stopped terminal bundle now produces the existing "No terminal implementation available" tool result instead of calls into a stale service. Open PR #471 rewrites this file but keeps removedService empty, so whichever lands second needs a trivial rebase.

Copilot AI balanced review requested due to automatic review settings October 15, 2026 05:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Concurrent removal callbacks can still leave an unregistered service cached and returned to callers.

1 open finding
What changed in this PR

Updates terminal-service cleanup so the Eclipse plugin can stop using unregistered implementations.

Changes:

  • Selects another tracked service, or null, when the current service is removed.
  • Releases the removed service reference.
File Description
com.microsoft.copilot.eclipse.terminal.api/​src/​com/​microsoft/​copilot/​eclipse/​terminal/​api/​TerminalServiceManager.java Adds service replacement and reference release during removal.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

removedService was empty, so after the terminal bundle was stopped or updated getCurrentService() kept returning the unregistered service from a separate cache and its reference was never released. getCurrentService() now reads the service from the ServiceTracker, which drops removed services itself, and removedService ungets the reference.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
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