Repository navigation
Drop unregistered terminal service in TerminalServiceManager - #491
Open
Lars Vogel (vogella) wants to merge 1 commit into
Open
Lars Vogel (vogella) wants to merge 1 commit into
Lars Vogel (vogella) wants to merge 1 commit into
Conversation
Lars Vogel (vogella)
requested review from
Ethan Hou (ethanyhou),
Sheng Chen (jdneo) and
xinyi-gong
as code owners
October 15, 2026 05:40
Contributor
There was a problem hiding this comment.
🟡 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.
Lars Vogel (vogella)
force-pushed
the
terminal-service-removed
branch
2 times, most recently
from
October 17, 2026 14:58
d475682 to
a4476b9
Compare
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 🤖
Lars Vogel (vogella)
force-pushed
the
terminal-service-removed
branch
from
October 17, 2026 15:01
a4476b9 to
cabbafb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.