Repository navigation
Wait for e2e-worker's endpoint URL before capturing it in the tree-actions E2E - #21914
Conversation
The spec captured e2e-worker from the first Running snapshot and later read its endpoint URL from that same object. DCP activates the endpoint shortly after the resource reaches Running, and the backchannel omits inactive URLs, so that first snapshot can have no URLs. Wait for the Running snapshot that carries the HTTP URL instead. Fixes #21796 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21914Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21914" |
Tests selector0 / 101 PR test projects · 2 PR jobs, from 1 changed file. Selected PR test projects (0 / 101)none — no PR-gated .NET test projects run for this change. Selected PR jobs (2)
How these were chosen — grouped by what changedJob reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the test-only change to wait for endpoint availability before retaining the resource snapshot.
No open issues 🎉
What changed in this PR
Fixes the VS Code tree-actions E2E stale-snapshot race tracked in #21796 by waiting for e2e-worker to expose an HTTP endpoint before retaining its resource snapshot. This is a test-only change; extension behavior and the endpoint assertion remain unchanged.
Changes:
- Uses the existing
waitForRunningResourceWithUrlhelper instead of waiting only forRunning, preserving the 180-second timeout. - Adds a comment explaining why resource state alone does not guarantee endpoint availability.
| File | Description |
|---|---|
extension/src/test-e2e/treeActions.e2e.test.ts |
Imports and uses the URL-aware readiness helper, with a comment explaining the timing race. |
Review effort: Balanced
|
[automated] Blocked before reproduction dispatch; efficacy remains inconclusive. The native Evidence checkedThe exact target is
These are two selected historical failure examples and two existing CI passes, not a paired reproduction cohort or an estimated failure rate. Source, workload, and review
Limits and dispositionExecution: no campaign was admitted or dispatched; planned/provisioned/completed/valid campaign opportunities are all 0. Historical logs confirm natural occurrences, but there is no newly reproduced natural baseline. Existing fixed-source logs are favorable descriptive observations only. Raw logs, API metadata, and the fixed-run artifact manifest were inspected. Diagnostic ZIPs/result files were not reconciled; exact test-host CLR and the author's injected-delay/local-run claims were not independently established. Historical timing and sources differ, and no confirmatory sample or method was admitted. The reusable |
|
✅ No documentation update needed. docs_optional → test_only (proven false positive). Triggered signal: |
…n empty file (#21932) **What failed:** `[vscode] Aspire WinUI debug E2E > debugs an unpackaged WinUI project through its generated apphost executable` failed on attempt 1 in [42448442647](https://github.com/microsoft/aspire/actions/runs/42448442647/job/128635064936) (tracker #21600, unowned rank 1): ``` AssertionError [ERR_ASSERTION]: The input did not match the regular expression /^ready:\d+$/. Input: '' ``` **Why:** The generated WinUI fixture app wrote its ready marker with `File.WriteAllText(readyFile, …)`. That call creates the file before it writes the content. `waitForReadyMarker` polls for the file and returns its first successful read, so a poll that landed in that gap returned `''` and failed the assertion. The app had started correctly; the test read the file before the content was written. **How fixed:** The fixture app (`extension/scripts/run-e2e.js`) now writes `ready:<pid>` to `<marker>.tmp` and then `File.Move(…, overwrite: true)` renames it into place. Because the rename is atomic, the marker path is either missing or holds the full content, so the test's first read is always complete. The assertion, timeouts and polling are unchanged. The existing `e2eLaunchProfile` unit test now checks for the atomic write and rejects a direct `File.WriteAllText(readyFile, …)`. ## Failure stats (14d, attempt 1) | Scope | Attempt-1 test failures / runs where the job executed | Rate | Passed on rerun | |---|---|---|---| | PR | 4 / 457 | 0.9% | 4 / 4 | | main | 0 / 99 | 0% | n/a | Main over 30 days: 0 test-level failures in 216 runs (0 / 99 in the last 14d plus 0 / 117 in the 16 days before). This job had 9 other attempt-1 failures that never reached the test and are excluded: 8 were "hosted runner lost communication" and 1 was an `aspire-extension` artifact download failure. Test-level failures (all four): - [42448442647](https://github.com/microsoft/aspire/actions/runs/42448442647/job/128635064936) (PR #21921, unrelated Java debug change): `The input did not match the regular expression /^ready:\d+$/. Input: ''` ← **fixed by this PR** - [42257446455](https://github.com/microsoft/aspire/actions/runs/42257446455/job/128037952447) (PR branch `aspireagent/fix-e2e-notification-dismiss-hover-race`): `Timed out after 120000ms waiting for the C# language server to resolve generated InitializeComponent … Last definitions: []` (the `tree-actions` shard also failed in the same attempt) - [41532732531](https://github.com/microsoft/aspire/actions/runs/41532732531/job/125585902027) (PR #20950): `Timed out after 240000ms waiting for the WinUI OnLaunched marker.` AppHost hosting startup took 1m42s, and 4 other Windows shards failed in the same attempt. - [41501727353](https://github.com/microsoft/aspire/actions/runs/41501727353/job/125481870825) (PR #21183): `The C# definition probe for InitializeComponent … Timed out after 129ms waiting for E2E control revision`. `dotnet --list-runtimes` took 53s, Roslyn never started, and 6 other shards failed in the same attempt. All four are genuine flakes, not caused by their PRs. The last three come from whole-runner slowness on Windows, which is tracked in #21570 with telemetry in #21644. This PR does not address them because fixing them would mean raising timeouts. **Local regression evidence:** A harness ran the fixture's exact before/after C# writer against a Node reader that uses `waitForReadyMarker`'s semantics (first successful read is asserted against `/^ready:\d+$/`), polling tightly, with 500 marker publications per run: - Before (`File.WriteAllText(readyFile, …)`): **10/10 runs** saw an empty marker (475–496 torn first reads out of about 500 per run). - After (write `.tmp`, then `File.Move` with `overwrite: true`): **0/10 runs** saw an empty marker (0 torn reads out of about 4,980 publications). The harness ran on Linux. On Windows, `File.Move(overwrite: true)` maps to `MoveFileEx(MOVEFILE_REPLACE_EXISTING)` within the same directory, which is also atomic for readers. **PR CI** ([run 42472017876](https://github.com/microsoft/aspire/actions/runs/42472017876)): `VS Code extension E2E (Windows, winui-debug)` and the Windows extension unit tests (including the updated `e2eLaunchProfile` test) passed on attempt 1. Three unrelated jobs failed on attempt 1: a GitHub 'Unicorn' outage while downloading Deno in `launch-profiles`, and the known `tree-actions` flakes (`Expected e2e-worker to expose an endpoint URL`, addressed by #21914; `Timed out … waiting for running AppHost` on Linux). After reruns, all 70 checks pass. **Verdict: MODERATE.** The fixed race is proven deterministically (10/10 → 0/10) and matches the newest failure's exact signature. However, it accounts for only 1 of the 4 attempt-1 test failures in 14d. The other 3 belong to the Windows runner-slowness family in #21570. ## Confidence High that this removes the empty-marker failure mode: the gap is inherent to `File.WriteAllText` and the reader returns on its first read. Low that it changes the C# language server / OnLaunched timeout failures, which this PR does not target. **How we stop this recurring:** Fixture processes that publish readiness files for E2E polling should write a temp file and rename it into place. The unit test now enforces this for the WinUI marker. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tions E2E (#21914) ## Description The Linux and Windows `tree-actions` VS Code E2E shard fails with `AssertionError: Expected e2e-worker to expose an endpoint URL.` in *routes view, copy, endpoint, log, and resource commands through tree handlers*. It is the most frequent flake since #21624. Examples: [run 41946839177 / job 126989027692](https://github.com/microsoft/aspire/actions/runs/41946839177/job/126989027692) (Linux), [run 41967348150 / job 127053704182](https://github.com/microsoft/aspire/actions/runs/41967348150/job/127053704182) (Windows, main), [run 41980257054 / job 127096573746](https://github.com/microsoft/aspire/actions/runs/41980257054/job/127096573746) (Windows). #21796 lists more. ## Failure stats (14d, attempt 1) `CI` workflow on microsoft/aspire, runs created 2026-10-25 06:28 → 2026-11-08 06:28 UTC, **attempt 1 only**. Denominator: attempt-1 jobs that ran (success or failure). Hits: the failed job's log matches the signature. Jobs that lost their runner, which have no log, are excluded. Main runs have no reruns, so their flake check is the next main run of the job. | | | |---|---| | Signature | `Expected e2e-worker to expose an endpoint URL.` | | Job | VS Code extension E2E (Linux + Windows, tree-actions) | | main pushes: hits / runs | 8 / 306 (2.61%) | | main pushes, 30d: hits / runs | 8 / 530 (1.51%). The 16 days before the 14d window add 0 hits. | | PR runs: hits / runs | 28 / 1605 (1.74%); 0 PR-caused excluded | | Combined rate | 36 / 1911 = **1.88%** | | Flake check | main: next main run of the job passed 8/8; PR: 24/25 rerun hits passed on rerun (3 never rerun) | | First / last hit | 2026-11-05 / 2026-11-08 | | Still hitting main? | Yes, still active: last hit 2026-11-08; last main hit 2026-11-07 | | Fix evidence | Local real E2E: injected 5s delay 3/3 fail → 3/3 pass; natural run 1/1 pass. This PR's CI: tree-actions Linux and Windows passed 1/1 each. | Failing attempt-1 jobs, most recent first (10 of 34 log-verified hits): | Date (UTC) | Branch | Job | Signature excerpt | |---|---|---|---| | [2026-11-08 06:06](https://github.com/microsoft/aspire/actions/runs/42453400853/job/128650958075) | `aspireagent/vscode-bridge-scoped-fake-timers` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-08 05:17](https://github.com/microsoft/aspire/actions/runs/42450180289/job/128641295561) | `darc-main-252ee2c2-deac-4980-a34a-b797f49158de` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-08 04:40](https://github.com/microsoft/aspire/actions/runs/42447773687/job/128633232882) | `aspireagent/doctor-cancel-dcp-cleanup` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-08 04:32](https://github.com/microsoft/aspire/actions/runs/42447210418/job/128631545572) | `aspireagent/resource-attach-proof-resume-aborted-inspection` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-07 21:02](https://github.com/microsoft/aspire/actions/runs/42413947055/job/128538664400) | **main** | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-07 03:55](https://github.com/microsoft/aspire/actions/runs/42336149573/job/128297445902) | `sebros/resources-compact-view-regression-4abee4` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 23:20](https://github.com/microsoft/aspire/actions/runs/42311290959/job/128230943448) | **main** | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 22:50](https://github.com/microsoft/aspire/actions/runs/42307718588/job/128210216707) | `ellahathaway-stop-idle-extension-polling` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 20:25](https://github.com/microsoft/aspire/actions/runs/42288258477/job/128147538335) | **main** | VS Code extension E2E (Linux, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 20:20](https://github.com/microsoft/aspire/actions/runs/42287581178/job/128143472756) | `ellahathaway-clarify-agent-init-output` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | A strict re-scan of the job logs confirmed 34 of the 36 hits counted above; the table lists only confirmed hits. The rates above use the original count. **Verdict: STRONG.** The most frequent signature here: 36 hits since 2026-11-05 (8 on main), still hitting today. 24 of the 25 PR hits that were rerun passed on rerun, and all 8 main hits passed on the next main run. The real-E2E before/after repro shows the exact CI assertion. The PR's own CI is 1 run per OS. That is not statistical proof on its own: at a 1.9% rate, ~160 clean runs are needed for 95% confidence. <!-- /failure-stats --> **Why:** the spec captures `e2e-worker` from the first snapshot where it is `Running` and later reads its endpoint URL from that same object. DCP activates the worker's endpoint shortly after the resource reaches `Running`, and the backchannel omits inactive URLs, so the first `Running` snapshot can have `urls: []`. The URL-bearing snapshot arrives a few milliseconds later, but the spec never re-reads it. Since #21624, the worker reaches `Running` after the extension's `describe --follow` attaches, so this URL-less snapshot is now visible to the spec. **Fix:** wait with the existing `waitForRunningResourceWithUrl('e2e-worker', 'http:', 180000)` helper (already used by the Azure Functions spec) instead of `waitForResourceState('e2e-worker', ['Running'])`. This is a test-only change, and the endpoint assertion is unchanged. Fixes #21796 ## Confidence - **Real E2E, paired before/after (Linux, xvfb, real VS Code 1.130.0, CLI/DCP/VSIX/NuGets from main CI run 42413947055):** a local-only CLI wrapper delays the first URL-bearing `Running` `e2e-worker` line from `describe --follow` by 5s. The 5s delay is well above the 200ms state poll interval, so the URL-less snapshot is always observed. - Before (spec on `origin/main`): **3/3 failed** (6 passing, 1 failing), each with the exact CI assertion. - After (this PR): **3/3 passed** (7/7). - **Natural (no injection) run with the fix:** 1/1 passed (7/7). Locally, the URL-bearing `Running` snapshot followed the URL-less one by 2ms. - **Other checks:** eslint on the spec, `tsc` for both `tsconfig.e2e.json` and the unit project, and `e2eResourceReadiness.test.ts` (9/9, run with mocha directly) all pass. - **Not run locally:** the Windows `tree-actions` shard, other E2E shards, and `vscode-test`-hosted unit tests (the VS Code download host is blocked in my environment). CI covers these. **How we stop this recurring:** E2E specs that read resource URLs should wait on `waitForRunningResourceWithUrl` instead of a state-only `Running` gate, because state and URL activation arrive as separate snapshots. Related: #21854 made the same change but was closed without being merged. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes (the change is to an E2E scenario test; the helper it uses already has unit coverage) - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 37d2680)
…tions E2E (#21914) ## Description The Linux and Windows `tree-actions` VS Code E2E shard fails with `AssertionError: Expected e2e-worker to expose an endpoint URL.` in *routes view, copy, endpoint, log, and resource commands through tree handlers*. It is the most frequent flake since #21624. Examples: [run 41946839177 / job 126989027692](https://github.com/microsoft/aspire/actions/runs/41946839177/job/126989027692) (Linux), [run 41967348150 / job 127053704182](https://github.com/microsoft/aspire/actions/runs/41967348150/job/127053704182) (Windows, main), [run 41980257054 / job 127096573746](https://github.com/microsoft/aspire/actions/runs/41980257054/job/127096573746) (Windows). #21796 lists more. ## Failure stats (14d, attempt 1) `CI` workflow on microsoft/aspire, runs created 2026-10-25 06:28 → 2026-11-08 06:28 UTC, **attempt 1 only**. Denominator: attempt-1 jobs that ran (success or failure). Hits: the failed job's log matches the signature. Jobs that lost their runner, which have no log, are excluded. Main runs have no reruns, so their flake check is the next main run of the job. | | | |---|---| | Signature | `Expected e2e-worker to expose an endpoint URL.` | | Job | VS Code extension E2E (Linux + Windows, tree-actions) | | main pushes: hits / runs | 8 / 306 (2.61%) | | main pushes, 30d: hits / runs | 8 / 530 (1.51%). The 16 days before the 14d window add 0 hits. | | PR runs: hits / runs | 28 / 1605 (1.74%); 0 PR-caused excluded | | Combined rate | 36 / 1911 = **1.88%** | | Flake check | main: next main run of the job passed 8/8; PR: 24/25 rerun hits passed on rerun (3 never rerun) | | First / last hit | 2026-11-05 / 2026-11-08 | | Still hitting main? | Yes, still active: last hit 2026-11-08; last main hit 2026-11-07 | | Fix evidence | Local real E2E: injected 5s delay 3/3 fail → 3/3 pass; natural run 1/1 pass. This PR's CI: tree-actions Linux and Windows passed 1/1 each. | Failing attempt-1 jobs, most recent first (10 of 34 log-verified hits): | Date (UTC) | Branch | Job | Signature excerpt | |---|---|---|---| | [2026-11-08 06:06](https://github.com/microsoft/aspire/actions/runs/42453400853/job/128650958075) | `aspireagent/vscode-bridge-scoped-fake-timers` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-08 05:17](https://github.com/microsoft/aspire/actions/runs/42450180289/job/128641295561) | `darc-main-252ee2c2-deac-4980-a34a-b797f49158de` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-08 04:40](https://github.com/microsoft/aspire/actions/runs/42447773687/job/128633232882) | `aspireagent/doctor-cancel-dcp-cleanup` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-08 04:32](https://github.com/microsoft/aspire/actions/runs/42447210418/job/128631545572) | `aspireagent/resource-attach-proof-resume-aborted-inspection` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-07 21:02](https://github.com/microsoft/aspire/actions/runs/42413947055/job/128538664400) | **main** | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-07 03:55](https://github.com/microsoft/aspire/actions/runs/42336149573/job/128297445902) | `sebros/resources-compact-view-regression-4abee4` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 23:20](https://github.com/microsoft/aspire/actions/runs/42311290959/job/128230943448) | **main** | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 22:50](https://github.com/microsoft/aspire/actions/runs/42307718588/job/128210216707) | `ellahathaway-stop-idle-extension-polling` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 20:25](https://github.com/microsoft/aspire/actions/runs/42288258477/job/128147538335) | **main** | VS Code extension E2E (Linux, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 20:20](https://github.com/microsoft/aspire/actions/runs/42287581178/job/128143472756) | `ellahathaway-clarify-agent-init-output` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | A strict re-scan of the job logs confirmed 34 of the 36 hits counted above; the table lists only confirmed hits. The rates above use the original count. **Verdict: STRONG.** The most frequent signature here: 36 hits since 2026-11-05 (8 on main), still hitting today. 24 of the 25 PR hits that were rerun passed on rerun, and all 8 main hits passed on the next main run. The real-E2E before/after repro shows the exact CI assertion. The PR's own CI is 1 run per OS. That is not statistical proof on its own: at a 1.9% rate, ~160 clean runs are needed for 95% confidence. <!-- /failure-stats --> **Why:** the spec captures `e2e-worker` from the first snapshot where it is `Running` and later reads its endpoint URL from that same object. DCP activates the worker's endpoint shortly after the resource reaches `Running`, and the backchannel omits inactive URLs, so the first `Running` snapshot can have `urls: []`. The URL-bearing snapshot arrives a few milliseconds later, but the spec never re-reads it. Since #21624, the worker reaches `Running` after the extension's `describe --follow` attaches, so this URL-less snapshot is now visible to the spec. **Fix:** wait with the existing `waitForRunningResourceWithUrl('e2e-worker', 'http:', 180000)` helper (already used by the Azure Functions spec) instead of `waitForResourceState('e2e-worker', ['Running'])`. This is a test-only change, and the endpoint assertion is unchanged. Fixes #21796 ## Confidence - **Real E2E, paired before/after (Linux, xvfb, real VS Code 1.130.0, CLI/DCP/VSIX/NuGets from main CI run 42413947055):** a local-only CLI wrapper delays the first URL-bearing `Running` `e2e-worker` line from `describe --follow` by 5s. The 5s delay is well above the 200ms state poll interval, so the URL-less snapshot is always observed. - Before (spec on `origin/main`): **3/3 failed** (6 passing, 1 failing), each with the exact CI assertion. - After (this PR): **3/3 passed** (7/7). - **Natural (no injection) run with the fix:** 1/1 passed (7/7). Locally, the URL-bearing `Running` snapshot followed the URL-less one by 2ms. - **Other checks:** eslint on the spec, `tsc` for both `tsconfig.e2e.json` and the unit project, and `e2eResourceReadiness.test.ts` (9/9, run with mocha directly) all pass. - **Not run locally:** the Windows `tree-actions` shard, other E2E shards, and `vscode-test`-hosted unit tests (the VS Code download host is blocked in my environment). CI covers these. **How we stop this recurring:** E2E specs that read resource URLs should wait on `waitForRunningResourceWithUrl` instead of a state-only `Running` gate, because state and URL activation arrive as separate snapshots. Related: #21854 made the same change but was closed without being merged. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes (the change is to an E2E scenario test; the helper it uses already has unit coverage) - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 37d2680)
…n empty file (#21932) **What failed:** `[vscode] Aspire WinUI debug E2E > debugs an unpackaged WinUI project through its generated apphost executable` failed on attempt 1 in [42448442647](https://github.com/microsoft/aspire/actions/runs/42448442647/job/128635064936) (tracker #21600, unowned rank 1): ``` AssertionError [ERR_ASSERTION]: The input did not match the regular expression /^ready:\d+$/. Input: '' ``` **Why:** The generated WinUI fixture app wrote its ready marker with `File.WriteAllText(readyFile, …)`. That call creates the file before it writes the content. `waitForReadyMarker` polls for the file and returns its first successful read, so a poll that landed in that gap returned `''` and failed the assertion. The app had started correctly; the test read the file before the content was written. **How fixed:** The fixture app (`extension/scripts/run-e2e.js`) now writes `ready:<pid>` to `<marker>.tmp` and then `File.Move(…, overwrite: true)` renames it into place. Because the rename is atomic, the marker path is either missing or holds the full content, so the test's first read is always complete. The assertion, timeouts and polling are unchanged. The existing `e2eLaunchProfile` unit test now checks for the atomic write and rejects a direct `File.WriteAllText(readyFile, …)`. ## Failure stats (14d, attempt 1) | Scope | Attempt-1 test failures / runs where the job executed | Rate | Passed on rerun | |---|---|---|---| | PR | 4 / 457 | 0.9% | 4 / 4 | | main | 0 / 99 | 0% | n/a | Main over 30 days: 0 test-level failures in 216 runs (0 / 99 in the last 14d plus 0 / 117 in the 16 days before). This job had 9 other attempt-1 failures that never reached the test and are excluded: 8 were "hosted runner lost communication" and 1 was an `aspire-extension` artifact download failure. Test-level failures (all four): - [42448442647](https://github.com/microsoft/aspire/actions/runs/42448442647/job/128635064936) (PR #21921, unrelated Java debug change): `The input did not match the regular expression /^ready:\d+$/. Input: ''` ← **fixed by this PR** - [42257446455](https://github.com/microsoft/aspire/actions/runs/42257446455/job/128037952447) (PR branch `aspireagent/fix-e2e-notification-dismiss-hover-race`): `Timed out after 120000ms waiting for the C# language server to resolve generated InitializeComponent … Last definitions: []` (the `tree-actions` shard also failed in the same attempt) - [41532732531](https://github.com/microsoft/aspire/actions/runs/41532732531/job/125585902027) (PR #20950): `Timed out after 240000ms waiting for the WinUI OnLaunched marker.` AppHost hosting startup took 1m42s, and 4 other Windows shards failed in the same attempt. - [41501727353](https://github.com/microsoft/aspire/actions/runs/41501727353/job/125481870825) (PR #21183): `The C# definition probe for InitializeComponent … Timed out after 129ms waiting for E2E control revision`. `dotnet --list-runtimes` took 53s, Roslyn never started, and 6 other shards failed in the same attempt. All four are genuine flakes, not caused by their PRs. The last three come from whole-runner slowness on Windows, which is tracked in #21570 with telemetry in #21644. This PR does not address them because fixing them would mean raising timeouts. **Local regression evidence:** A harness ran the fixture's exact before/after C# writer against a Node reader that uses `waitForReadyMarker`'s semantics (first successful read is asserted against `/^ready:\d+$/`), polling tightly, with 500 marker publications per run: - Before (`File.WriteAllText(readyFile, …)`): **10/10 runs** saw an empty marker (475–496 torn first reads out of about 500 per run). - After (write `.tmp`, then `File.Move` with `overwrite: true`): **0/10 runs** saw an empty marker (0 torn reads out of about 4,980 publications). The harness ran on Linux. On Windows, `File.Move(overwrite: true)` maps to `MoveFileEx(MOVEFILE_REPLACE_EXISTING)` within the same directory, which is also atomic for readers. **PR CI** ([run 42472017876](https://github.com/microsoft/aspire/actions/runs/42472017876)): `VS Code extension E2E (Windows, winui-debug)` and the Windows extension unit tests (including the updated `e2eLaunchProfile` test) passed on attempt 1. Three unrelated jobs failed on attempt 1: a GitHub 'Unicorn' outage while downloading Deno in `launch-profiles`, and the known `tree-actions` flakes (`Expected e2e-worker to expose an endpoint URL`, addressed by #21914; `Timed out … waiting for running AppHost` on Linux). After reruns, all 70 checks pass. **Verdict: MODERATE.** The fixed race is proven deterministically (10/10 → 0/10) and matches the newest failure's exact signature. However, it accounts for only 1 of the 4 attempt-1 test failures in 14d. The other 3 belong to the Windows runner-slowness family in #21570. ## Confidence High that this removes the empty-marker failure mode: the gap is inherent to `File.WriteAllText` and the reader returns on its first read. Low that it changes the C# language server / OnLaunched timeout failures, which this PR does not target. **How we stop this recurring:** Fixture processes that publish readiness files for E2E polling should write a temp file and rename it into place. The unit test now enforces this for the WinUI marker. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 8f00c66)
…tions E2E (#21914) ## Description The Linux and Windows `tree-actions` VS Code E2E shard fails with `AssertionError: Expected e2e-worker to expose an endpoint URL.` in *routes view, copy, endpoint, log, and resource commands through tree handlers*. It is the most frequent flake since #21624. Examples: [run 41946839177 / job 126989027692](https://github.com/microsoft/aspire/actions/runs/41946839177/job/126989027692) (Linux), [run 41967348150 / job 127053704182](https://github.com/microsoft/aspire/actions/runs/41967348150/job/127053704182) (Windows, main), [run 41980257054 / job 127096573746](https://github.com/microsoft/aspire/actions/runs/41980257054/job/127096573746) (Windows). #21796 lists more. ## Failure stats (14d, attempt 1) `CI` workflow on microsoft/aspire, runs created 2026-10-25 06:28 → 2026-11-08 06:28 UTC, **attempt 1 only**. Denominator: attempt-1 jobs that ran (success or failure). Hits: the failed job's log matches the signature. Jobs that lost their runner, which have no log, are excluded. Main runs have no reruns, so their flake check is the next main run of the job. | | | |---|---| | Signature | `Expected e2e-worker to expose an endpoint URL.` | | Job | VS Code extension E2E (Linux + Windows, tree-actions) | | main pushes: hits / runs | 8 / 306 (2.61%) | | main pushes, 30d: hits / runs | 8 / 530 (1.51%). The 16 days before the 14d window add 0 hits. | | PR runs: hits / runs | 28 / 1605 (1.74%); 0 PR-caused excluded | | Combined rate | 36 / 1911 = **1.88%** | | Flake check | main: next main run of the job passed 8/8; PR: 24/25 rerun hits passed on rerun (3 never rerun) | | First / last hit | 2026-11-05 / 2026-11-08 | | Still hitting main? | Yes, still active: last hit 2026-11-08; last main hit 2026-11-07 | | Fix evidence | Local real E2E: injected 5s delay 3/3 fail → 3/3 pass; natural run 1/1 pass. This PR's CI: tree-actions Linux and Windows passed 1/1 each. | Failing attempt-1 jobs, most recent first (10 of 34 log-verified hits): | Date (UTC) | Branch | Job | Signature excerpt | |---|---|---|---| | [2026-11-08 06:06](https://github.com/microsoft/aspire/actions/runs/42453400853/job/128650958075) | `aspireagent/vscode-bridge-scoped-fake-timers` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-08 05:17](https://github.com/microsoft/aspire/actions/runs/42450180289/job/128641295561) | `darc-main-252ee2c2-deac-4980-a34a-b797f49158de` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-08 04:40](https://github.com/microsoft/aspire/actions/runs/42447773687/job/128633232882) | `aspireagent/doctor-cancel-dcp-cleanup` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-08 04:32](https://github.com/microsoft/aspire/actions/runs/42447210418/job/128631545572) | `aspireagent/resource-attach-proof-resume-aborted-inspection` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-07 21:02](https://github.com/microsoft/aspire/actions/runs/42413947055/job/128538664400) | **main** | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-07 03:55](https://github.com/microsoft/aspire/actions/runs/42336149573/job/128297445902) | `sebros/resources-compact-view-regression-4abee4` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 23:20](https://github.com/microsoft/aspire/actions/runs/42311290959/job/128230943448) | **main** | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 22:50](https://github.com/microsoft/aspire/actions/runs/42307718588/job/128210216707) | `ellahathaway-stop-idle-extension-polling` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 20:25](https://github.com/microsoft/aspire/actions/runs/42288258477/job/128147538335) | **main** | VS Code extension E2E (Linux, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | | [2026-11-06 20:20](https://github.com/microsoft/aspire/actions/runs/42287581178/job/128143472756) | `ellahathaway-clarify-agent-init-output` | VS Code extension E2E (Windows, tree-actions) | `Expected e2e-worker to expose an endpoint URL.` | A strict re-scan of the job logs confirmed 34 of the 36 hits counted above; the table lists only confirmed hits. The rates above use the original count. **Verdict: STRONG.** The most frequent signature here: 36 hits since 2026-11-05 (8 on main), still hitting today. 24 of the 25 PR hits that were rerun passed on rerun, and all 8 main hits passed on the next main run. The real-E2E before/after repro shows the exact CI assertion. The PR's own CI is 1 run per OS. That is not statistical proof on its own: at a 1.9% rate, ~160 clean runs are needed for 95% confidence. <!-- /failure-stats --> **Why:** the spec captures `e2e-worker` from the first snapshot where it is `Running` and later reads its endpoint URL from that same object. DCP activates the worker's endpoint shortly after the resource reaches `Running`, and the backchannel omits inactive URLs, so the first `Running` snapshot can have `urls: []`. The URL-bearing snapshot arrives a few milliseconds later, but the spec never re-reads it. Since #21624, the worker reaches `Running` after the extension's `describe --follow` attaches, so this URL-less snapshot is now visible to the spec. **Fix:** wait with the existing `waitForRunningResourceWithUrl('e2e-worker', 'http:', 180000)` helper (already used by the Azure Functions spec) instead of `waitForResourceState('e2e-worker', ['Running'])`. This is a test-only change, and the endpoint assertion is unchanged. Fixes #21796 ## Confidence - **Real E2E, paired before/after (Linux, xvfb, real VS Code 1.130.0, CLI/DCP/VSIX/NuGets from main CI run 42413947055):** a local-only CLI wrapper delays the first URL-bearing `Running` `e2e-worker` line from `describe --follow` by 5s. The 5s delay is well above the 200ms state poll interval, so the URL-less snapshot is always observed. - Before (spec on `origin/main`): **3/3 failed** (6 passing, 1 failing), each with the exact CI assertion. - After (this PR): **3/3 passed** (7/7). - **Natural (no injection) run with the fix:** 1/1 passed (7/7). Locally, the URL-bearing `Running` snapshot followed the URL-less one by 2ms. - **Other checks:** eslint on the spec, `tsc` for both `tsconfig.e2e.json` and the unit project, and `e2eResourceReadiness.test.ts` (9/9, run with mocha directly) all pass. - **Not run locally:** the Windows `tree-actions` shard, other E2E shards, and `vscode-test`-hosted unit tests (the VS Code download host is blocked in my environment). CI covers these. **How we stop this recurring:** E2E specs that read resource URLs should wait on `waitForRunningResourceWithUrl` instead of a state-only `Running` gate, because state and URL activation arrive as separate snapshots. Related: #21854 made the same change but was closed without being merged. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes (the change is to an E2E scenario test; the helper it uses already has unit coverage) - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 37d2680)
…n empty file (#21932) **What failed:** `[vscode] Aspire WinUI debug E2E > debugs an unpackaged WinUI project through its generated apphost executable` failed on attempt 1 in [42448442647](https://github.com/microsoft/aspire/actions/runs/42448442647/job/128635064936) (tracker #21600, unowned rank 1): ``` AssertionError [ERR_ASSERTION]: The input did not match the regular expression /^ready:\d+$/. Input: '' ``` **Why:** The generated WinUI fixture app wrote its ready marker with `File.WriteAllText(readyFile, …)`. That call creates the file before it writes the content. `waitForReadyMarker` polls for the file and returns its first successful read, so a poll that landed in that gap returned `''` and failed the assertion. The app had started correctly; the test read the file before the content was written. **How fixed:** The fixture app (`extension/scripts/run-e2e.js`) now writes `ready:<pid>` to `<marker>.tmp` and then `File.Move(…, overwrite: true)` renames it into place. Because the rename is atomic, the marker path is either missing or holds the full content, so the test's first read is always complete. The assertion, timeouts and polling are unchanged. The existing `e2eLaunchProfile` unit test now checks for the atomic write and rejects a direct `File.WriteAllText(readyFile, …)`. ## Failure stats (14d, attempt 1) | Scope | Attempt-1 test failures / runs where the job executed | Rate | Passed on rerun | |---|---|---|---| | PR | 4 / 457 | 0.9% | 4 / 4 | | main | 0 / 99 | 0% | n/a | Main over 30 days: 0 test-level failures in 216 runs (0 / 99 in the last 14d plus 0 / 117 in the 16 days before). This job had 9 other attempt-1 failures that never reached the test and are excluded: 8 were "hosted runner lost communication" and 1 was an `aspire-extension` artifact download failure. Test-level failures (all four): - [42448442647](https://github.com/microsoft/aspire/actions/runs/42448442647/job/128635064936) (PR #21921, unrelated Java debug change): `The input did not match the regular expression /^ready:\d+$/. Input: ''` ← **fixed by this PR** - [42257446455](https://github.com/microsoft/aspire/actions/runs/42257446455/job/128037952447) (PR branch `aspireagent/fix-e2e-notification-dismiss-hover-race`): `Timed out after 120000ms waiting for the C# language server to resolve generated InitializeComponent … Last definitions: []` (the `tree-actions` shard also failed in the same attempt) - [41532732531](https://github.com/microsoft/aspire/actions/runs/41532732531/job/125585902027) (PR #20950): `Timed out after 240000ms waiting for the WinUI OnLaunched marker.` AppHost hosting startup took 1m42s, and 4 other Windows shards failed in the same attempt. - [41501727353](https://github.com/microsoft/aspire/actions/runs/41501727353/job/125481870825) (PR #21183): `The C# definition probe for InitializeComponent … Timed out after 129ms waiting for E2E control revision`. `dotnet --list-runtimes` took 53s, Roslyn never started, and 6 other shards failed in the same attempt. All four are genuine flakes, not caused by their PRs. The last three come from whole-runner slowness on Windows, which is tracked in #21570 with telemetry in #21644. This PR does not address them because fixing them would mean raising timeouts. **Local regression evidence:** A harness ran the fixture's exact before/after C# writer against a Node reader that uses `waitForReadyMarker`'s semantics (first successful read is asserted against `/^ready:\d+$/`), polling tightly, with 500 marker publications per run: - Before (`File.WriteAllText(readyFile, …)`): **10/10 runs** saw an empty marker (475–496 torn first reads out of about 500 per run). - After (write `.tmp`, then `File.Move` with `overwrite: true`): **0/10 runs** saw an empty marker (0 torn reads out of about 4,980 publications). The harness ran on Linux. On Windows, `File.Move(overwrite: true)` maps to `MoveFileEx(MOVEFILE_REPLACE_EXISTING)` within the same directory, which is also atomic for readers. **PR CI** ([run 42472017876](https://github.com/microsoft/aspire/actions/runs/42472017876)): `VS Code extension E2E (Windows, winui-debug)` and the Windows extension unit tests (including the updated `e2eLaunchProfile` test) passed on attempt 1. Three unrelated jobs failed on attempt 1: a GitHub 'Unicorn' outage while downloading Deno in `launch-profiles`, and the known `tree-actions` flakes (`Expected e2e-worker to expose an endpoint URL`, addressed by #21914; `Timed out … waiting for running AppHost` on Linux). After reruns, all 70 checks pass. **Verdict: MODERATE.** The fixed race is proven deterministically (10/10 → 0/10) and matches the newest failure's exact signature. However, it accounts for only 1 of the 4 attempt-1 test failures in 14d. The other 3 belong to the Windows runner-slowness family in #21570. ## Confidence High that this removes the empty-marker failure mode: the gap is inherent to `File.WriteAllText` and the reader returns on its first read. Low that it changes the C# language server / OnLaunched timeout failures, which this PR does not target. **How we stop this recurring:** Fixture processes that publish readiness files for E2E polling should write a temp file and rename it into place. The unit test now enforces this for the WinUI marker. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 8f00c66)
#21938) ## Description **What failed:** `[vscode] Aspire Blazor browser debugger E2E > hits a managed breakpoint for hosted-global` in **VS Code extension E2E (Windows, browser-debugger)**, on main in run [42413925421](https://github.com/microsoft/aspire/actions/runs/42413925421) ([job](https://github.com/microsoft/aspire/actions/runs/42413925421/job/128531739772)) and on a PR branch in run [42312596518](https://github.com/microsoft/aspire/actions/runs/42312596518) ([job](https://github.com/microsoft/aspire/actions/runs/42312596518/job/128225566096)). The test reported only the masked bridge error `Failed to apply E2E control revision …: E2E control command failed.` **Why:** `hosted-global` is the only Blazor scenario that uses `closeMode: 'natural'`. The proof continues the breakpoint, asks js-debug for its CDP proxy and sends `Page.close` over that socket. The js-debug traces in both failing runs' diagnostics artifacts (`blazor-debugadapter-*.json`, `proxyActivity`) show the page target detaching before the browser answered. js-debug v1.117.0's `CDPSession._onClose` ([connection.ts#L385-L388](https://github.com/microsoft/vscode-js-debug/blob/v1.117.0/src/cdp/connection.ts#L385-L388)) rejects the pending call with `setCause(0, 'Connection is closed')`, and the proxy (`sendOrDie`) relays it to the client as `{"id":1,"error":{"code":0,"message":"Connection is closed"}}`, keeping the proxy socket open. Passing runs get `{"id":1,"result":{}}`. `closeBrowserPageThroughCdp` already accepted a socket *close* after `Page.close` as "target gone", but treated this equivalent error reply as `Browser CDP Page.close failed`, which fails the proof even though the page, Mono and root sessions then terminate normally (they do in both traces). **Fix:** `closeBrowserPageThroughCdp` now treats the js-debug target-closed reply (`code === 0 && message === 'Connection is closed'`) the same as the socket-close case. This doesn't weaken the proof: the caller still requires every proof session (root, browser, managed) to terminate and `debug-in-browser` to return to `Enabled`. Any other `Page.close` error (e.g. `-32601 Method not found`) still fails. **Regression tests** (`extension/src/test/e2eStateFileBridge.test.ts`, run against the real `executeE2eControlCommand` product path): - `accepts target disconnection (target-closed reply) during Page.close only after all proof sessions terminate`: the CI failure, which fails without the fix with the exact CI error `Browser CDP Page.close failed: {"code":0,"message":"Connection is closed"}`. - `rejects a target-closed Page.close reply while a proof session remains active`: shows the reply is not a bypass, because the proof still fails if the managed session stays alive. - The existing socket-close case is kept, parametrized alongside the new one. Dedupe: no open issue or PR covers `hosted-global`. #21912 covers a different browser-debugger failure (the `maps managed Edge debugging` before-all hook CLI `--version` probe), and none of the AspireAgent PRs #21911–#21932 touch this test. Tracker: #21600. ## Confidence Paired local runs of `e2eStateFileBridge.test.js` under VS Code 1.131.0 (`vscode-test`, xvfb), same machine and commit, toggling only the product change: | | runs green | per-run result | |---|---|---| | before (fix reverted, new tests kept) | **0/10** | 61 passing, 2 failing (the two new tests, with the CI error) | | after | **10/10** | 63 passing, 0 failing | `yarn lint` and `yarn compile-tests` pass. This is a test-harness change only (`extension/src/testing`), so there's no product behavior change and no E2E behavior evidence beyond the CI `browser-debugger` shards on this PR. ## Failure stats (14d, attempt 1) Window 2026-10-25 12:00 → 2026-11-08 12:00 UTC, `ci.yml`, attempt-1 jobs only. The denominator is decided attempt-1 runs (same definition as #21600). Hits are verified from each failed `VS Code extension E2E (Windows, browser-debugger)` job's mocha failure line (48 failed jobs scanned over 30d). - **This signature** (`hits a managed breakpoint for hosted-global` → `Page.close` target-closed reply): **3/1157** decided runs, **2 main / 1 PR** (main 2/160, PR 1/997). - **Any `hosted-global` failure:** 4/1157. The extra one (run 40728167754) is a different cause, `Timed out after 300000ms waiting for browser navigation to 'counter'`, which this PR does **not** claim to fix. - **30d main:** **2** verified hits (both are in the 14d window). Six older or other main browser-debugger failures had expired or unavailable logs and could not be classified. - The two newest failures show only the masked `E2E control command failed.`; the js-debug traces in their diagnostics artifacts show the `{"code":0,"message":"Connection is closed"}` proxy reply. The 10-28 main failure predates the masking and prints the exact error. | Run | Date (UTC) | Branch | Job | Error | |---|---|---|---|---| | [42413925421](https://github.com/microsoft/aspire/actions/runs/42413925421) | 11-07 21:02 | main | [128531739772](https://github.com/microsoft/aspire/actions/runs/42413925421/job/128531739772) | masked; trace shows target-closed reply | | [42312596518](https://github.com/microsoft/aspire/actions/runs/42312596518) | 11-06 23:32 | PR (eerhardt-dashboard-authorize-anonymous-pages) | [128225566096](https://github.com/microsoft/aspire/actions/runs/42312596518/job/128225566096) | masked; trace shows target-closed reply | | [40606196498](https://github.com/microsoft/aspire/actions/runs/40606196498) | 10-28 00:02 | main | [122561450397](https://github.com/microsoft/aspire/actions/runs/40606196498/job/122561450397) | `Browser CDP Page.close failed: {"code":0,"message":"Connection is closed"}` | | [40728167754](https://github.com/microsoft/aspire/actions/runs/40728167754) | 10-28 16:39 | PR (native-bundle-continuation) | [122971965889](https://github.com/microsoft/aspire/actions/runs/40728167754/job/122971965889) | different cause: navigation timeout (not addressed) | ## Verdict **STRONG**: the failure was reproduced deterministically through the product code path, and the before-fix run fails with the exact CI error string (0/10 → 10/10). js-debug traces from both recent failures and the unmasked 10-28 main error point to the same cause. The frequency is low (3/1157), so CI alone will take time to confirm the absence of hits. This PR's own CI (head `bbb5a79f`) was green on both `browser-debugger` shards on attempt 1. The attempt-1 rerun was only for the unrelated `tree-actions` flake (#21796, fix in #21914). **How we stop this recurring:** CDP proxy transport outcomes after `Page.close` (socket close *or* js-debug's target-closed reply) are now classified in one place, `isCdpProxyTargetClosedError`, with unit tests pinning both forms. The proof's real gate stays session termination plus command reset, so future js-debug transport variations can't silently mask a real leak. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…21927) ## Description **What failed.** The Windows VS Code extension unit job intermittently fails `E2E state file bridge > bounds the natural-close connection and releases its socket on timeout` on `assert.strictEqual(clock.countTimers(), 0)` with `1 !== 0`: [42338413245](https://github.com/microsoft/aspire/actions/runs/42338413245), [42289556640](https://github.com/microsoft/aspire/actions/runs/42289556640), [42137910318](https://github.com/microsoft/aspire/actions/runs/42137910318). That's 4 of 608 first attempts in 7 days, and every one passed on rerun. The failing runs came from unrelated PRs (a Dependabot actions bump and two dashboard UI changes) that don't touch the extension, so this is a flake, not a PR-caused failure. ## Failure stats (14d, attempt 1) `CI` workflow on microsoft/aspire, runs created 2026-10-25 06:28 → 2026-11-08 06:28 UTC, **attempt 1 only**. Denominator: attempt-1 jobs that ran (success or failure). Hits: the failed job's log matches the signature. Jobs that lost their runner, which have no log, are excluded. Main runs have no reruns, so their flake check is the next main run of the job. | | | |---|---| | Signature | `E2E state file bridge` › `bounds the natural-close connection and releases its socket on timeout` (`countTimers()` `1 !== 0`) | | Job | Run VS Code extension unit tests (Windows) | | main pushes: hits / runs | 0 / 158 (0.00%) | | main pushes, 30d: hits / runs | 0 / 273 (0.00%). The 16 days before the 14d window add 0 hits. | | PR runs: hits / runs | 10 / 986 (1.01%); 0 PR-caused excluded | | Combined rate | 10 / 1144 = **0.87%** | | Flake check | PR: 7/7 rerun hits passed on rerun (3 never rerun) | | First / last hit | 2026-11-05 / 2026-11-08 | | Still hitting main? | Yes, still active: last hit 2026-11-08; last main hit never | | Fix evidence | Local (real VS Code 1.131 host): the new regression test fails 3/3 with the CI signature before; after the fix the suite passes 4/4. The natural flake reproduced 1 time in ~18 suite runs. This PR's CI ([run](https://github.com/microsoft/aspire/actions/runs/42453400853)): the Windows unit job passed on attempt 1 (1/1). Attempts 1 and 2 failed only in `VS Code extension E2E (Windows, tree-actions)` with `Expected e2e-worker to expose an endpoint URL`, which is the known flake #21796 owned by #21914 (this PR touches only unit-test files). Attempt 3 passed and Final Results is green. | Failing attempt-1 jobs, most recent first (all 10 hits, all PR runs): | Date (UTC) | Branch | Job | Signature excerpt | |---|---|---|---| | [2026-11-08 06:03](https://github.com/microsoft/aspire/actions/runs/42453169210/job/128646825791) | `aspireagent/fix-vscode-folder-picker-colliding-selection` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 1 !== 0` | | [2026-11-07 04:25](https://github.com/microsoft/aspire/actions/runs/42338413245/job/128301352107) | `sebros/resources-compact-view-regression-4abee4` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 1 !== 0` | | [2026-11-06 20:34](https://github.com/microsoft/aspire/actions/runs/42289556640/job/128140462040) | `dependabot/github_actions/github-actions-ebbe822166` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 1 !== 0` | | [2026-11-06 15:59](https://github.com/microsoft/aspire/actions/runs/42248127696/job/127997089873) | `sebros/dashboard-review-tracking-issue-f03a30` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 2 !== 0` | | [2026-11-06 14:50](https://github.com/microsoft/aspire/actions/runs/42237500020/job/127960139523) | `ievangelist-go-runtime-export-readiness` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 1 !== 0` | | [2026-11-06 02:15](https://github.com/microsoft/aspire/actions/runs/42149206621/job/127671234198) | `spike/project-v2-csharpprogram-watch` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 2 !== 0` | | [2026-11-06 01:20](https://github.com/microsoft/aspire/actions/runs/42143166267/job/127650342491) | `spike/project-v2-csharpprogram-watch` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 2 !== 0` | | [2026-11-06 00:35](https://github.com/microsoft/aspire/actions/runs/42137910318/job/127631683952) | `ievangelist-dashboard-sidebar-auto-collapse` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 1 !== 0` | | [2026-11-05 19:43](https://github.com/microsoft/aspire/actions/runs/42096580384/job/127491142502) | `damianedwards-launch-groups` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 1 !== 0` | | [2026-11-05 19:01](https://github.com/microsoft/aspire/actions/runs/42089852361/job/127466229297) | `copilot/clarify-scope-of-agent-integrations` | Run VS Code extension unit tests (Windows) | `bounds the natural-close connection…: AssertionError strictly equal: 1 !== 0` | Same root cause, other tests in this suite (not counted above; this PR migrates them too): [11-05](https://github.com/microsoft/aspire/actions/runs/42093304445/job/127478234883) `natural-close response … 2 !== 0` · [11-06](https://github.com/microsoft/aspire/actions/runs/42146938315/job/127661485652) `CDP proxy request … 2 !== 0` · [11-06](https://github.com/microsoft/aspire/actions/runs/42296965127/job/128166382811) `CDP proxy request … 1 !== 0` · [11-06](https://github.com/microsoft/aspire/actions/runs/42304086594/job/128189892984) `natural-close response … 1 !== 0`. **Verdict: MODERATE.** 10 hits since 2026-11-05 (0.9%), still hitting today, and all 7 that were rerun passed on rerun. It has **never hit on main** (0/158). The fix is validated on a modelled host callback in a real extension host, and its own CI ran the unit job once (green). <!-- /failure-stats --> **Why.** The suite calls `sandbox.useFakeTimers()`, which replaces `setTimeout` and the other timer globals for the whole extension-host process. `clock.tickAsync()` yields to the real event loop, and host or other-extension callbacks that run during those yields schedule their timers on the test's fake clock. `closeBrowserPageThroughCdp` and `proveBlazorWasmDebugging` clear every timer they create on this path. The extra timer belongs to someone else. I reproduced it locally in a real VS Code 1.131 extension host by looping the full unit suite: the leftover was a 25 ms timer with a bound native callback, created at fake time 1100 (after the tick ended) and not by the bridge code. This is the same root cause #21922 found for `spawnCliProcess`. **Fix.** Every clock in `e2eStateFileBridge.test.ts` (8 tests) now uses `withScopedFakeTimers` from #21922. Only the test body's async context sees the fake clock, and host callbacks keep real timers. The assertions are unchanged. A new regression test, `does not count extension host timers scheduled while the natural-close connection times out`, queues a host callback outside the test. The callback runs during the connection timeout's `tickAsync` and schedules a timer that's still pending when the wait ends. It stays in this suite as the bridge-level repro of the original flake, and a comment says so. The helper's own isolation guarantees are covered in `scopedFakeTimers.test.ts`. **Depends on #21922.** This branch is stacked on #21922's head (`4f84aa90`) because it uses that PR's helper, including its fixes for scopes that settle out of order and for `util.promisify` timers. It targets `main` so CI runs, which means the diff includes #21922's commits until that PR merges. After #21922 merges, I'll rebase so only this PR's two commits remain (`8d966f54`, `b36b2994`). ## Confidence High that this removes the flake. Evidence, all from a real VS Code 1.131.0 extension host under xvfb: - **Before** (same test file, with the suite's original global sinon clock): the new regression test fails 3/3 with the CI signature `AssertionError: 1 !== 0` at `countTimers()`. - **After** (`withScopedFakeTimers`): the `E2E state file bridge` suite passes 4/4 (62 passing). - Re-checked on the current stack in plain-Node mocha with a `vscode` shim, because VS Code can't be downloaded in that environment. The regression test **fails** 3/3 with `1 !== 0` at `countTimers()` when it uses the global sinon clock, and **passes** 3/3 with `withScopedFakeTimers`. The bridge, helper and `cliSpawn` suites together have the same failure set with #21922's version of this file as with this PR: 3 shim gaps unrelated to timers. This PR adds one passing test. `tsc` and `eslint` are clean. - Main remaining uncertainty: I didn't capture the creation stack of the host timer in CI. I reproduced the natural flake locally once in about 18 full-suite runs, so the regression test models it rather than replaying the exact host callback. **How we stop this recurring:** move the remaining extension suites that still install global `sinon.useFakeTimers` (as #21922 proposes) onto `withScopedFakeTimers`, and add a lint rule against global fake timers in extension tests. Refs #21600, #21922 ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** --------- Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
The Linux and Windows
tree-actionsVS Code E2E shard fails withAssertionError: Expected e2e-worker to expose an endpoint URL.in routes view, copy, endpoint, log, and resource commands through tree handlers. It is the most frequent flake since #21624. Examples: run 41946839177 / job 126989027692 (Linux), run 41967348150 / job 127053704182 (Windows, main), run 41980257054 / job 127096573746 (Windows). #21796 lists more.Failure stats (14d, attempt 1)
CIworkflow on microsoft/aspire, runs created 2026-10-25 06:28 → 2026-11-08 06:28 UTC, attempt 1 only. Denominator: attempt-1 jobs that ran (success or failure). Hits: the failed job's log matches the signature. Jobs that lost their runner, which have no log, are excluded. Main runs have no reruns, so their flake check is the next main run of the job.Expected e2e-worker to expose an endpoint URL.Failing attempt-1 jobs, most recent first (10 of 34 log-verified hits):
aspireagent/vscode-bridge-scoped-fake-timersExpected e2e-worker to expose an endpoint URL.darc-main-252ee2c2-deac-4980-a34a-b797f49158deExpected e2e-worker to expose an endpoint URL.aspireagent/doctor-cancel-dcp-cleanupExpected e2e-worker to expose an endpoint URL.aspireagent/resource-attach-proof-resume-aborted-inspectionExpected e2e-worker to expose an endpoint URL.Expected e2e-worker to expose an endpoint URL.sebros/resources-compact-view-regression-4abee4Expected e2e-worker to expose an endpoint URL.Expected e2e-worker to expose an endpoint URL.ellahathaway-stop-idle-extension-pollingExpected e2e-worker to expose an endpoint URL.Expected e2e-worker to expose an endpoint URL.ellahathaway-clarify-agent-init-outputExpected e2e-worker to expose an endpoint URL.A strict re-scan of the job logs confirmed 34 of the 36 hits counted above; the table lists only confirmed hits. The rates above use the original count.
Verdict: STRONG. The most frequent signature here: 36 hits since 2026-11-05 (8 on main), still hitting today. 24 of the 25 PR hits that were rerun passed on rerun, and all 8 main hits passed on the next main run. The real-E2E before/after repro shows the exact CI assertion. The PR's own CI is 1 run per OS. That is not statistical proof on its own: at a 1.9% rate, ~160 clean runs are needed for 95% confidence.
Why: the spec captures
e2e-workerfrom the first snapshot where it isRunningand later reads its endpoint URL from that same object. DCP activates the worker's endpoint shortly after the resource reachesRunning, and the backchannel omits inactive URLs, so the firstRunningsnapshot can haveurls: []. The URL-bearing snapshot arrives a few milliseconds later, but the spec never re-reads it. Since #21624, the worker reachesRunningafter the extension'sdescribe --followattaches, so this URL-less snapshot is now visible to the spec.Fix: wait with the existing
waitForRunningResourceWithUrl('e2e-worker', 'http:', 180000)helper (already used by the Azure Functions spec) instead ofwaitForResourceState('e2e-worker', ['Running']). This is a test-only change, and the endpoint assertion is unchanged.Fixes #21796
Confidence
Runninge2e-workerline fromdescribe --followby 5s. The 5s delay is well above the 200ms state poll interval, so the URL-less snapshot is always observed.origin/main): 3/3 failed (6 passing, 1 failing), each with the exact CI assertion.Runningsnapshot followed the URL-less one by 2ms.tscfor bothtsconfig.e2e.jsonand the unit project, ande2eResourceReadiness.test.ts(9/9, run with mocha directly) all pass.tree-actionsshard, other E2E shards, andvscode-test-hosted unit tests (the VS Code download host is blocked in my environment). CI covers these.How we stop this recurring: E2E specs that read resource URLs should wait on
waitForRunningResourceWithUrlinstead of a state-onlyRunninggate, because state and URL activation arrive as separate snapshots.Related: #21854 made the same change but was closed without being merged.
Checklist
🤖 Posted by AspireAgent (AI Agent)