Repository navigation
fix(crash-reporting): make the own-Chromium gate a real choke point, and stop a refusal leaking the root - #18459
Conversation
Round-3 review found the guard was not the choke point its own comments claimed: six pid-addressed `taskkill /pid <pid> /t /f` families in main were ungated and uninstrumented, so the stale-pid shape stayed producible and a `selfInitiatedTreeKillCount: 0` could read as exculpatory when it was not. - Gate the remaining main-process families: the git command-runner abort, the notebook-cell and automation-precheck timeouts. - Turn the `src/shared` seam into the gate itself (`process-tree-kill-gate`), so the runProcess choke point, the codex app-server deadline kill and the ephemeral-VM recipe kill ask the same decision. Those three are compiled into the CLI/relay too and cannot import main; main installs the guard at preflight. - Ratchet (`main-process-tree-kill-gate.test.ts`): a new pid-addressed taskkill in main that skips the gate fails, and the allowlist entries must still exist. - Give pid-addressed kills eviction priority in the 32-entry ring: 32 routine `win-pty-job` teardowns from a window-close burst no longer evict the one entry that discriminates a self-kill from an external one. - Correct the coverage doc, which described the uninstrumented Windows sites as POSIX `process.kill(-pid)` group kills and omitted the git and codex paths.
…it owns
A refusal must block the pid-addressed tree walk, not the termination. Five of
the six gated sites returned on refusal with no fallback, so a refused
`taskkill /pid /t /f` left git.exe, a timed-out notebook cell, an automation
precheck or an ephemeral-VM recipe running while the caller reported it stopped.
The root kill is addressed by the child handle, which cannot reach the recycled
pid the refusal is about, so it stays correct and required on that path.
Also fixes the ring eviction the scope preference introduced: with the ring
saturated by pid-addressed kills, the only non-pid-addressed entry is the one
just pushed, so the splice evicted itself and the detail came back `{}` --
byte-identical to the external-kill arm, in the window-close case the guard
exists for. Eviction now excludes the newest entry and falls back to FIFO.
Tests: refusal now asserts the root kill at all six sites, and the ring covers
the saturated-pid ordering as well as round 3's group-burst ordering.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change adds a shared process-tree kill admission gate. Main-process callers install the own-Chromium guard and check admission before Windows Merge Risk: 🟡 Moderate · up to The change gates process-tree termination to protect owned Chromium processes, but an unbound PID-admission window could still target a recycled PID and the Windows refusal fallback may terminate descendants that should survive. These behaviors should be resolved before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: aef36fc2-c01f-447c-9717-fa89eefe3358
📒 Files selected for processing (17)
src/main/automations/precheck-runner.tssrc/main/codex/codex-app-server-session.tssrc/main/crash-reporting/self-initiated-tree-kill-log.test.tssrc/main/crash-reporting/self-initiated-tree-kill-log.tssrc/main/git/command-runner/spawned-command-tree-kill.tssrc/main/ipc/notebook.tssrc/main/main-process-tree-kill-gate.test.tssrc/main/own-chromium-tree-kill-guard.test.tssrc/main/own-chromium-tree-kill-guard.tssrc/main/refused-tree-kill-root-termination.test.tssrc/main/startup/main-process-preflight.tssrc/main/windows-process-tree-kill.tssrc/shared/child-process/process-tree-kill-gate.tssrc/shared/child-process/process-tree-kill-observer.tssrc/shared/child-process/process-tree-termination.test.tssrc/shared/child-process/process-tree-termination.tssrc/shared/ephemeral-vm-recipe-process.ts
💤 Files with no reviewable changes (1)
- src/shared/child-process/process-tree-kill-observer.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
…sage agent, and count call sites Two round-5 blocking findings, both open on main and on both branches. `killSourceControlAgentProcess` had no root-kill fallback on its win32 arm: the taskkill was the only termination, so once the own-Chromium gate could refuse it the promise resolved having killed nothing. Both callers do `terminationComplete ??= killSourceControlAgentProcess(child)` and then release the managed-home lock on that promise, so a refusal left the local Codex/Claude commit-message agent running while the caller reported it stopped -- the lock-contention failure the taskkill was added for. Same fix as the six sibling sites: the handle-addressed root kill cannot reach the recycled pid the refusal is about, so it stays correct and required on that path. The ratchet was file-granular, not call-site granular: one gate mention anywhere in a file exempted every taskkill in it, which left the six files that now ask the gate ratchet-blind -- the inverse of what it is for. It now counts `/pid` call sites against gate admissions per file, so a second ungated kill inside an existing family fails. Keying on the `/pid` argument rather than a quoted `taskkill` also catches a kill whose program name comes from a constant. The three comments that claimed more than the old scan enforced now state the rule and its two remaining blind spots. Also: the recording in `admitSelfInitiatedTreeKill` is now wrapped the way the `admitProcessTreeKill` seam already wraps it, with the refusal decision taken before anything that can throw so a diagnostics failure cannot flip it; and `orca-chromium-process-pids` documents the false-positive direction (a stale `getAppMetrics()` entry plus pid reuse refuses a live unrelated child), which is the mechanism the root-kill fallback exists to bound. Tests: refusal now asserts the root kill at all seven sites; the ratchet asserts call-site counting and the constant-program form.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 0652ef50-06be-4323-ab3f-7ad7ce8f6a0e
📒 Files selected for processing (6)
src/main/crash-reporting/self-initiated-tree-kill-log.tssrc/main/main-process-tree-kill-gate.test.tssrc/main/orca-chromium-process-pids.tssrc/main/own-chromium-tree-kill-guard.tssrc/main/refused-tree-kill-root-termination.test.tssrc/main/text-generation/source-control-local-process.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/main-process-tree-kill-gate.test.ts
- src/main/crash-reporting/self-initiated-tree-kill-log.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
| if (readOrcaChromiumProcessPids().has(target.pid)) { | ||
| recordRefusedOwnChromiumTreeKill(target) | ||
| return false | ||
| const isOwnChromiumPid = readOrcaChromiumProcessPids().has(target.pid) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings
Length of output: 21303
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- target file ---'
cat -n src/main/own-chromium-tree-kill-guard.ts
printf '%s\n' '--- directly bound symbols and callers ---'
rg -n -C 4 \
'readOrcaChromiumProcessPids|terminateWindowsProcessTree|own-chromium-tree-kill-guard|taskkill|target\.pid|isOwnChromiumPid' \
src package.json
printf '%s\n' '--- relevant platform/process declarations ---'
rg -n -C 5 \
'function (readOrcaChromiumProcessPids|terminateWindowsProcessTree)|const (readOrcaChromiumProcessPids|terminateWindowsProcessTree)|export .*readOrcaChromiumProcessPids|export .*terminateWindowsProcessTree|exec(File|Sync)|spawn(Sync)?|CreateToolhelp32Snapshot|OpenProcess|creation.?time|GetProcess' \
srcRepository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- target file ---'
cat -n src/main/own-chromium-tree-kill-guard.ts
printf '%s\n' '--- symbol definitions and uses in src/main ---'
rg -n -C 8 \
'readOrcaChromiumProcessPids|terminateWindowsProcessTree|isOwnChromiumPid|taskkill|target\.pid' \
src/main
printf '%s\n' '--- candidate files ---'
rg --files src/main | rg 'chromium|kill|process|pty'Repository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- files defining the relevant operations ---'
rg -l \
'terminateWindowsProcessTree|readOrcaChromiumProcessPids' \
src/main \
| sort -u
printf '%s\n' '--- Windows termination definitions ---'
rg -n -B 12 -A 45 \
'^(export )?(async )?function terminateWindowsProcessTree|^(export )?const terminateWindowsProcessTree|terminateWindowsProcessTree\s*=' \
src/main
printf '%s\n' '--- Chromium PID implementation ---'
rg -n -B 8 -A 80 \
'^(export )?(function|const) readOrcaChromiumProcessPids|readOrcaChromiumProcessPids\s*=' \
src/main/orca-chromium-process-pids.tsRepository: stablyai/orca
Length of output: 5132
Bind admission to process identity, not only the PID value.
admitSelfInitiatedTreeKill checks readOrcaChromiumProcessPids() once, then terminateWindowsProcessTree passes the PID to asynchronous taskkill. If Windows reuses the PID for Chromium before taskkill runs, taskkill /T /F can terminate that Chromium process. Use a process handle, creation-time identity, or equivalent revalidation.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Own-Chromium gate extended to six more families.
git-command-tree-kill,notebook-cell-timeout, andautomation-precheck-timeoutgate via a directadmitSelfInitiatedTreeKill;codex-app-server-session-deadline,run-process-tree, andephemeral-vm-recipegate via the renamedadmitProcessTreeKillseam (the deletedprocess-tree-kill-observer.ts/notifyProcessTreeKillvoid path). - A refused kill no longer leaks the root it owns. All six refusal arms now fall back to a handle-addressed
child.kill(), which — viauv_process_killusing the Windows process HANDLE, a no-op once_handleis nulled at exit — structurally cannot reach the recycled pid the refusal is about. - Ring eviction no longer self-evicts.
evictOneSelfInitiatedTreeKillexcludes the just-recorded entry (index < lastCandidate) and degrades to plain FIFO once every candidate is pid-addressed. - Choke-point ratchet.
main-process-tree-kill-gate.test.tsstring-scanssrc/main/src/shared/src/cli/src/relayfor pid-addressedtaskkilland requires the gate, backed by a shrinking allowlist and real refusal tests for the four previously textual-only gates.
I verified the eviction logic against the three new ring tests (pid-addressed survives a group burst, newest teardown survives a pid-saturated ring, all-pid ring evicts oldest not newest), confirmed the handle-addressed-kill safety claim against libuv/Node child.kill() semantics, and checked the allowlist entries — the two browser-route probe launchers are genuinely reachable only from *.electron.test.ts fixtures, and the CLI/relay entries run on hosts with no Chromium pids to protect. The disclosed trade-offs (ratchet is string-contain not call-graph, getAppMetrics() now also on the POSIX arm, refusal orphaning descendants, no age-based trimming) are accurately documented in the body and appropriately scoped as follow-ups rather than defects.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (delta since the prior pullfrog review at 8fc8aa2)
- Ratchet is now call-site granular.
main-process-tree-kill-gate.test.tscounts/pidkill sites against gate admissions per file (ungatedKillSiteCount), keyed on the/pidargument literal rather than a quoted program name, so a second ungated taskkill in an already-gated file is caught and ataskkillspawned through a constant/variable is seen. Two new unit cases pin both shapes. - Seventh refusal fallback.
killSourceControlAgentProcessnowawaits the gatedterminateWindowsProcessTreeon win32 and then falls through to a handle-addressedchild.kill('SIGKILL'), so a refused tree walk no longer resolves having killed nothing and leaking the managed-home lock.refused-tree-kill-root-termination.test.tsadds the matching case (red against the old arm) plus theexecFileMockwiring. - Exception-safety on the guard.
admitSelfInitiatedTreeKilltakes the refusal decision (isOwnChromiumPid) before anything that can throw, wraps only the recording calls in atry/catch, and returns!isOwnChromiumPid, so a diagnostics failure can no longer flip or propagate into a termination. - Doc corrections.
orca-chromium-process-pids.tsand the guard/module comments now state the false-positive direction ofgetAppMetrics()and the two remaining ratchet blind spots.
I re-verified the counting against every production /pid site: all eight main-process families show sites == admissions, the three allowlisted main/shared/cli/relay entries still legitimately lack the gate, and the two shared seam files (process-tree-termination.ts, ephemeral-vm-recipe-process.ts) balance via admitProcessTreeKill. The win32 fall-through (taskkill then child.kill('SIGKILL')) is a no-op on the already-reaped root and the correct root kill on refusal; the two disclosed blind spots (an ungated kill paired with a second admission of an already-gated one, and a /pid argument built from a variable) are accurately documented rather than hand-waved.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
… trees Nothing on this branch had ever executed on Windows. The unit tests pin the gate's decision against a mocked taskkill, which cannot show that the decision does anything to a real process: that `/T /F` reaps a detached grandchild, that a refusal leaves that tree standing, or that the handle-addressed root kill the refusal path falls back to reaps the root while orphaning descendants. Adds a win32-gated live test covering all four, registered in both the `package_windows` CI lane and `WINDOWS_PACKAGE_TESTS` as `win32-test-lane-registration` requires. Also completes the coverage doc's "never instrumented" list, which omitted the macOS keyboard-input-source probe's POSIX group kill in `ipc/app.ts`.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: adaa23a5-dd56-4239-a5b4-ac97d44a9504
📒 Files selected for processing (4)
.github/workflows/pr.ymlconfig/scripts/pr-code-change-scope.mjssrc/main/crash-reporting/self-initiated-tree-kill-log.tssrc/main/windows-live-tree-kill.win32.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/crash-reporting/self-initiated-tree-kill-log.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| const { child, rootPid, leafPid } = await spawnLiveTree() | ||
| orcaChromiumPids = [rootPid] | ||
|
|
||
| await expect(signalProcessTree(child, 'SIGKILL')).resolves.toBe(false) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve descendant survival after a refused signalProcessTree call.
The Windows job fails at Line 161 because leafPid is dead after this call resolves false. A refusal must terminate only the owned root handle. It must not run a PID-addressed tree kill after refusal. Fix the refused signalProcessTree path instead of weakening the descendant-survival assertion.
Source: Pipeline failures
… arm The first Windows run of this branch found nine failures the macOS suite cannot see: `commit-message-text-generation-test-harness` asserts `expect(child.kill).not.toHaveBeenCalled()` on `process.platform === 'win32'`, which is the contract the previous commit deliberately replaced — and it branches on the real platform, so it is dead code everywhere CI runs today. The harness now asserts the handle-addressed root kill on every platform. On win32 it lands after the tree walk, so the expectation waits rather than reading one tick early, and its ten call sites await it. Red against the pre-fix arm at all seven sites; the production code is unchanged.
There was a problem hiding this comment.
Important
The new Windows-lane spec uses a raw recursive rmSync, which fails the repo's own windows-lane-tree-removal-boundary.test.ts ratchet (reproduced locally) and will fail CI — see the inline comment.
Reviewed changes (delta since the prior pullfrog review at 9bac44e)
- Added a live Windows process-tree test.
windows-live-tree-kill.win32.test.tsspawns a real node root whose grandchild writes its pid to disk, then pins the admitted/refused arms of bothterminateWindowsProcessTreeandsignalProcessTreeagainst a realtaskkill— including the recorded-kill assertion on the admitted path and the orphaned-descendant asymmetry on the refusal path. - Registered the spec in both Windows-lane lists. The workflow's
Test Windows-specific boundariesargv andWINDOWS_PACKAGE_TESTSinpr-code-change-scope.mjs, so thewin32-test-lane-registrationratchet stays satisfied. - Corrected the coverage doc.
self-initiated-tree-kill-log.tsnow lists the macOS keyboard-input-source probe'sprocess.kill(-pid)group kill inipc/app.tsunder the "never instrumented" arm.
ℹ️ Nitpicks
- The new test's comments (
:21-24,:73) call the grandchild "detached", but neither the root ({ stdio: 'ignore', windowsHide: true }) nor the leaf ({ stdio: 'ignore' }) is spawned withdetached: true. It is a plain grandchild. The mechanism the test pins (taskkill /T /Fwalking the parent-child tree) is unaffected, but the wording overstates the setup.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Reviewed changes (delta since the prior pullfrog review at 2433010)
- Fixed the commit-message harness's win32 arm.
createChildTerminationExpectationno longer assertschild.killwas not called on win32 (the contract9bac44ereplaced). It now asserts the handle-addressed root kill on every platform, usingvi.waitForon win32 where the kill lands after the awaited tree walk, with the tree-walk mock still checked synchronously. - Awaited all ten
expectChildTerminatedcall sites. The cancellation, local-subprocess, and model-discovery tests nowawaitthe now-async helper, matching its newPromise<void>return.
No new issues found in this delta. I re-ran the three text-generation suites (29 tests) and they pass. The vi.waitFor under the fake-timer tests is safe here because vitest's vi.waitFor runs on real timers, and the win32-only test that sets process.platform manually does not route through expectChildTerminated.
The previously posted blocking finding — the raw recursive rmSync at src/main/windows-live-tree-kill.win32.test.ts:118 — is unaffected by this commit and remains open, so the PR is still not mergeable until that is addressed.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…e retrying helper The new win32 spec teardown used a raw rmSync, which the windows-lane-tree-removal boundary ratchet rejects — and which is exactly the EPERM the ratchet exists to prevent, since this spec's marker directory is written by processes it has just force-killed.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (delta since the prior pullfrog review at 376853a)
- Replaced the raw recursive
rmSyncteardown with the retrying helper.windows-live-tree-kill.win32.test.tsnow removes its marker directory throughremoveTreeSyncfrom../shared/windows-transient-lock-removalinstead of a rawrmSync(markerDirectory, { recursive: true, force: true }), closing thewindows-lane-tree-removal-boundary.test.tsratchet failure the previous review flagged as blocking.
I confirmed the offending call and its rmSync import are both gone, the new removeTreeSync import resolves to the repo's retrying helper (which carries maxRetries: 8 for the late Windows handle release this teardown can hit), and the boundary ratchet now passes (5 passed). No other files or behavior changed in this commit.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…the handle-less codex site The own-Chromium gate refused the POSIX process-group arm of signalProcessTree as well, which was new macOS/Linux behaviour: a stale getAppMetrics() entry plus pid reuse would orphan a group that main reaps today. A POSIX group only holds what Orca put in it, so the refusal is now scoped to win-taskkill-tree and the POSIX arm is recorded and admitted like the other group kills in main. That also drops the synchronous getAppMetrics() read from every POSIX termination. codex-turn-added-roots kills roots found by a table walk, so a refusal has no handle to fall back to. Pin that the refusal is visible - crumb written, turn reported as not cancelled - rather than fixing what cannot be fixed.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (delta since the prior pullfrog review at b460160)
- Scoped the own-Chromium refusal to the pid-addressed scope.
admitSelfInitiatedTreeKillnow refuses onlywin-taskkill-tree; the POSIXprocess.kill(-pid)arm ofsignalProcessTreeis recorded and admitted like every other group kill in main. A stalegetAppMetrics()entry can no longer orphan a macOS/Linux process group, and the synchronous read is short-circuited off every POSIX termination. - Disclosed the handle-less codex site.
codex-turn-added-rootsfinds its roots by a process-table walk rather than a spawn, so a refusal has no child handle to fall back to. The commit documents this incodex-structured-turn-processes.tsand pins that a refusal stays visible (crumb written, turn reported as not cancelled) instead of resolving as if the tree had gone. - Split the shared-choke-point test and added the handle-less case. The POSIX arm now asserts group signaling (resolves
true,process.kill(-pid)invoked,child.killuntouched) plus the recordedself_tree_killcrumb withscope: 'posix-process-group', and a new test drivesterminateCodexTurnProcessesthrough a refused added root.
I verified the scope gating against every gate caller: all six direct admitSelfInitiatedTreeKill sites pass win-taskkill-tree, so pid-addressed taskkills are still refused on Windows, while win-pty-job never reaches the gate (record-only) and posix-process-group is only routed through signalProcessTree. The new target.scope === 'win-taskkill-tree' guard now matches isPidAddressedTreeKill exactly, so the refusal set and the discriminating selfInitiatedTreeKillCount field stay aligned. Ran the three affected suites (26 tests) green.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…-tree-kill-choke-point # Conflicts: # src/main/orca-chromium-process-pids.ts # src/main/own-chromium-tree-kill-guard.test.ts
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (delta since the prior pullfrog review at 38ab4ea)
- Merged
origin/main. The single new commit is a merge bringing main's crash-reporting work — including #18578, which adds theown_chromium_pids_unreadablecoalesced crumb viarecordUnreadableOwnChromiumMetrics— onto the branch. - Resolved the two conflicts correctly.
orca-chromium-process-pids.tskeeps the branch's "the other direction is real too" false-positive note alongside main's "why failure stays open" comment and the new recorder, andown-chromium-tree-kill-guard.test.tskeeps the branch's codex app-server deadline cases plus main'sleaves prooffail-open case.
I verified the conflict resolution is a faithful union of both sides (no markers left, no content dropped), that admitSelfInitiatedTreeKill still takes its refusal decision before anything can throw and now records the unreadable-metrics crumb only on the fail-open arm, and re-ran the ratchet, guard, refused-root, self-kill-log, and shared choke-point suites (44 tests) green.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (delta since the prior pullfrog review at 042f0d0)
- Detached the Windows survival fixture.
spawnLiveTreenow spawns the grandchild withdetached: true, windowsHide: true, so a root-handle kill can no longer reap the leaf through libuv job ownership. This is the fix for the Windows CI flake, and it makes the test's "detached grandchild" wording accurate. - Observed real spawns via the
child_processdiagnostics channel. The suite subscribes/unsubscribesobserveSpawnper test and now asserts the refusedsignalProcessTreespawns zero processes while the admitted arm spawns the realtaskkill(spawnfile === 'taskkill'), so neither arm is a mocked pass-through anymore. - Stabilized the refusal-survival assertion. Both refusal tests
await sleep(250)after root exit before asserting the leaf survived, letting root-owned job cleanup finish.
Production code is unchanged by this commit; the delta is confined to windows-live-tree-kill.win32.test.ts. I confirmed the file collects cleanly (4 tests, describe.skip on Linux), the ChildProcess value import and diagnostics-channel plumbing typecheck, and the prior review's "detached" wording nit is now substantively accurate rather than softened.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…and stop a refusal leaking the root (stablyai#18459) * fix(crash-reporting): make the own-Chromium gate a real choke point Round-3 review found the guard was not the choke point its own comments claimed: six pid-addressed `taskkill /pid <pid> /t /f` families in main were ungated and uninstrumented, so the stale-pid shape stayed producible and a `selfInitiatedTreeKillCount: 0` could read as exculpatory when it was not. - Gate the remaining main-process families: the git command-runner abort, the notebook-cell and automation-precheck timeouts. - Turn the `src/shared` seam into the gate itself (`process-tree-kill-gate`), so the runProcess choke point, the codex app-server deadline kill and the ephemeral-VM recipe kill ask the same decision. Those three are compiled into the CLI/relay too and cannot import main; main installs the guard at preflight. - Ratchet (`main-process-tree-kill-gate.test.ts`): a new pid-addressed taskkill in main that skips the gate fails, and the allowlist entries must still exist. - Give pid-addressed kills eviction priority in the 32-entry ring: 32 routine `win-pty-job` teardowns from a window-close burst no longer evict the one entry that discriminates a self-kill from an external one. - Correct the coverage doc, which described the uninstrumented Windows sites as POSIX `process.kill(-pid)` group kills and omitted the git and codex paths. * fix(crash-reporting): keep a refused tree-kill from leaking the root it owns A refusal must block the pid-addressed tree walk, not the termination. Five of the six gated sites returned on refusal with no fallback, so a refused `taskkill /pid /t /f` left git.exe, a timed-out notebook cell, an automation precheck or an ephemeral-VM recipe running while the caller reported it stopped. The root kill is addressed by the child handle, which cannot reach the recycled pid the refusal is about, so it stays correct and required on that path. Also fixes the ring eviction the scope preference introduced: with the ring saturated by pid-addressed kills, the only non-pid-addressed entry is the one just pushed, so the splice evicted itself and the detail came back `{}` -- byte-identical to the external-kill arm, in the window-close case the guard exists for. Eviction now excludes the newest entry and falls back to FIFO. Tests: refusal now asserts the root kill at all six sites, and the ring covers the saturated-pid ordering as well as round 3's group-burst ordering. * fix(crash-reporting): stop a refused tree-kill leaking the commit-message agent, and count call sites Two round-5 blocking findings, both open on main and on both branches. `killSourceControlAgentProcess` had no root-kill fallback on its win32 arm: the taskkill was the only termination, so once the own-Chromium gate could refuse it the promise resolved having killed nothing. Both callers do `terminationComplete ??= killSourceControlAgentProcess(child)` and then release the managed-home lock on that promise, so a refusal left the local Codex/Claude commit-message agent running while the caller reported it stopped -- the lock-contention failure the taskkill was added for. Same fix as the six sibling sites: the handle-addressed root kill cannot reach the recycled pid the refusal is about, so it stays correct and required on that path. The ratchet was file-granular, not call-site granular: one gate mention anywhere in a file exempted every taskkill in it, which left the six files that now ask the gate ratchet-blind -- the inverse of what it is for. It now counts `/pid` call sites against gate admissions per file, so a second ungated kill inside an existing family fails. Keying on the `/pid` argument rather than a quoted `taskkill` also catches a kill whose program name comes from a constant. The three comments that claimed more than the old scan enforced now state the rule and its two remaining blind spots. Also: the recording in `admitSelfInitiatedTreeKill` is now wrapped the way the `admitProcessTreeKill` seam already wraps it, with the refusal decision taken before anything that can throw so a diagnostics failure cannot flip it; and `orca-chromium-process-pids` documents the false-positive direction (a stale `getAppMetrics()` entry plus pid reuse refuses a live unrelated child), which is the mechanism the root-kill fallback exists to bound. Tests: refusal now asserts the root kill at all seven sites; the ratchet asserts call-site counting and the constant-program form. * test(crash-reporting): run the own-Chromium gate against real Windows trees Nothing on this branch had ever executed on Windows. The unit tests pin the gate's decision against a mocked taskkill, which cannot show that the decision does anything to a real process: that `/T /F` reaps a detached grandchild, that a refusal leaves that tree standing, or that the handle-addressed root kill the refusal path falls back to reaps the root while orphaning descendants. Adds a win32-gated live test covering all four, registered in both the `package_windows` CI lane and `WINDOWS_PACKAGE_TESTS` as `win32-test-lane-registration` requires. Also completes the coverage doc's "never instrumented" list, which omitted the macOS keyboard-input-source probe's POSIX group kill in `ipc/app.ts`. * fix(crash-reporting): pin the commit-message root kill on the Windows arm The first Windows run of this branch found nine failures the macOS suite cannot see: `commit-message-text-generation-test-harness` asserts `expect(child.kill).not.toHaveBeenCalled()` on `process.platform === 'win32'`, which is the contract the previous commit deliberately replaced — and it branches on the real platform, so it is dead code everywhere CI runs today. The harness now asserts the handle-addressed root kill on every platform. On win32 it lands after the tree walk, so the expectation waits rather than reading one tick early, and its ten call sites await it. Red against the pre-fix arm at all seven sites; the production code is unchanged. * test(crash-reporting): remove the Windows lane marker tree through the retrying helper The new win32 spec teardown used a raw rmSync, which the windows-lane-tree-removal boundary ratchet rejects — and which is exactly the EPERM the ratchet exists to prevent, since this spec's marker directory is written by processes it has just force-killed. * fix(crash-reporting): only refuse pid-addressed tree walks, disclose the handle-less codex site The own-Chromium gate refused the POSIX process-group arm of signalProcessTree as well, which was new macOS/Linux behaviour: a stale getAppMetrics() entry plus pid reuse would orphan a group that main reaps today. A POSIX group only holds what Orca put in it, so the refusal is now scoped to win-taskkill-tree and the POSIX arm is recorded and admitted like the other group kills in main. That also drops the synchronous getAppMetrics() read from every POSIX termination. codex-turn-added-roots kills roots found by a table walk, so a refusal has no handle to fall back to. Pin that the refusal is visible - crumb written, turn reported as not cancelled - rather than fixing what cannot be fixed. * test(crash-reporting): detach the Windows survival fixture and observe real spawns

Windows CI failure resolved on awin
Commit
a205c896c55fixes the live-test fixture; production code is unchanged. The fixture called its leaf detached but spawned it withoutdetached: true. On Windows, root-handle termination can also reap that non-detached leaf through libuv job ownership. Immediate liveness checks could beat that cleanup and pass, while Windows CI observed the leaf already gone.The leaf is now genuinely detached. Both refusal tests wait 250 ms after root exit before checking survival. A Node diagnostics-channel observer confirms the refused shared call spawns zero processes and the admitted call spawns the real
taskkill; neither path is mocked.Validation through Orca CLI on
awin(Windows, Node 24.18.0, locked Vitest 4.1.11):detached: truefrom the strengthened test produces 2 failures / 2 passes; restoring it produces 4 passes.This addresses CodeRabbit's descendant-survival CI comment without weakening the assertion or changing the production refusal path. The previous four-seat readiness review and blind peer ratings found no proven P0/P1 production regression. Its P2 scanner limitation and non-atomic PID admission risk remain disclosed below.
What
Follow-up to #18367, which merged without this work. #18367 merged at head
2d0c627ba08; the commit its body credited with closing all three round-3 blocking findings (9db1b4ce6ef) was committed 87 minutes after the merge and is not an ancestor ofmain. This PR ships that commit, rebased onto currentmain, plus the fixes for the three round-4 blocking findings. #18367's body has been corrected to describe only what it actually merged.Two things, then.
1. Make the own-Chromium gate an actual choke point (
9db1b4ce6ef, unchanged from its review except where round 4 required). #18367 shipped the gate wired into three families. Six more pid-addressedtaskkill /pid <pid> /t /ffamilies reachable from Electron main were ungated:git-command-tree-killsrc/main/git/command-runner/spawned-command-tree-kill.tsnotebook-cell-timeoutsrc/main/ipc/notebook.tsautomation-precheck-timeoutsrc/main/automations/precheck-runner.tscodex-app-server-session-deadlinesrc/main/codex/codex-app-server-session.tsrun-process-treesrc/shared/child-process/process-tree-termination.tsephemeral-vm-recipesrc/shared/ephemeral-vm-recipe-process.tsThe first three import
admitSelfInitiatedTreeKilldirectly. The last three are compiled into the CLI and relay as well, so they reach the same guard through theprocess-tree-kill-gateseam (renamed fromprocess-tree-kill-observer, notify/void → admit/boolean) that main installs at preflight; on every other host it admits unconditionally.src/main/main-process-tree-kill-gate.test.tsis the ratchet that keeps the set closed.2. Round-4 fixes (
8fc8aa22646), both of which are defects introduced by the round-3 remediation itself:A refused kill no longer leaks the root it owns. Five of the six newly gated sites returned on refusal with no fallback, contradicting #18367's stated invariant that
killRoot()still runs regardless.exec-file-capture.tswould resolve the abort/timeout whilegit.exeand itsgit-remote-https.exedescendants kept running against the repo; a timed-out notebook cell or automation precheck would be reported as stopped with its tree alive. All six now kill the root on the refusal path. The distinction that makes this safe: the gate refuses a pid-addressed tree walk, and the root kill is addressed by the child handle —uv_process_killuses the Windows process HANDLE and is a no-op once Node has nulled_handleat exit — so it structurally cannot reach the recycled pid the refusal is about. The gate's doc comments now say "must not walk that pid's tree", not "must not kill", because the old wording is what five sites read.The ring eviction no longer evicts the entry it just recorded. Round 3 replaced FIFO with a scope preference: evict the oldest non-pid-addressed kill first, so a window-close burst of group kills cannot drop the one entry that can explain a death. With the ring already saturated by pid-addressed kills the only non-pid-addressed element is the group kill just pushed at the tail, so
spliceremoved it. That is reachable in an ordinary session — six routine families feed the ringwin-taskkill-treeentries (pty-descendant-sweepon every Windows terminal close with an owned root,git-command-tree-killon every aborted or timed-out git command,run-process-tree,codex-turn-added-roots,codex-rate-limit-probe,source-control-text-generation) and there is no age-based trimming. Eviction now excludes the newest entry and falls back to plain FIFO once every candidate is pid-addressed.3. Round-6: the first Windows run (
24330104f43,376853aa526). Every earlier round disclosed that none of this had ever executed on Windows. It has now, on a real Windows 11 host (win32 x64, Node 24.18.0), and it found a defect no macOS run can see.commit-message-text-generation-test-harness.tsbranches on the realprocess.platform, and its win32 arm assertedexpect(child.kill).not.toHaveBeenCalled()— precisely the contract9bac44ee970replaced when it stopped a refused tree kill leaking the commit-message agent. On macOS and Linux that arm is dead code, so the suite stayed green while the branch's own Windows behaviour was pinned to the old contract. On Windows it was nine failures across three files. The harness now asserts the handle-addressed root kill on every platform, waits for it (on win32 it lands after the tree walk, so a synchronous read is a tick early), and its ten call sites await it. Production code is unchanged by that commit.Alongside it,
src/main/windows-live-tree-kill.win32.test.tsruns the gate against real Windows process trees rather than a mockedtaskkill, and is registered in thepackage_windowsCI lane andWINDOWS_PACKAGE_TESTSaswin32-test-lane-registrationrequires. It is the durable form of this round: the next change to the gate cannot repeat this.Fix evidence
The three round-4 blocking findings
1. #18367 merged without
9db1b4ce6ef. Verified, not disputed:Zero occurrences in the six families above, and
process-tree-kill-observer.ts(notify/void) is still whatmaincarries. The merge was a squash off05863afaf0..2d0c627ba08, so this branch is that squash's tail cherry-picked onto currentmain— it applied clean.2. Refusal-path leak — red without the fix, at all six sites.
src/main/refused-tree-kill-root-termination.test.tsdrives each gated site withapp.getAppMetrics()reporting the target pid, and asserts both thattaskkillwas never spawned and that the root was killed:3. Ring self-eviction — red without the fix, using the reviewer's exact probe. 32
win-taskkill-tree/pty-descendant-sweepentries atgoneAt−600s..−568s, then onewin-pty-job/windows-pty-job-teardownatgoneAt−50ms:undefinedisselfInitiatedGroupKillCountabsent — the detail came back{}, byte-identical to the external-kill arm, which is the exact false clean round 3 blocked with the roles reversed. Both round-3's ordering (1 pid-addressed then 32 group) and round-4's (32 pid-addressed then 1 group) are now asserted, plus a third test pinning that a saturated all-pid ring evicts the oldest entry and not the newest.Suites, typecheck, lint
No
max-linessuppression was added anywhere.On a real Windows host
awin, Windows 11,win32 x64, Node 24.18.0, at pushed HEAD376853aa526:The four live cases, against real detached process trees:
The two remaining failures are pre-existing and not this branch's, proven on the same host:
Both are argv/PATH-resolution expectations written for POSIX (
cursor-agentvs its resolved absolute path). They fail identically atorigin/main.The regression this round fixed was, before the fix, eleven failures on that host and nine attributable to this branch; reverting only
source-control-local-process.tstoorigin/maindropped it to the same two.Explicitly NOT proven
vitestagainst a real Windows 11 host, including real process trees and a realtaskkill /T /F. It is not a packaged app, so the gate has still never refused a kill aimed at a genuine Chromium pid in a running Orca — thegetAppMetrics()set is stubbed in every case. Rebuilding native deps failed on that host (node-gyp), so nothing needingnode-ptyorwindows-process-treeran there either.git-admission-storm-measurement.test.tsfails on this machine, at this HEAD and with every change on this branch stashed, withENOENT: scandir '/var/folders/.../orca-git-storm-disabled-*/state'after a 5s timeout. Environmental, pre-existing, and independently reproduced at merge-base by the reviewer.refused-manual-run.test.tsandgh-spawn-boundary.test.tsfail only under parallel load and pass in isolation.app.getAppMetrics()cost per force-kill on Windows. Measured on macOS only: 268 µs/call in Electron 43.4.1 with 6 metrics entries (3 hidden windows, 2000 warm calls; harness in the de-risk report). It is a synchronous call in main, so a Windows PTY close pays two of them (~0.5 ms); the Windows number itself is still unmeasured. After the de-risk commit the read no longer runs on macOS/Linux at all — see Trade-off 2.ELI5
Orca constantly starts little helper programs in the background on your behalf — running a check, fetching from a server, running a notebook cell, writing a commit message. When one of those hangs, times out, or you cancel it, Orca has to shut it down, and it has to shut down anything that helper itself started, or you get invisible leftovers chewing up your machine.
On Windows, Orca shuts those helpers down by their number. The problem is that Windows recycles numbers. So there is a real chance that the number Orca is about to reach for has quietly been handed to one of Orca's own windows — and Orca ends up shutting itself down. To you that looks like Orca crashing for no reason, with nothing in the report to say why.
So Orca learned to ask one question first: "wait, is that number one of mine?" If it is, back off. That question already existed, but it had only been wired into three of the nine places where Orca shuts a helper down. This change wires it into the rest, and adds an automatic check so that nobody can add a tenth place in future without wiring it in too.
Two things about backing off also needed fixing:
Backing off was doing too much. At most of those places, backing off meant doing nothing at all — so Orca would tell you the helper was stopped while it was actually still running in the background. In one case it also let go of a lock that other work was queued behind, so that work could start while the old helper was still going. The right behaviour is narrower. Orca should refuse to do the sweep ("that number, and everything underneath it, whatever that turns out to be"), but should still shut down the one program it is personally holding onto — that part can't hit the wrong thing, because Orca is holding it directly rather than looking it up by number. That's what it does now. The honest cost: anything that helper had itself started is left running instead of being cleaned up. That's a leftover, but a much smaller one than before, and much safer than the alternative.
Orca's notes about what it did were getting thrown away. Orca keeps a short list of the last 32 things it shut down, so that if it crashes moments later the report can say "actually, that was me". Closing a window can produce thirty entries at once, which would push the one useful entry off the end of the list. The list now keeps the entries that could actually explain a crash instead of blindly dropping the oldest one — including, importantly, the one written a split second ago.
Finally: none of this had ever actually been run on Windows, which is the only place any of it matters. It has now, on a real Windows machine, and that run immediately caught a mistake that was impossible to see on a Mac. Windows is now part of the automatic checks for this code, so the next change can't skip it.
Merge Risk
LOW. Both fixes make refused or evicted paths more conservative, and both are pinned by tests that are red without them.
child.kill()on a path that previously did nothing. It cannot reach a Chromium process: the call is handle-addressed, and after exit Node has nulled_handleand it is a no-op.signalProcessTree's two refusal arms now mirror the reaped-pid skip immediately above them exactly —killRoot(child, signal)then resolvefalse— so the termination barrier's meaning is unchanged.terminateNotebookProcessTree,killLocalPrecheckProcessTree,killRecipeProcess) are exported so the refusal path is reachable from a test; each carries a one-line comment saying so. No call sites changed.main-process-tree-kill-gate.test.tsrequires, per file, that gate admissions be at least the number of/pidcall sites (ungatedKillSiteCount), keyed on the/pidargument rather than the program name so ataskkillspawned through a constant or variable is still counted. Two blind spots remain, both stated in the test's own header and unit-tested where testable: a file that pairs an ungated kill with a second admission of an already gated one, and a kill whose/pidargument is itself built from a variable. Resolving each site to its enclosing function (Follow-up 1) is what closes the first. Four sites sit on a shrink-only allowlist, each with a stated reason: the two browser-route Electron probes insrc/main(reached only from*.electron.test.ts, and they kill the probe Electron they spawned), plussrc/cli/handlers/interactive-login-interruption.tsandsrc/relay/subprocess-tree-termination.ts, which run on hosts with no Orca Chromium pid to reach and no reader for the ring.selfInitiatedTreeKillCounthas a routine base rate. Every aborted or timed-out git command on Windows emitswin-taskkill-tree, andkillSpawnedCommandTreehas 14 call sites. TheselfInitiatedKillssite string separates them; the count alone does not. fix(crash-reporting): record Orca-initiated tree kills so a killed renderer is decidable #18367's body claimed both "this is the discriminating field" and, in Merge Risk, that "the count alone is not the clean discriminator the body describes" — the corrected body keeps only the second.app.getAppMetrics()is still read twice per Windows PTY close (windows-pty-root-identity.ts:150default arg, then again insideterminateWindowsProcessTree).Trade-offs
The refusal fallback is a deliberate asymmetry. A refused site kills its root but not its tree, so descendants of a refused target are orphaned rather than reaped. That is strictly better than today's two options — leaking the whole tree (the bug) or running a pid-addressed sweep against a pid we just decided is suspect (the thing the gate exists to stop) — but it is not "nothing was leaked".
codex-accounts/service.tsalready had exactly this shape and is unchanged.One gated site has no handle to fall back to:
codex-turn-added-roots(codex-structured-turn-processes.ts). The roots it kills are found by a process-table walk during turn cancellation, not spawned by Orca, so on a refusal nothing is killed and that subtree survives until the app-server exits. This is disclosed rather than fixed, deliberately: the only pid-addressed alternative is the walk the gate just refused. It is not silent — theself_tree_kill_refused_own_chromiumcrumb is written withsite: 'codex-turn-added-roots'and the refused row stays in the post-killremainingset, soterminateCodexTurnProcessesresolvesfalseand the user seescancelled: falsefor the turn.refused-tree-kill-root-termination.test.tspins both. This was undisclosed before the de-risk pass.admitProcessTreeKillruns on the POSIX arm too, but main's gate never refuses it.signalProcessTreeasks beforeprocess.kill(-pid), which onmainwas a record-only observer. An earlier revision of this PR let the own-Chromium check refuse that arm as well — new behaviour on macOS/Linux, where a stalegetAppMetrics()entry plus pid reuse would have orphaned a whole process group thatmainreaps today. The de-risk commit scopes the refusal towin-taskkill-tree: a POSIX group can only contain processes Orca put there, so the arm is recorded and admitted exactly like the other three POSIX group kills in main (claude-login, codex teardown, PTY sweep). Because the scope check short-circuits, the synchronousgetAppMetrics()read no longer happens on any macOS/Linux termination — the cost is Windows-only again, as fix(crash-reporting): record Orca-initiated tree kills so a killed renderer is decidable #18367's Trade-off 2 originally framed it. The seam's POSIX refusal arm stays inprocess-tree-termination.tsas the contract for any future gate, with a test pinning that the installed one does not exercise it.Eviction is preference-ordered, not age-aware. A kill more than 5s old can never explain a later death, so the ring still carries dead weight; the reader filters by window, so this costs memory (32 small objects) rather than correctness. Age-based trimming was the other option the review offered and is the better long-term shape, but it changes what the ring holds rather than only which entry it drops, so it is deliberately not in a remediation PR.
selfInitiatedTreeKillCount = 0still does not mean "not us". Unchanged from fix(crash-reporting): record Orca-initiated tree kills so a killed renderer is decidable #18367's Trade-off 4 and the module doc: the ring is per-process and only Electron main reads it, so daemon, relay and CLI kills record where nothing reads them. What remains uninstrumented after this PR is only the POSIXprocess.kill(-pid, …)group arms of the notebook, precheck, browser-route and ephemeral-VM kills, the relay's and CLI's own taskkills, and the browser-route Electron probes reached solely from*.electron.test.ts.The module doc's coalescing claim was wrong and is corrected. It said "the newest pid still rides the emitted crumb" without qualification. True of the retained in-memory ring entry (
recordCoalescedCrashBreadcrumbstashespending), false of the NDJSON/span trail the same doc calls the thing that survives into the diagnostic bundle —traceDurableBreadcrumbonly fires on the first event of a coalesce window, so a same-site burst emits the first pid. fix(crash-reporting): record Orca-initiated tree kills so a killed renderer is decidable #18367 disclosed this in its body; the shipped comment did not. It does now.No remote wire change, no host-boundary change.
process-tree-kill-gate.tshas zero imports, so the CLI, relay and daemon bundles do not pull main-process code through it. The three new crash-report detail keys are additive optional fields in an existing bag thatsanitizeCrashReportDetailspasses through uncapped, so no capability negotiation is needed and an older client reading a newer bundle ignores them.installMainProcessTreeKillGate()runs beforesetAppEnvironmentin preflight, which is safe becausereadOrcaChromiumProcessPids()readshasAppEnvironment()lazily.Adversarial review
5 round(s). Rounds 1-3 are recorded in #18367. Round 4 reviewed the merged artifact against the merged body and blocked on three findings; all three are closed here. Round 5 blocked on four; see below.
9db1b4ce6efpostdates the merge by 87 minutes and is not an ancestor oforigin/main; the ratchet file is absent there and all six families contain zero references to the gate. fix(crash-reporting): record Orca-initiated tree kills so a killed renderer is decidable #18367's body now carries a correction banner, its "What" section no longer claims the six families or the ratchet, and its three round-3 "FIXED in9db1b4c" entries and two "Done in9db1b4c" follow-ups now point here instead. This PR ships the content.{}in the window-close scenario the 20 G2 reports come from, wheremain's plain FIFO returned the group count plus the pid. Eviction now never considers the newest entry and degrades to FIFO. The reviewer's ordering is a test; so is round 3's, so is the all-pid case.signalProcessTree's POSIX arm was the sixth). The review readclaude-login-process-termination.tsas proof the omission was inconsistency rather than design, and that is right in effect though not in mechanism: claude-login's fallback is legitimate because its refused pid is a relayed login pid that may differ fromchild.pid, sochild.kill()there targets a different process. At the other six the refused pid ischild.pid— which is precisely why the handle-addressed kill is the correct fallback, and why the gate's contract wording needed fixing too.'taskkill'/'/pid'literal pattern (Merge Risk); the doublegetAppMetrics()per PTY close (Merge Risk); age-aware eviction (Trade-off 3). The review's own positive verification — 17 tests red at merge-base76836b30ea6, green at HEAD,tsc×3 andoxlintclean, 524-file sweep with only pre-existing failures — is not restated here.Round 5
origin/mainstill lacks the ratchet and the gate seam, still ships the coverage doc that misdescribes four Windows pid-addressed taskkills as POSIX group kills, and still evicts plain-FIFO." ACCURATE, and this PR is the fix. Both are on this branch already (8598511a2fecorrects the coverage doc;8fc8aa22646makes eviction scope-aware). fix(crash-reporting): record Orca-initiated tree kills so a killed renderer is decidable #18367 is merged and immutable, so the only vehicle is this PR — which is why it exists. Nothing further to do here beyond landing it.killSourceControlAgentProcesshas no root-kill fallback on its win32 arm, so a gate refusal resolves having killed nothing whilemarkProcessClosedreleases the managed-home lock." FIXED (9bac44ee970). Confirmed exactly as reported:terminateWindowsProcessTreewas the only termination on that arm, and both callers (source-control-local-process.ts,commit-message-model-discovery.ts) release the lock on the promise it returns. It is the seventh instance of the class8fc8aa22646fixed at six sites; it was missed because it reaches the taskkill throughterminateWindowsProcessTreerather than spawning its own.refused-tree-kill-root-termination.test.tsnow asserts the root kill at all seven sites; the new case is red against the old arm (expected "vi.fn()" to be called with arguments: [ 'SIGKILL' ]).9bac44ee970), taking the follow-up below early rather than softening the comments. The scan now counts/pidcall sites against gate admissions per file (ungatedKillSiteCount), so the reviewer's own probe — a second ungatedtaskkill /pid /t /fappended towindows-process-tree-kill.ts— now fails the suite. Keying on the/pidargument rather than a quoted'taskkill'also closes the constant/variable program-name hole the review flagged in the same finding; both shapes are unit-tested. The three comments that claimed more than the old scan enforced now state the rule and its two remaining blind spots (a file that pairs an ungated kill with a second admission of an already gated one, and a/pidargument itself built from a variable).9db1b4ce6ef) carries two defects that fix(crash-reporting): make the own-Chromium gate a real choke point, and stop a refusal leaking the root #18459 fixes, so this branch must not be merged." AGREED, and moot. That isnwparker/crash-self-tree-kill-breadcrumb, whose PR (fix(crash-reporting): record Orca-initiated tree kills so a killed renderer is decidable #18367) is already merged; the branch is stale and nothing will be merged from it. Both defects are fixed here, which the review states.admitSelfInitiatedTreeKillnow wraps recording the way theadmitProcessTreeKillseam already did, with the refusal decision taken before anything that can throw so a diagnostics failure cannot flip it); the guard's false-positive direction is now documented inorca-chromium-process-pids.ts, since a stalegetAppMetrics()entry plus pid reuse is the mechanism the root-kill fallback exists to bound.8fc8aa22646; no Windows run at HEAD (Follow-up 3).Round 6
Five findings carried in, each re-verified against this branch rather than #18367.
mainit is wired into only 3 of 9 pid-addressedtaskkill /pid X /t /ffamilies." FIXED here, accurate aboutmain.git grep -n "'/pid'" origin/mainfinds 3 gated of 9 insrc/main; on this branch 7 of 9 are gated and the remaining 2 are the browser-route Electron probes, allowlisted with a stated reason. The ratchet is falsifiable: appending a bare['/pid', String(pid), '/t', '/f']towindows-process-tree-kill.tsfailsmain-process-tree-kill-gate.test.tswith that file named.process.kill(-pid)calls in browser routes, notebooks, prechecks and ephemeral-VM recipes 'never instrumented', but on Windows all four route elsewhere." FIXED, and completed further. The doc already scoped that bullet to the POSIX group arms on this branch, which is true — all four take the gatedtaskkillpath on win32. Re-verifying it exhaustively turned up one omission the finding did not name:readCommandStdoutinsrc/main/ipc/app.tsissues an uninstrumentedprocess.kill(-pid, 'SIGKILL')from Electron main (the macOS keyboard-input-source probe). It is now in the list.index < lastCandidatefloor fromevictOneSelfInitiatedTreeKillreproduces the reviewer's probe exactly:expected undefined to be 1forselfInitiatedGroupKillCount, detail{}, byte-identical to the external-kill arm.source-control-local-process.ts:33has nochild.kill()fallback." FIXED, red without the fix. Restoring the win32returnafterterminateWindowsProcessTreefailsrefused-tree-kill-root-termination.test.tswithexpected "vi.fn()" to be called with arguments: [ 'SIGKILL' ], calls 0. The Windows run then showed the fix was only half-landed: the harness that covers this code path still asserted the old contract on its win32 arm. See finding 5.windows-live-tree-kill.win32.test.tsin thepackage_windowslane.Follow-ups
Carried forward from #18367, unchanged: benchmark
app.getAppMetrics()on the force-kill path; close the non-Chromium half of #10680 (a recycle onto another Orca descendant still classifiesown); make the daemon and relay breadcrumb rings readable; re-file the G2 cluster into its four fingerprints; rewritecrashAttributionwhen a pid-addressed kill matches the dead renderer.New from this round:
SELF_TREE_KILL_LOOKBACK_MS + SELF_TREE_KILL_LOOKAHEAD_MSbehind the newest, so the ring holds only entries that could still explain a death and eviction preference stops mattering.Run the Windows arms at HEAD.Done in round 6 — see "On a real Windows host". What is still open is running them against a packaged Orca, wheregetAppMetrics()returns genuine Chromium pids rather than a stub, and rebuilding native deps on that host so thenode-ptyandwindows-process-treearms can run there too.