Repository navigation
smoke: wait for smoketest.openLocalChat to finish before using the Chat view - #350133
Merged
Ladislau Szomoru (lszomoru) merged 1 commit intoNov 24, 2026
Merged
Ladislau Szomoru (lszomoru) merged 1 commit into
Ladislau Szomoru (lszomoru) merged 1 commit into
Conversation
…at view In a fresh window, `smoketest.openLocalChat` can run seconds after the command palette closes: the extension host activates the smoke test extension on that command only once it has activated the eager extensions. Meanwhile the Chat view binds its own startup session, which is a local chat when the Agent Host is not available yet. When the test read the view before that binding, `waitForNewLocalChatViewSession` accepted the startup session, the prompt went to it, and the late New Local Chat then moved it to the sessions list, so its reply never showed in the view. The command now writes a marker file once New Local Chat has finished, and the new `openLocalChatInChatView` helper waits for it before checking the view's session. All four callers of the command use the helper. 🤖 Authored with GitHub Copilot on behalf of @lszomoru. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the smoke-test synchronization change.
No open issues 🎉
What changed in this PR
Fixes a smoke-test race where prompts could reach the Chat view’s startup session before smoketest.openLocalChat finished. The change strengthens test synchronization without changing product behavior.
Changes:
- Signals completion with a temporary marker file after New Local Chat resolves.
- Adds a shared helper that waits for command completion and verifies a new local session, then adopts it in four smoke-test suites.
- Clarifies that the existing session-binding wait alone cannot identify which command opened a session.
| File | Description |
|---|---|
test/smoke/src/utils.ts |
Adds the shared command-completion and session-verification helper. |
test/smoke/src/areas/chat/chatSessions.test.ts |
Uses the helper when opening local chats in the view. |
test/smoke/src/areas/chat/chatSandbox.test.ts |
Waits for command completion before chat warm-up. |
test/smoke/src/areas/chat/chatModelConfig.test.ts |
Uses the helper before model-configuration warm-up. |
test/smoke/src/areas/browserView/browserView.test.ts |
Uses the helper before sending browser-sharing prompts. |
test/smoke/extensions/vscode-smoketest-ext-host/extension.js |
Writes the completion marker after New Local Chat resolves. |
test/automation/src/chat.ts |
Updates documentation to explain the session wait’s limitations; no behavior change. |
Review effort: Balanced
Ladislau Szomoru (lszomoru)
marked this pull request as ready for review
November 24, 2026 12:47
Ladislau Szomoru (lszomoru)
enabled auto-merge
November 24, 2026 12:47
Federico Brancasi (federicobrancasi)
approved these changes
Nov 24, 2026
Sandeep Somavarapu (sandy081)
approved these changes
Nov 24, 2026
Ladislau Szomoru (lszomoru)
deleted the
lszomoru/agents/fix-flaky-electron-chat-test
branch
November 24, 2026 13:13
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.
TL;DR:
Chat Sessions › Test Local sessioncould send its prompt to the Chat view's own startup session beforesmoketest.openLocalChathad run. That session is a local chat when the Agent Host is not available yet. When the command ran a few seconds later, New Local Chat opened a new chat and moved the running one to the sessions list, so the reply never showed in the view. The command now signals when it has finished, and the tests wait for that signal.CI failure
Linux / Electron-Smoke (shard 2/3)on SCM: count badge "all" sums all repositories, not only the selected ones #350088, which doesn't touch this area and only hit the flake: https://github.com/microsoft/vscode/actions/runs/45386201124/job/138417882845Error: Timed out waiting for response matching MOCKED_CHAT_SESSIONS_LOCAL_RESPONSE in 'div[id="workbench.panel.chat"] .interactive-item-container.interactive-response .rendered-markdown'Root cause
From the failing job's logs, Playwright trace and screencast (UTC):
[driver] Workbench contributions created, and the test startspreviousSessionResourceisundefinedChatViewPane.acquireDefaultNewSessionfalls back to a local chat:vscode-chat-session://local/YWUz…smoketest.openLocalChatfrom the command palette, which closes right awaywaitForNewLocalChatViewSession(undefined)seeslocal/YWUz…and returnsactivationEvent: 'onCommand:smoketest.openLocalChat'). Until then it was still activating the eager extensionspanel/editAgentsucceeds) in the background chatThe view works as designed: New Local Chat opens a new chat and leaves a running one in the sessions list. The test raced its own command.
A passing shard 2 run from the same day (https://github.com/microsoft/vscode/actions/runs/45387330297) shows the same late activation. There, the view's startup session was an Agent Host Copilot session (
agent-host-copilotcli:/untitled-…), which the wait skips, so the test waited for the command's local chat. The flake needs both conditions: a local startup session because the Agent Host is not available yet, and the test reading the view before that session is bound.Earlier fixes narrowed the same race:
data-bound-chat-resourceand waited for the view's session to change.Neither can tell the command's local chat from a local startup session.
Fix
smoketest.openLocalChatwrites a marker file toos.tmpdir()onceworkbench.action.chat.newLocalChathas resolved. That action awaitsChatViewPane.startNewLocalSession(), so the view is bound to the new chat by then. The same extension already signals the extension host restart tests through files inos.tmpdir().openLocalChatInChatView(app)helper intest/smoke/src/utils.tsremoves the marker, runs the command, and waits for the marker. It then checks that the view shows a new local chat.Chat.waitForNewLocalChatViewSessionnow says that the wait alone does not identify which command bound the session.There is no product change, since the switch is the expected New Local Chat behavior.
Validation
To reproduce the CI ordering deterministically on macOS arm64 (from source), I made these temporary edits, which are not part of this PR:
smoketest.openLocalChatby 8s before New Local Chat.chat.defaultToCopilotHarness: falseandchat.editor.preferCopilotHarness: false, so the view's startup session is local.REPRO_BASELINE=1switch that selects the previousopenSession.With those edits:
REPRO_BASELINE=1 pnpm run smoketest-no-compile -g 'Chat Sessions Test Local session$' --tracing(previous wait): failed with the CI error. The failure screenshot matches CI: the sessions list with the session, and an empty new chat input.pnpm run smoketest-no-compile -g 'Chat Sessions Test Local session$' --tracing(this PR): passed. The test waited for the delayed command, then got the reply.Without the repro edits:
pnpm run smoketest -g "Chat Sessions" --tracing, 4 runs: passed every time (3 passing: Local, Local run in terminal, Agent Host Copilot).pnpm run smoketest-no-compile -g "Chat Sandbox|Chat Model Configuration|allows agents to use shared pages" --tracing: passed (10 passing).cd test/smoke && pnpm run compile(tsc fortest/automationandtest/smoke): passed.pnpm run oxlinton the 7 changed files: passed. Pre-commit hygiene: passed.pnpm run typecheck-client, because nothing undersrc/changed.