Skip to content

test(windows): end the unbound owner control's primary (LEAK row) - #12207

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/windows-leak-owner-control
Nov 1, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
claude/windows-leak-owner-control

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #9564

Acceptance delta (one sentence): The Windows force-terminated-owner test stops both survivors of its unbound control, so nextest no longer reports process_owner::tests::force_terminated_owner_ends_descendants_only_when_bound as LEAK.

What and why

In the sharded Windows advisory run the test passes but nextest flags it LEAK (8.5 s). The unbound control hard-kills the helper owner; the owned primary powershell (Start-Sleep -Seconds 40) survives because the per-child job is not kill-on-close. The test stopped only the descendant, so the primary kept the harness's inherited output pipe for its remaining ~40 s.

The helper now records its own PID (<marker>.primary) before the readiness marker, and the control stops both PIDs. The bound subject case is unchanged.

Evidence

  • cargo check -p ripr --lib --tests --target x86_64-pc-windows-gnu: clean for this change (3 pre-existing unrelated dead-code warnings).
  • cargo xtask precommit: pass.
  • Windows sharded run on this branch dispatched; result to follow on this PR. The leak explanation is a hypothesis until that run shows the row without LEAK.

Generated by Claude Code

…aking the harness pipe (#9564)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vhkd2Rg6pXt3emf3gMBRZF
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 149 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 7cb11dc6-dbbf-4606-a9b2-522cec2fb48e
Commits

Reviewing files that changed from the base of the PR and between ac029f9 and af47b18.

Files selected for processing: 2
  • changelog.d/9564-windows-owner-control-primary-leak.md
  • crates/ripr/src/process_owner.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions github-actions Bot 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.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • The cleanup command trusts PID values read from marker files; if a process exits and Windows reuses its PID, Stop-Process could terminate an unrelated process.
  • If the primary exits between marker publication and Stop-Process, PowerShell may emit a terminating error before stopping the descendant, because both IDs are sent in one Stop-Process command.

Verification questions

  • Confirm several failure paths can return before the spawned primary and descendant are stopped, preserving the pipe-holding LEAK behavior the patch intends to remove.
  • Confirm the test does not assert that the unbound owned primary is terminated; it only stops it as cleanup after asserting the descendant survived.
  • Confirm the Windows test now records and stops the owned primary as well as the descendant, matching the stated cleanup intent.
  • Confirm the helper's primary PID marker is read only after the descendant marker is observed, but the marker write precedes descendant creation.

Parked follow-ups

  • crates/ripr/src/process_owner.rs:925 — The cleanup passes previously recorded PIDs directly to Stop-Process. If either process exits and its PID is reused before cleanup, this can forcibly terminate an unrelated Windows process. Validate the PID's creation time or otherwise identify the owned process before signaling it.

Evidence gaps

  • The PR claims nextest no longer reports a LEAK row, but the required cargo-test receipt is absent and the PR body says the Windows run result will follow.
  • The claimed nextest LEAK fix is not proven by the changed test because cleanup happens after the descendant assertion and failures before cleanup can leave the primary holding the inherited pipe.
  • Model proof intent was rejected by deterministic validation.
  • The PR claim that the LEAK row is resolved is not yet supported by a completed Windows nextest receipt in the supplied evidence.

Copy link
Copy Markdown
Member Author

Sharded Windows run 41322998440 on af47b18 (nextest, windows-advisory):

  • process_owner::tests::force_terminated_owner_ends_descendants_only_when_bound (shard 2): PASS 6.5 s, no LEAK. The prior run on main (fc03675) showed it LEAK at 8.5–9.2 s. This is one run, so the fix is supported, not proven stable.
  • interactive_debounce_fold_tests::overlapping_interactive_triggers_… (shard 4): PASS 0.16 s, no LEAK here. It showed LEAK 0.31 s in an earlier run, so that one is intermittent and not touched by this PR.
  • windows-shard-4 is red only on xtask tests::policy_checker_facade_runs_current_repo_checks (300 s cap), the existing Windows shard: policy_checker_facade_runs_current_repo_checks timed out at 360 s after the nested-build warm-up #12035 nested-cargo failure. Not this PR's (the diff touches process_owner.rs tests and a changelog only), and it fails the same way on main. Shards 1–3 and doctests are green.

On the review's findings: the PID-reuse risk is limited to the 3 s between the hard kill and the cleanup in a test that owns both PIDs just recorded from live children; -ErrorAction SilentlyContinue makes an already-exited PID a non-terminating error, so the other PID is still stopped. Neither justifies more code in a test control. The missing receipt is the run above.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 1, 2026 16:35
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 1 potential issue.

Devin Review

Comment thread crates/ripr/src/process_owner.rs Resolved

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REVIEW_READY — head af47b18

Review of record, independent of the author. The diff is test-only (process_owner.rs mod tests, Windows-gated) plus a changelog fragment. I read the full diff and the hosted Windows run; I could not run the Windows tests locally.

Does it stop the real survivors rather than mask the detector? Yes. In the unbound control the helper is hard-killed, leaving two survivors: the descendant sleeper and the owned primary PowerShell (which keeps the harness's inherited output pipe for its remaining 40 s, the LEAK source). The primary now writes $PID to {marker}.primary before spawning the descendant, and the descendant marker is still written last as the readiness signal, so the primary file is guaranteed present when the helper reads it. Cleanup now passes both PIDs to a single Stop-Process. The control keeps its meaning: leaked is computed from the descendant before any cleanup, and the assert on it is unchanged, so the control still proves an unbound owner leaks. The bound subject still asserts its descendant terminated, unchanged. Nothing about the leak detector or nextest config changes; the test just no longer leaves a process it created. Hosted evidence: run 41322998440 on this exact head, shard 2 shows PASS [6.517s] ... force_terminated_owner_ends_descendants_only_when_bound with no LEAK line in any shard (main showed LEAK at about 9 s). Shards 1–3 and doctests succeed. Shard 4 fails only on xtask tests::policy_checker_facade_runs_current_repo_checks at the 300 s cap, which is the known #12035 shard-timeout class, unrelated to this diff.

Can it kill anything outside the test? Only PIDs the test itself read back from marker files it just created, in temp_dir(), named with the test process's own PID, and removed before the helper starts so a stale file cannot be read. Stop-Process -ErrorAction SilentlyContinue tolerates an already-exited process. The residual risk is PID reuse if a survivor exited and its PID was recycled inside the 3 s window, which is negligible on Windows and the same exposure the existing descendant kill already carried. The bound mode reads its primary PID but discards it (_bound_primary_pid), so it kills nothing extra.

Non-blocking nit: if the primary marker read fails after the descendant marker was seen, the helper is killed but the descendant is left running for its 40 s. That path is already a test failure with an explicit error, so it costs a short leak only on failure.

Hosted Ripr Rust Small on GitHub Hosted / Rust gates was still in progress when I read the check-runs, so Ripr Rust Small Result is not green on this head yet. Merge needs it green on the exact head first.

Disposition: no blocking findings.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants