Skip to content

[WIP] Diagnose flaky Deno inspector attach cancel test on Windows - #21929

Draft
David Fowler (davidfowl) wants to merge 2 commits into
mainfrom
aspireagent/deno-inspector-cancel-flake
Draft

David Fowler (davidfowl) wants to merge 2 commits into
mainfrom
aspireagent/deno-inspector-cancel-flake

Conversation

@davidfowl

@davidfowl David Fowler (davidfowl) commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Important

Draft: the root cause is not confirmed. Do not merge. The evidence is WEAK, so this PR stays a draft. It now carries only on-failure diagnostics. No product fix is included.

What failed

On Windows only, Node Debugger Deno AppHost inspector attach (js-debug) > stops a pending inspector attach when the debug session is cancelled hits the 60s mocha timeout. This is the rank 2 flake in #21600.

In both runs on current code, the test after it passed one second later. stopDebugging itself returned normally, and the only failure was that the fixture runtime never exited.

Why (best supported hypothesis, not proven)

The runtime blocked in --inspect-wait can only be stopped by the extension's cleanup, stopInspectorWaitingProcesses in node.ts. js-debug keeps the pending program in a local variable until attach and never kills it on disconnect.

That cleanup finds the runtime with a PowerShell Get-CimInstance Win32_Process listing. Each listing has a 30s timeout, and the settle window is 15s. On the cancel path, isSpawnSettled never becomes true, because neither a launch response nor onExit arrives. If every listing fails for longer than the settle window, the cleanup throws without signalling anything. One stalled PowerShell over 30s also exceeds the window by itself. The test's trackPendingResourceCleanup stub runs cleanup once, so the runtime stays blocked and the test times out.

Reproduced locally (Linux, VS Code 1.131.0, listProcesses stubbed to fail for a fixed window in the cancel flow):

Forced listing outage Result
0–3s random delay, 40 iterations 40/40 pass
10s failure window pass (10.7s; cleanup retried and killed the runtime)
17s failure window 60s timeout, the same signature as CI

What is not proven: that a Windows listing outage or stall actually happened in the failing runs. The original logs carry no cleanup output. 360 Windows stress iterations on this PR did not reproduce the failure. I also ruled out a candidate correlation: the preceding never-ready test takes 5–8s in most passing main runs, so its 6s in the failing runs is not a signal.

Fix

None yet. A fix should not be speculative, and the hypothesis is not confirmed. This PR now contains only on-failure diagnostics in nodeInspectorAttach.test.ts. When a test in that suite fails, they print the cleanup's log lines (listing errors and kills) and the extension-host process tree, which would confirm or refute the hypothesis the next time it hits. The temporary 120-iteration stress loop has been removed.

Confidence

Low. The induced outage reproduces the exact symptom, but nothing shows the outage occurred on the Windows runners.

How we stop this recurring: capture the cleanup log on failure, which this PR does, then fix the layer the log implicates. If it is a listing outage, the cleanup should not give up on an unconfirmed runtime after a single stalled listing.

Failure stats (14d, attempt 1)

Attempt-1 failures / runs where the job executed Rate
main 0/96 0%
PRs 3/617 0.49%
Run Branch Attempt-1 job Other failures in the job
42453169210 aspireagent/fix-vscode-folder-picker-colliding-selection 128646825791 e2eStateFileBridge, cliSpawn
42307646449 ellahathaway-clarify-agent-init-output 128202870372 none
42088936765 platform-specific-infrastructure-ci 127462852235 4 other Deno attach tests (older code)
  • Local N/N:
    • Before: 40/40 with listing delays of up to 3s; an induced listing outage over 15s gives 1/1 timeout.
    • After: 8/8, the Deno attach suite with the stress loop removed. There is no fix, so before and after differ only by induced faults.
  • This PR's CI, run 42466357223:
  • Verdict: WEAK. The mechanism reproduces only under fault injection. It is not observed on CI, and the per-run rate (about 0.5%) is too low for the stress results to discriminate. Kept as a draft.

🤖 Posted by AspireAgent (AI Agent)

…-path stress loop

The stress loop is temporary and will be removed before review.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidfowl David Fowler (davidfowl) added the agent:working An AI agent is actively working on this issue or PR label Nov 8, 2026 — with Copilot SWE Agent
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21929

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21929"

@github-actions

This comment has been minimized.

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.

🔵 Needs a closer look

The Windows debugger-cancellation race remains unresolved, and Windows stress-run diagnostics must be evaluated before the cleanup behavior can be validated.

No open issues 🎉

What changed in this PR

This draft adds diagnostics to investigate the Windows Deno inspector-attach cancellation flake in the VS Code extension. It does not yet implement a fix.

Changes:

  • Captures extension logs and cancellation progress markers.
  • Reports still-connected fixtures and fresh process ancestry when a test fails.
  • Adds a temporary 120-iteration stress loop, skipping remaining iterations after three failures.
File Description
extension/​src/​test/​nodeInspectorAttach.test.ts Adds failure diagnostics and temporary stress coverage for inspector-attach cleanup.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

The 120-iteration Windows stress loop passed 360/360 across three CI
attempts without reproducing the flake. Keep only the on-failure cleanup
log and process-tree diagnostics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidfowl David Fowler (davidfowl) changed the title [WIP] Fix flaky Deno inspector attach cancel cleanup test on Windows [WIP] Diagnose flaky Deno inspector attach cancel test on Windows Nov 8, 2026
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 8, 2026 10:42
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Tests selector

0 / 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)

extension-e2e, extension-unit


How these were chosen — grouped by what changed

Job reasons

Job Triggered by
extension-e2e extension/src/test/nodeInspectorAttach.test.ts
extension-unit extension/src/test/nodeInspectorAttach.test.ts

Selection computed for commit 65fbe3c.

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.

🟢 Approval recommended

No active review issues block the added inspector-attach test diagnostics.

No open issues 🎉

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants