Complete running terminal command when its tab is closed by vogella · Pull Request #488 · microsoft/copilot-for-eclipse · GitHub
Skip to content

Complete running terminal command when its tab is closed - #488

Open
Lars Vogel (vogella) wants to merge 1 commit into
microsoft:mainfrom
vogellacompany:terminal-close-completes-command
Open

Lars Vogel (vogella) wants to merge 1 commit into
microsoft:mainfrom
vogellacompany:terminal-close-completes-command

Conversation

@vogella

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

Copy link
Copy Markdown
Contributor

When the user closed the Copilot terminal tab while an agent's foreground command was still running, the dispose listener only cleared the view control and never completed the command's future. Since that future has no timeout, the run_in_terminal tool call never returned and the chat turn hung until the user cancelled it. When the disposed widget is the current Copilot tab, the listener now clears the tab, view control and output buffer and completes the pending command with a "terminal was closed" message, in both the Eclipse terminal and the TM terminal implementation, so the agent gets a result and can continue. The listener deliberately takes no lock, since it runs on the UI thread while lock holders wait on syncExec, so the shared fields are volatile and revealTerminal() works on a snapshot of the tab item.

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

Both implementations retain stale output that can prematurely complete the next command.

2 open findings
What changed in this PR

Completes pending terminal futures when users close active Copilot terminal tabs.

Changes:

  • Returns a terminal-closed result for interrupted foreground commands.
  • Clears stale terminal tab references in both implementations.
File Description
com.microsoft.copilot.eclipse.ui.terminal/​.../​RunInTerminalTool.java Handles closure in the modern terminal.
com.microsoft.copilot.eclipse.ui.terminal.tm/​.../​RunInTerminalTool.java Mirrors handling for the legacy TM terminal.

🧠 Review effort: Balanced


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

@vogella
Lars Vogel (vogella) force-pushed the terminal-close-completes-command branch 2 times, most recently from ec944b7 to ec954b9 Compare October 15, 2026 16:04
@jdneo
Sheng Chen (jdneo) requested a balanced review from Copilot October 16, 2026 08:34

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

Both disposal listeners can erase a concurrently registered command, leaving its future unresolved.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

Comment on lines +380 to +381
Closing the Copilot terminal tab while a foreground command was running left the command's future incomplete, so the agent's run_in_terminal call never returned and the chat turn hung until cancelled. When the disposed widget is the current Copilot tab, the dispose listener now clears the tab, view control and output buffer and completes the pending command. The listener takes no lock because it runs on the UI thread while lock holders wait on syncExec, so the shared fields are volatile and revealTerminal() works on a snapshot of the tab item.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
Lars Vogel (vogella) force-pushed the terminal-close-completes-command branch from ec954b9 to 95bb2a5 Compare October 16, 2026 20:46
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