Guard ChatTipService against disposed scoped context key service#314757
Merged
Conversation
…wnTipIfNowIneligible Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/6a02e479-714c-4b80-b0f1-dcb69f4f36c4 Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix unhandled error for AbstractContextKeyService disposal
Guard May 6, 2026
ChatTipService against disposed scoped context key service
meganrogge
approved these changes
May 6, 2026
meganrogge
approved these changes
May 6, 2026
TylerLeonhardt
approved these changes
May 6, 2026
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.
Unhandled error
AbstractContextKeyService has been disposedfromChatTipService._hideShownTipIfNowIneligible -> _isEligible -> contextMatchesRules.ChatTipServiceis a singleton that stashes the scopedIContextKeyServiceof whichever chat widget last requested a welcome tip. When that widget is torn down withoutresetSession()being called, the scoped service is disposed but the singleton retains the stale reference. The nextIChatService.onDidSubmitRequest(a global event fired by any chat widget) then callscontextMatchesRuleson the disposed service and throws.Changes
chatTipService.ts— Wrap the eligibility check in_hideShownTipIfNowIneligiblewith try/catch; on throw, drop the stale_contextKeyServiceand bail (nothing to hide for a torn-down widget).chatTipService.test.ts— Regression test: simulate a disposed scoped service by overridingcontextMatchesRulesto throw the matching error, then assertonDidSubmitRequestdoes not throw.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
redirector.gvt1.com/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --enable-crash-reporter=9e235240-25a7-4aa2-841e-a1b475510a49,no_channel --user-data-dir=/tmp/vscode-tests-1778081838979 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2986972629153322651,12185066939970648515,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --trace-process-track-uuid=3190708989122997041(dns block)./.build/electron/code-oss ./.build/electron/code-oss --no-sandbox test/unit/electron/index.js --grep disposed --runGlob **/chat/test/**/chatTipService.test.js(dns block)If you need me to access, download, or install something from one of these locations, you can either: