terminal: cancel unnecessary telemetry timeout on disposal - #333963
Open
Simon Siefke (SimonSiefke) wants to merge 3 commits into
Open
terminal: cancel unnecessary telemetry timeout on disposal#333963Simon Siefke (SimonSiefke) wants to merge 3 commits into
Simon Siefke (SimonSiefke) wants to merge 3 commits into
Conversation
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
September 2, 2026 10:09
View session
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Contribution teardown can trigger an unhandled cancellation rejection.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Cancels pending terminal telemetry timeouts when per-terminal listeners are disposed.
Changes:
- Makes the shell-integration timeout cancellation-aware.
- Adds a regression test for terminal disposal.
File summaries
| File | Description |
|---|---|
terminalTelemetry.ts |
Cancels the telemetry delay during disposal. |
terminalTelemetry.test.ts |
Verifies timeout cancellation and telemetry emission. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes #276610
Details
When a terminal is created, terminal telemetry waits for the process to become ready and then allows another 10 seconds for shell integration. If the terminal is closed during that delay, telemetry is sent immediately, but the unused timeout continues until it expires.
The timeout is bounded to 10 seconds, so this is not a permanent memory leak. Repeatedly creating and closing terminals can still leave several unnecessary timeout promises pending at once.
Change
Cancel the shell integration timeout when the per-terminal telemetry listeners are disposed.
Before
When creating and closing a terminal 37 times, pending terminal telemetry promises remain until their 10-second timeouts expire:
After
The timeout is canceled when the terminal closes, so the pending promise settles immediately.
Test Video
terminal-create.webm