Repository navigation
test: keep the slack team-id spawn tests off real Windows process calls - #24613
iamwhatever wants to merge 1 commit into
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Test-only change. It mocks the Windows cleanup-owner seam where the product code calls it ( Notes
[DESIGN-REVIEWED] b7a4ef2 Description read[DESCRIPTION-READ] 9a798df5a328719c10ac18c87a5984edeb1c6d9e5a5b6a0248b4b6897c915111 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsNo findings. Notes:
[OPUS-REVIEWED] b7a4ef2 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
There was a problem hiding this comment.
Approving 71bd912. This fixes the Windows-only red on main (Backend Tests (Windows) (6), main @ a3ee04f): every TestSpawnEnv case raised FileNotFoundError because on Windows the launch goes through platform_compat.create_windows_cleanup_owned_process, whose factory reaches native CreateProcess past the mocked asyncio.create_subprocess_exec. Running the factory the way the POSIX branch does is the same seam test/acp_launch_capture.py uses, and stubbing finish_suspended_spawn keeps the Windows resume step off the mocked pid. Test-only; every assertion stays.
One thing blocks the merge that is not code: PR Hygiene fails because the description is missing the template sections (Problem / Motivation, Why it matters, Not a goal, What changed, Tests). Rebuilding the body from .github/PULL_REQUEST_TEMPLATE.md clears it without a push.
buluoray
left a comment
There was a problem hiding this comment.
This supersedes my approval on 71bd912.
The new patch patch("kiro_crew.acp.client_start.finish_suspended_spawn") reddens main's own guard: test/test_facade_mirror_guards.py::test_no_test_patches_a_shared_name_on_an_owner_directly fails on Backend Tests (3.12) shards 1-4 and Windows (2) with "a name more than one member of a mirrored family binds is patched through the facade". finish_suspended_spawn is bound by both client_spawn_env and client_start, so patching one owner directly leaves the other on the real function. kiro_crew.acp.client is a MirroredModule facade (client.py:954) that forwards a patch to every owner, so the patch belongs on the facade: patch("kiro_crew.acp.client.finish_suspended_spawn", return_value=True), the same seam test/acp_launch_capture.py uses. My earlier note that the facade patch would miss the call was wrong.
#24609 carries the facade form of the same fix and has no failing checks so far; either change this line or let #24609 land instead. The PR Hygiene description gap is still open too.
On Windows, launch() wraps the spawn factory in platform_compat.create_windows_cleanup_owned_process, which hands it a cleanup owner. create_subprocess_limited then calls native CreateProcess through _create_windows_subprocess_owned instead of the mocked asyncio.create_subprocess_exec, and the synthetic /usr/bin/kiro-cli is not found (WinError 2). All six TestSpawnEnv tests failed on the Windows shard. Pass the factory straight through, as test_xdist_auto_cap.py already does for the same seam, and stub finish_suspended_spawn, which on Windows would resume every thread of the mocked pid 12345 on the host. The behaviour under test (the env the child is handed) is not POSIX-only, so the tests keep running on Windows.
71bd912 to
b7a4ef2
Compare
buluoray
left a comment
There was a problem hiding this comment.
Approving b7a4ef2. This supersedes my request-changes review on 71bd912. The finish_suspended_spawn stub now goes through the facade (patch("kiro_crew.acp.client.finish_suspended_spawn")), which MirroredModule forwards to every owner, so test_facade_mirror_guards no longer fires. The description now carries the template sections. The rest of the fix is unchanged from the version I reviewed: the Windows cleanup seam runs the factory the POSIX way, test-only, every assertion kept.
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: @iamwhatever, this is approved with auto-merge on, but it now conflicts with main, so it cannot land. Four PRs are waiting on it for the Windows |
Problem / Motivation
Goal: Make
Backend Tests (Windows)shard 6 green again by fixing the sixTestSpawnEnvtests that fail there.test/test_slack_team_id_env.py::TestSpawnEnvfails 6/6 on Windows shard 6 withFileNotFoundError: [WinError 2] The system cannot find the file specified, raised by nativeCreateProcessof/usr/bin/kiro-cli acp. Seen on #24499 (head 3bb53f7, which touches no Python). The file came in with #22380 (a3ee04f).Why it matters
Every PR whose Windows shards run gets a red shard 6 it did not cause. That blocks merges and wastes reruns until main is fixed.
Not a goal
test_acp_client_spawn.pyand friends) back onto Windows. They are intest/windows-collect-ignore.txttoday.What changed (motivation → approach → change)
Symptom: WinError 2 from native
CreateProcessin all six spawn-env tests, Windows only.Root cause: the tests mock
asyncio.create_subprocess_exec. On Windows,launch()(src/kiro_crew/acp/launch.py) wraps the spawn factory inplatform_compat.create_windows_cleanup_owned_process, which calls it with awindows_cleanup_owner. With an owner,create_subprocess_limited(src/kiro_crew/sandbox_rlimit.py) goes toplatform_compat._create_windows_subprocess_owned. That calls nativeCreateProcessdirectly and never reaches the mock, so the fake/usr/bin/kiro-cliis not found. The sibling ACP spawn suites use the same mocks but are not collected on Windows, which is why only this new file showed it.Change, in
test/test_slack_team_id_env.pyonly:kiro_crew.platform_compat.create_windows_cleanup_owned_processwith a passthrough that calls the factory with no owner, as on POSIX. This is the patterntest/test_xdist_auto_cap.pyalready uses. The spawn then reaches the mockedasyncio.create_subprocess_exec.finish_suspended_spawnthrough thekiro_crew.acp.clientfacade, which mirrors it intoclient_start(patching the owner directly tripstest/test_facade_mirror_guards.py). On Windows it resumes every thread of the pid it is handed, and the mocked pid 12345 is not our child. This was the blocking finding from the local GPT review.The tests are not skipped or xfailed on Windows. What they check, the env the child is handed, is not POSIX-only.
Backwards compatibility
Compatible: test-only change; no product code is touched.
Removes nothing: the diff only adds two test patches and a helper.
Tests
test/test_slack_team_id_env.py(no new tests; the six existingTestSpawnEnvtests now run correctly on Windows).Proof: not provable -- test-only change
test/test_slack_team_id_env.py14 passed.IS_WINDOWS=True, no spawn shim, cleanup seam hands a cleanup owner, native create raises):TestSpawnEnv6 failed before the change, 6 passed after.finish_suspended_spawnreplaced by one that raises,TestSpawnEnvstill passes 6/6, so the facade patch reachesclient_start.tree_scanguard suite: 11265 passed, 14 skipped.Manual verification
N/A: the Windows shard in this PR's own CI is the real check; the local run forces the Windows branch on Linux.
Related Issues
Fixes #24612
Sibling sweep
Swept: for f in $(git grep -l "_spawn()" -- test/); grep -l "asyncio.create_subprocess_exec" without "create_windows_cleanup_owned_process"
Sibling: test/test_acp_client_spawn.py -- not affected -- listed in test/windows-collect-ignore.txt, never collected on Windows
Sibling: test/test_acp_client_binary_resolution.py -- not affected -- listed in test/windows-collect-ignore.txt, never collected on Windows
Sibling: test/test_acp_exit_signal_origin.py -- not affected -- patches platform_compat.IS_WINDOWS to False around its spawn
Sibling: test/test_dev_fleet_removal_pod_start.py -- not affected -- spawns its own real child, not AcpClient through launch()
Sibling: test/test_mcp_gateway_daemon_lifecycle.py -- not affected -- spawn tests carry a win32 skipif for /proc and unix sockets
Sibling: test/test_mcp_gateway_adopted_daemon_repair.py -- not affected -- spawn tests carry a POSIX-only skipif
Sibling: test/test_apple_speech.py -- not affected -- macOS-only suite, skipped elsewhere
Pattern harvest
Rule candidate: review-prompt
Pattern: a test that drives AcpClient._spawn by mocking asyncio.create_subprocess_exec must also pass through platform_compat.create_windows_cleanup_owned_process and stub finish_suspended_spawn, or it hits native CreateProcess on Windows.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.