Avoid shell kill cwd cleanup flakes#1207
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the cross-SDK session.shell.kill E2E coverage by preventing long-lived shell commands from running inside disposable per-test workspaces. That fits the repo’s shared goal of keeping language SDK tests aligned while avoiding platform-specific flakiness in the common shell RPC surface.
Changes:
- Updated the .NET, Node, Go, and Python shell-kill E2E tests to run the long-lived command from the system temp directory.
- Preserved the existing
session.shell.killbehavior under test while avoiding Windows cleanup failures caused by lingering cwd handles. - Added clarifying comments in each test explaining the Windows-specific cleanup rationale.
Show a summary per file
| File | Description |
|---|---|
python/e2e/test_rpc_shell_and_fleet_e2e.py |
Uses tempfile.gettempdir() for the shell-kill test command cwd. |
nodejs/test/e2e/rpc_shell_and_fleet.e2e.test.ts |
Uses os.tmpdir() for the shell-kill test command cwd. |
go/internal/e2e/rpc_shell_and_fleet_e2e_test.go |
Uses os.TempDir() for the shell-kill test command cwd. |
dotnet/test/E2E/RpcShellAndFleetE2ETests.cs |
Uses Path.GetTempPath() for the shell-kill test command cwd. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 0
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Run the long-lived shell kill command outside the fixture workspace so a surviving Windows child process cannot hold copilot-test-work-* open during cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Run mirrored long-lived shell kill E2E commands outside each fixture workspace so surviving Windows child processes cannot block temp workspace cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When stdio startup fails quickly, wait briefly for the stderr reader before formatting the connection-lost exception so CLI argument errors are reported deterministically. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
72ac35f to
344b18f
Compare
Cross-SDK Consistency Review ✅This PR makes two types of changes and both are handled consistently across all four SDKs. 1. E2E Test Fix (all 4 SDKs — consistent ✅)The shell-kill test fix (
2. .NET Client Stderr Race Fix (internal implementation — no cross-SDK gap ✅)The
The .NET change brings its stderr-race behavior in line with what Node.js already does via the No consistency issues identified. 🎉
|
The Windows .NET E2E failure was caused by a long-running shell-kill test command inheriting the disposable fixture workspace as its current directory. If the shell wrapper was killed but a child process briefly survived, Windows could keep
copilot-test-work-*locked and fail cleanup.This updates the shell-kill E2E tests across .NET, Node, Go, and Python to run the long-lived command from the system temp directory instead of the fixture workspace. The tests still exercise
session.shell.kill, but a surviving child process can no longer block deletion of the per-test workspace.Validation:
dotnet test dotnet\test\GitHub.Copilot.SDK.Test.csproj --filter FullyQualifiedName~RpcShellAndFleetE2ETests.Should_Kill_Shell_Process -v ncd nodejs && npm test -- --run test/e2e/rpc_shell_and_fleet.e2e.test.ts -t "should kill shell process"cd go && go test ./internal/e2e -run TestRpcShellAndFleetE2E/should_kill_shell_process -count=1python -m pytest python\e2e\test_rpc_shell_and_fleet_e2e.py::TestRpcShellAndFleet::test_should_kill_shell_processcd nodejs && npm exec prettier -- --check test/e2e/rpc_shell_and_fleet.e2e.test.tspython -m ruff format python\e2e\test_rpc_shell_and_fleet_e2e.py --check