Skip to content

[cherry-pick] test: clean up Windows agent-host descendants after shutdown - #337138

Merged
Christof Marti (chrmarti) merged 1 commit into
release/1.139from
cherry-pick/337080
Sep 21, 2026
Merged

Christof Marti (chrmarti) merged 1 commit into
release/1.139from
cherry-pick/337080

Conversation

@vs-code-engineering

Copy link
Copy Markdown
Contributor

Cherry-pick of #337080 from main.

Summary

Minimal, test-harness-only follow-up to the Windows Codex E2E teardown failure on #337043 (failed job). Replaces my overly broad adaptation in #337070; Dmitri's provider-lifecycle work remains in #335992 and is not taken over here.

stopServer waits for the agent-host parent to exit. On Windows, descendants can remain alive after that clean exit and retain resources under the test home; taskkill /T cannot discover them through a parent that has already exited.

  • Record the running test server's Windows descendants before sending EOF.
  • Preserve existing graceful shutdown and fallback behavior, then await cleanup of the recorded descendants using the existing killTree helper.
  • Ignore termination errors only when the recorded process has already exited; otherwise propagate them. A failed descendant lookup is reported after still stopping the server.
  • Bound descendant enumeration and graceful exit with one shutdown deadline; preserve EOF and forced cleanup even if enumeration stalls.
  • Add Windows orphan-cleanup and cross-platform stalled-snapshot regressions, and document the cleanup boundary.

No production code, shared process utilities, Codex provider behavior, shutdown budgets, SDK versions, replay fixtures, or retry policies change. The changes remain confined to test-server cleanup, its regression tests, and documentation.

This targets the test-server cleanup boundary, not every possible provider shutdown race. The archived CI error does not identify its exact locking process, so the synthetic reproduction establishes the orphan-cleanup gap rather than conclusively identifying the handle owner in that run.

Validation

  • New regression fails on unchanged main: the parent exits with code 0, but the recorded descendant is still running.
  • After the fix: cleanup and host-shutdown unit suites 6 passing.
  • Strict tokenless Codex replay across common and Codex-specific suite lifetimes: 3 passing, teardown successful.
  • npm run gulp compile-client: 0 errors.
  • ESLint, diff checks, and commit hygiene: passed.

Local validation is Windows-only. The previous head passed three-platform Azure build 475551. The review follow-up in 62e8628b8fe passes local compile, lint, hygiene, 6 unit tests, and 3 focused Codex replay tests; removing its snapshot bound makes the new regression fail. Fresh PR CI and Azure build 475625 are running on the updated head with publishing and release disabled; results remain pending.

Copilot AI balanced review requested due to automatic review settings September 21, 2026 20:15
@vs-code-engineering vs-code-engineering Bot added the cherry-pick-artifact Auto-generated cherry-pick PR label Sep 21, 2026

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.

Copilot review overview

🟡 Changes recommended

promisify(getProcessList) rejects successful Windows snapshots, preventing descendant cleanup.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds Windows-specific cleanup for orphaned Agent Host test descendants.

Changes:

  • Captures and terminates descendants during server shutdown.
  • Adds shutdown regression tests.
  • Documents the cleanup boundary.
File Description
serverIntegrationTestHelpers.ts Implements descendant cleanup.
serverIntegrationTestHelpers.test.ts Adds cleanup regressions.
e2e/​README.md Documents Windows teardown behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vs/platform/agentHost/test/node/serverIntegrationTestHelpers.ts
@chrmarti
Christof Marti (chrmarti) merged commit 04af555 into release/1.139 Sep 21, 2026
34 checks passed
@chrmarti
Christof Marti (chrmarti) deleted the cherry-pick/337080 branch September 21, 2026 21:33
@vs-code-engineering vs-code-engineering Bot added this to the 1.139.0 milestone Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick-artifact Auto-generated cherry-pick PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants