Skip to content

smoke: fix flaky Chat Sessions copilot-chat activation race#322187

Open
alexdima wants to merge 1 commit into
mainfrom
agents/gh-investigate-vscode-failure-logs-db012796
Open

smoke: fix flaky Chat Sessions copilot-chat activation race#322187
alexdima wants to merge 1 commit into
mainfrom
agents/gh-investigate-vscode-failure-logs-db012796

Conversation

@alexdima

Copy link
Copy Markdown
Member

Problem

The Chat Sessions › Test Copilot CLI session smoke test failed intermittently with:

Error: Timeout: get element '.editor-instance .interactive-session' after 60 seconds.
  at Chat.waitForChatEditor (test/automation/out/chat.js:38)
  at openSession (chatSessions.test.js:51)

(seen e.g. in run 27850813533 — the failing test, while Test Claude session and Test Local session in the same suite passed.)

Root cause

The Chat Sessions suite runs immediately after the Chat Disabled suite, which disables AI features (chat.disableAIFeatures). When Chat Sessions re-enables them in its before() hook, there is a brief window where the copilot-chat extension is still disabled and its contributed commands are not yet registered as activation triggers.

The smoke helper smoketest.openCopilotCliChat invoked github.copilot.debug.extensionState to force-activate copilot-chat. In that window the renderer CommandService.executeCommand path is not robust for an as-yet-disabled extension — it races * activation against command registration and rejects with command 'github.copilot.debug.extensionState' not found. That rejection aborted the handler before it reached waitForCommand(...) / opened the chat editor, so waitForChatEditor timed out after 60s.

Artifact logs confirm the timing: the executeCommand failed at 22:45:00.609, ~50ms before copilot-chat enablement was applied at 22:45:00.66 (onEnablementChangeddeltaExtensions toAdd: [copilot-chat]), with the extension only activating at 22:45:01.219.

Fix

Reuse the existing waitForCommand helper to wait until github.copilot.debug.extensionState is registered before invoking it. This gates on copilot-chat being enabled and activated, so the handler no longer races enablement.

Applied to both smoketest.openCopilotCliChat and smoketest.openClaudeChat.

The Chat Sessions smoke test runs right after the Chat Disabled suite,
which disables AI features. When the suite re-enables them, there is a
brief window where copilot-chat is still disabled and its commands are
not yet registered. The smoke helper invoked
'github.copilot.debug.extensionState' to force-activate copilot-chat,
but that executeCommand rejected with 'command not found' during this
window, aborting the handler before it could open the chat editor and
causing a 60s timeout on '.editor-instance .interactive-session'.

Wait for the diagnostic command to be registered (via the existing
waitForCommand helper) before invoking it, so the handler no longer
races copilot-chat enablement/activation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 20, 2026 00:14

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.

Pull request overview

This PR hardens the VS Code smoke test extension-host helper commands used by the “Chat Sessions” smoke suite by avoiding an activation/enablement race with GitHub Copilot-related commands after the preceding “Chat Disabled” suite.

Changes:

  • Gate smoketest.openCopilotCliChat on github.copilot.debug.extensionState being registered before invoking it.
  • Apply the same gating to smoketest.openClaudeChat to avoid the same race pattern.
Show a summary per file
File Description
test/smoke/extensions/vscode-smoketest-ext-host/extension.js Adds waitForCommand('github.copilot.debug.extensionState', …) before invoking the diagnostic command to prevent intermittent “command not found” failures.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment thread test/smoke/extensions/vscode-smoketest-ext-host/extension.js
Comment thread test/smoke/extensions/vscode-smoketest-ext-host/extension.js
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.

3 participants