Skip to content

smoke: fix flaky Agents Window Copilot CLI session activation - #322170

Merged
Alexandru Dima (alexdima) merged 1 commit into
mainfrom
agents/investigate-vscode-action-failure-18636af6
Jun 19, 2026
Merged

Alexandru Dima (alexdima) merged 1 commit into
mainfrom
agents/investigate-vscode-action-failure-18636af6

Conversation

@alexdima

@alexdima Alexandru Dima (alexdima) commented Jun 19, 2026 •

Copy link
Copy Markdown
Member

Problem

The Agents Window › Test Copilot CLI session smoke test flakily times out at AgentsWindow.activateSessionByLabel:

Error: Timed out waiting for a settled session list row containing "MOCKED_COPILOT_RESPONSE" (without "Working..."). Last-seen rows:
  [0] "vscode-smoketest-express"
  [1] "hello world [scenario:smoke-hello-copilot]now"
  ...

Seen in run 27843789541 on Linux, while macOS Electron (Smoke) passed in the same run — i.e. a timing-sensitive flake, not a hard break.

Root cause

activateSessionByLabel located the just-completed session row by its title, expecting it to equal the mocked reply MOCKED_COPILOT_RESPONSE. The session title is generated asynchronously by a utility model after the first turn and races the untitled→committed session swap, so the row title is non-deterministically either:

  • the user's prompt — hello world [scenario:smoke-hello-copilot] — the synchronous fallback (title-gen hasn't landed, or
  • the generated reply — (in the mock, the title prompt embeds the tagged user message so the mock echoes the scenario reply).

The test matched only the reply, so it timed out whenever generation hadn't landed (Linux), even though the response bubble rendered fine.

See screenshot from stuck smoke test run:
image

Fix

Decouple row identification from response verification in the automation helper:

  • now accepts one or several row substrings and matches a row containing any of them; is verified separately against the active session's response bubble.
  • gains an optional forwarded to re-activation.
  • The smoke test passes both the first prompt and the reply, so activation is deterministic regardless of when title generation completes. The actual assertion (response bubble contains the reply) is unchanged.

Notes

The "Agents Window > Test Copilot CLI session" smoke test flakily timed
out at `activateSessionByLabel`, which located the just-completed session
row by its title and expected it to equal the mocked reply
`MOCKED_COPILOT_RESPONSE`. That title is set asynchronously by a utility
model after the first turn and races the untitled->committed session
swap, so it is non-deterministically either the user's prompt (the
synchronous fallback) or the generated reply. The test passed on macOS
(title-gen landed) and failed on Linux (it didn't) in the same run.

Decouple row identification from response verification:
`activateSessionByLabel` now accepts one or several row substrings and
matches a row containing ANY of them, while a separate `responseLabel`
is verified against the active session's response bubble. The smoke test
passes both the first prompt and the reply, so activation is
deterministic regardless of when title generation completes.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings June 19, 2026 22: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 Agents Window smoke automation against a timing race where the Copilot CLI session’s sidebar title can be either the first prompt (sync fallback) or the asynchronously generated title (mock reply), causing flaky timeouts when re-activating the just-completed session.

Changes:

  • Update the smoke test to identify the Copilot CLI session row using either the first prompt or the mocked reply, while still verifying the reply in the active session view.
  • Extend AgentsWindow.activateSessionByLabel to accept one-or-many row match substrings and to verify the active session’s response bubble via a separate responseLabel.
  • Extend sendFollowUpMessage with an optional activeRowMatch to make its re-activation retry path robust to the same async title update.
Show a summary per file
File Description
test/smoke/src/areas/agentsWindow/agentsWindow.test.ts Passes both prompt + reply for deterministic Copilot CLI session activation, while keeping the reply assertion unchanged.
test/automation/src/agentsWindow.ts Generalizes session-row matching for activation and threads the new matching through follow-up retry logic.

Copilot's findings

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

@alexdima
Alexandru Dima (alexdima) merged commit 16c0598 into main Jun 19, 2026
63 of 65 checks passed
@alexdima
Alexandru Dima (alexdima) deleted the agents/investigate-vscode-action-failure-18636af6 branch June 19, 2026 23:15
@vs-code-engineering vs-code-engineering Bot added this to the 1.126.0 milestone Jun 19, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Aug 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants