Repository navigation
fix: stop everything the deepseek gate probe started when it is killed - #35492
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the change moves the DeepSeek probe onto the same group-plus-tree-kill shape the Strands probe already uses, and both kill sites are covered. [DESIGN-REVIEWED] 71f7860 Description read[DESCRIPTION-READ] 850337f5128541eb0fe7ef8e24c8ce7095e5a0947ac00cdf5b6fd6db1e4ec59a 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix uses the tree kill that already exists in What this change shipsInventory (4 items) — 3 justifiedIntent: when Kiro Crew stops the DeepSeek gate probe, everything that probe started also stops (a FIX, closes #34019).
[FIRST-PRINCIPLES-REVIEWED] 71f7860 Description read[DESCRIPTION-READ] 89745c6183f6d461fc1c696e06b0fd1d0b7dd51e21bcbc72e63b15bc43894439 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed 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: |
Code change approver recommendation: ApproveWhy: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. The DeepSeek gate probe now starts in its own process group and both of its kill sites (timeout and error path) use the shared kill_popen_tree, the same as the existing Strands probe fix. The change is minimal, matches the description, regresses no sibling path, and moves no trust boundary. A new real-process test would fail on main, and the fake-process tests assert the tree kill on both paths. The remaining gaps (no kill on every exit path, pid-reuse hygiene in test cleanup, pending CI) don't block. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
|
[operator: bolichen97] Backend Tests (3.12, 8) and Backend Tests (Windows) (8) fail on |
d3f3fc3 to
13e58d5
Compare
|
self-added: yes
[operator: bolichen97] |
The DeepSeek gate read-back boots dsh once and, when the read-back times out or dsh ignores stdin closing, kills it with process.kill(). That ends only the direct child, so anything dsh started kept running with no parent. Start the probe in its own process group and stop it with the shared platform_compat.kill_popen_tree at both kill sites, as the Strands probe does, so the whole tree goes with it (taskkill /T /F on Windows). The bounded reap, the refusal text and the read-back budget are unchanged. The real-process tests for this probe and for the Strands probe end their stand-in and its worker in a finally, so a test stopped mid-probe leaves nothing running. Closes #34019
13e58d5 to
71f7860
Compare
|
Rebased: main moved in src/kiro_crew/acp/client_permissions.py, src/kiro_crew/acp/client_start.py, src/kiro_crew/acp/harness/codex.py, src/kiro_crew/acp/runtime_spawn_launch.py, test/acp_launch_capture.py and test/test_codex_host_binary.py since this head's CI ran (6c11807 -> 758e63c), and main now carries #35625, the fix for the main reds in test_wait_discipline_ratchet.py and test_updates_handlers_facade.py (red on main at e8283ce in the same shards); CI re-running. |
buluoray
left a comment
There was a problem hiding this comment.
Approve on 71f7860. The DeepSeek gate probe starts in its own process group, and both of its kill paths call the shared tree kill, so a killed probe takes the processes it started with it. Since the last approved head, the product change is unchanged; the PR now also moves the cleanup in the DeepSeek and Strands real-process kill tests into a finally block, so an interrupted test run leaks nothing. Each of the three guard mutations turns a named test red. One backend shard failed once on a test in an unrelated file and passed on a single rerun; every check on this head is now green. Decisive lines: src/kiro_crew/acp/harness/deepseek.py:581-582, src/kiro_crew/acp/harness/deepseek.py:609, src/kiro_crew/acp/harness/deepseek.py:614, src/kiro_crew/platform_compat_kill.py:497-518, test/test_acp_deepseek_backend.py:371-383
Problem / Motivation
Goal: When Kiro Crew has to stop the DeepSeek harness it boots to check the gate, everything that harness started stops with it.
Before a DeepSeek chat starts,
_verify_deepseek_gatebootsdsh --profile acponce to read back the gate plugin's load marker. When the read-back times out, ordshignores stdin closing, the probe callsprocess.kill(). That ends onlydshitself, so anythingdshstarted keeps running with no parent.Why it matters
Every chat start that reaches that kill can leave processes running on the operator's machine, holding memory and files, with nothing left that will stop them. #34237 fixed the same defect in the Strands probe; the DeepSeek probe still has it.
Not a goal
What changed (motivation → approach → change)
When Kiro Crew has to stop the DeepSeek harness it boots to check the gate, everything that harness started now stops with it. Before, only the harness's own process was stopped.
The probe used a single-process kill on a child that had no process group of its own, so the kill had nothing wider to reach.
kill_popen_tree, the shared tree kill inplatform_compat, already does the wider kill: the whole group on POSIX,taskkill /T /Fon Windows, then the same directkillas before.In
src/kiro_crew/acp/harness/deepseek.pythe probe now starts in its own process group (start_new_session=IS_POSIX,creationflags=CREATE_NEW_PROCESS_GROUP, the same pair the Strands probe uses), and both places that stop it (the timeout after stdin closes and the error path) callplatform_compat.kill_popen_tree. The bounded reap after the timeout kill is unchanged.Backwards compatibility
Compatible: only a probe that is already being stopped behaves differently, and it now also stops what it started. The refusal text, the read-back budget and the session launch are unchanged.
Removes nothing: the probe still kills its direct child; the tree kill ends with that same
kill.Tests
test_a_probe_that_will_not_exit_is_killed_with_everything_it_started(new): a real stand-indshstarts a worker, publishes the marker, then ignores stdin closing. After_verify_deepseek_gatereturns, neither the stand-in nor its worker is running. Onmainthe worker survives and the test fails. The test ends both processes in afinallyfrom the pids they recorded, so a run stopped mid-probe (Ctrl+C, a timeout) leaves nothing running.test_a_failure_while_the_probe_runs_ends_it_with_everything_it_started(new): the fake harness'spoll()raisesOSError, and the error path still stops it with the tree kill.test_a_probe_whose_plugin_never_writes_a_marker_is_refused_and_ended: the shared fakePopenhas no pid to signal, so the verifier helper records the tree kill on the fake, and the test asserts that the timeout path used the tree kill. Its other assertions are unchanged.test_acp_strands_backend.py::test_a_probe_that_will_not_exit_is_killed_with_everything_it_started, the Strands test the new real-process test copies, ends its stand-in and worker in the samefinally. Its assertion is unchanged.Proof: PROVEN test/test_acp_deepseek_backend.py::test_a_probe_whose_plugin_never_writes_a_marker_is_refused_and_ended, test/test_acp_deepseek_backend.py::test_a_probe_that_will_not_exit_is_killed_with_everything_it_started, test/test_acp_deepseek_backend.py::test_a_failure_while_the_probe_runs_ends_it_with_everything_it_started (head 71f7860)
Determinism: the three DeepSeek tests above passed 20 times at
-n0; they and the whole oftest/test_acp_strands_backend.py, which holds the Strands real-process test, passed 10 times at-n 4 --dist loadgroup --max-worker-restart=2besidetest/test_acp_deepseek_backend_vault.py; and the whole DeepSeek file passed in a shuffled order (seed 2407).prove.py --per-hunkreverts each production hunk on its own and a test fails for every one.Manual verification
N/A — unit coverage sufficient: the real-process test drives the real function with real child processes on Linux. The Windows arm is the shared
kill_popen_tree(taskkill /T /F), and the same test runs in the Windows backend CI job.Screenshots / video
N/A — the diff touches no frontend surface.
Related Issues
Closes #34019
Sibling sweep
Swept: git grep -nE "def verify[a-z]+_(gate|routing)|.kill()" -- src/kiro_crew/acp/
Sibling: src/kiro_crew/acp/harness/strands.py:757 -- not affected -- #34237 already stops this probe with the tree kill
Sibling: src/kiro_crew/acp/harness/pi.py:845 -- tracked in #35414
Sibling: src/kiro_crew/acp/harness/opencode.py:564 -- tracked in #35414
Sibling: src/kiro_crew/acp/client_permissions.py:217 -- not affected -- reads the session reply, starts no process
Sibling: src/kiro_crew/acp/client_lifecycle.py:551 -- not affected -- fallback after the session's tree kill already ran
Sibling: src/kiro_crew/acp/client_spawn_env.py:823 -- not affected -- a child still suspended at creation has started nothing
Sibling: src/kiro_crew/acp/session_handle_lifecycle.py:259 -- not affected -- a docstring naming
runtime.kill(), not a kill sitePattern harvest
Rule candidate: review-prompt
Pattern: a
Popenprobe stopped withprocess.kill()and no process group of its own, which leaves the probe's descendants runningChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)