Skip to content

test(servers): discard interrupted-child profiles and let exiting servers finish theirs (#4978) - #8395

Merged
EffortlessSteven merged 5 commits into
mainfrom
claude/project-thread-f3osai
Oct 17, 2026
Merged

EffortlessSteven merged 5 commits into
mainfrom
claude/project-thread-f3osai

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Before: main's rust-coverage job fails most runs after all tests pass: llvm-profdata merge rejects one truncated ripr-swarm-<pid>-*.profraw ("file header is corrupt", #4978).

After: the two interrupted-run controls in chaos_interrupted_runs.rs give their deliberately terminated ripr check children LLVM_PROFILE_FILE=/dev/null, so a child cut off while writing its profile can no longer leave a truncated file. The parent test binary and every other process keep their profiles; same shape as the accepted #5170 scoping.

How: those tests terminate an instrumented ripr at 0 to 40 ms, which can land inside the exit-time profile write. Local repro with -C instrument-coverage, %p-%m profile names and llvm-profdata show per file: before the change 2 truncated profiles in 11 runs of the test binary; after, 0 in 6 runs. The earlier hypothesis (ripr_help_process_contract fixtures) was refuted: they die while idle and write no profile. Not verified: that this is the only producer (LSP/MCP tests also kill servers in Drop), and the hosted all-features coverage run. Closes nothing in #4978; the issue stays open until main coverage is green over several runs.

Proof: cargo xtask precommit exit 0. chaos_interrupted_runs still passes except doctor_says_when_the_cache_cannot_be_written, which fails as root on this host before and after (permission test).


Generated by Claude Code

… children (#4978)

The interrupted-run controls terminate an instrumented ripr child at 0-40ms,
which can land while it writes its profile at exit. The truncated .profraw
then fails llvm-profdata merge for the whole coverage run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BhjduQtMUKUnheruL7mphH
@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!

@EffortlessSteven EffortlessSteven self-assigned this Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 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 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 68 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
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: f88d9669-5648-44b6-8787-d3d2313803a9
📥 Commits

Reviewing files that changed from the base of the PR and between e7f0377 and c68cb8b.

📒 Files selected for processing: 7
  • crates/ripr/tests/agentic_bench_lsp.rs
  • crates/ripr/tests/agentic_bench_mcp.rs
  • crates/ripr/tests/chaos_interrupted_runs.rs
  • crates/ripr/tests/lsp_lifecycle.rs
  • crates/ripr/tests/lsp_seam_degradation_spawn.rs
  • crates/ripr/tests/mcp_stdio.rs
  • crates/ripr/tests/mcp_workspace_config.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Member Author

In-session proof on head 3de9b9e:

  • cargo xtask precommit: exit 0.
  • Local repro under -C instrument-coverage with %p-%m profile names, llvm-profdata show on every profile: before the change 2 truncated .profraw in 11 runs of chaos_interrupted_runs; after, 0 in 6 runs.
  • chaos_interrupted_runs: 8 of 9 pass; doctor_says_when_the_cache_cannot_be_written fails as root on this host both before and after (known environmental permission test).
  • Independent review (fresh Sonnet 5.5 subagent on this exact head, since CodeRabbit and Gemini are rate limited): no blocking findings. The variable reaches only the two terminated children; assertions and stimulus are unchanged.
  • Residual, not claimed fixed: other tests that end instrumented children mid-run (Drop-time kills of MCP/LSP stdio servers in crates/ripr/tests, deadline kills in hostile_repos.rs:114 and common/fixture_git.rs:358). If coverage still fails intermittently after this lands, those are next; ci(coverage): diagnose the October 10 profraw recurrence while preserving the accepted repair #4978 stays open.

Adding merge-ready.


Generated by Claude Code

…ned kill (#4978)

Drop for the stdio MCP/LSP test sessions now closes stdin and waits up to 2s
for the server to exit before killing it, so an instrumented server that is
already exiting cannot be cut off mid profile write.

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

@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

  • chaos_interrupted_runs local pass count drops to 8/9 due to env-dependent doctor test; CI non-root run is the actual gate. PR body acknowledges this.
  • crates/ripr/tests/chaos_interrupted_runs.rs:22 — The doc comment claims this prevents #4978 regression in these two tests, but the PR body and author comment explicitly state #4978 remains open. Consider tightening the wording to 'avoids these two tests producing truncated .profraw' so the doc matches the residual-risk claim.

Verification questions

  • Confirm termination races remain: thread::sleep(Duration::from_micros(delay_micros)) then TerminateProcess does not guarantee the child opened/closed its profile file before kill; red/green is empirical, not deterministic.
  • Confirm doctor permission test fails as root on host both before and after — environmental, not regression. Verify CI runs as non-root so test stays green.
  • Confirm the intended red/green check (test observes a truncated profraw pre-patch, none post-patch) is performed manually outside the test binary; no in-test assertion guards against regression if LLVM_PROFILE_FILE scoping is accidentally widened or removed.

Refuted

  • Adding .env(LLVM_PROFILE_FILE,/dev/null) makes the assertions tautological because the child can no longer emit any coverage, so 'interrupted profile write' is no longer being exercised.; refuted because: Assertion targets (cache file present after kill; previous-artifact invariant) are independent of the coverage profile. The interrupted-child behavior under test (cache/artifact outcomes when killed mid-run) is still exercised; only the side-effect of writing a profile is suppressed.
  • The new env(LLVM_PROFILE_FILE, /dev/null) on the two terminated children might leak and disable coverage for the parent test binary, silently suppressing real failures.; refuted because: The scope is the per-spawn Command builder only; parent process and the test binary itself inherit env from cargo test, not from the spawned child's .env() override. Doc comment justifies the suppression as narrowing to the deliberately terminated children, mirroring accepted #5170. Read of Command::env semantics confirms child-only.
  • Setting LLVM_PROFILE_FILE=/dev/null on the child is racy or might be inherited by parent test binary or other spawned processes; refuted because: env() on a single Command::spawn scopes to that child only; Command does not propagate to parent. Other tests in the same binary use their own Command builders and are unaffected.

Parked follow-ups

  • PR explicitly disclaims fixing #4978: parallel profile truncation paths (LSP/MCP Drop kills, hostile_repos deadline, fixture_git) are residual and parked as follow-ups.
  • hostile_repos.rs:114 and common/fixture_git.rs:358 also kill instrumented children at deadline/Drop — unproven non-producers per author's own admission.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Local proof on head fdc4945:

  • cargo xtask precommit: pass (on 669e599; fdc4945 is a doc-comment-only change, cargo fmt --check clean)
  • cargo clippy -p ripr --tests -- -D warnings: pass
  • Tests pass: lsp_lifecycle, mcp_workspace_config, agentic_bench_lsp, agentic_bench_mcp, lsp_seam_degradation_spawn, mcp_stdio.
  • Independent subagent review of the new Drop behavior (close stdin, wait up to 2s, then kill): clean. No hang, leak, zombie, panic or portability defect; the only notes are that a drop of a still-busy server can take up to 2s, and LSP may not exit within 2s on EOF, in which case the kill fires as before.
  • ci(coverage): diagnose the October 10 profraw recurrence while preserving the accepted repair #4978 stays open: other kill sites (hostile_repos, fixture_git) are not covered by this PR.

Labeling merge-ready.


Generated by Claude Code

@EffortlessSteven EffortlessSteven changed the title test(chaos): discard the coverage profile of deliberately interrupted children (#4978) test(servers): discard interrupted-child profiles and let exiting servers finish theirs (#4978) Oct 17, 2026
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 06:03
@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!

Copy link
Copy Markdown
Member Author

Rust gates failed on fdc4945 at cargo xtask goldens check (8 human.txt drifts, e.g. one_hop_field_projection, rust_map_overwrite_count). This PR changes only test files under crates/ripr/tests, so it cannot move fixture output. The drift comes from the base. I merged current main (which includes #8412, which prints No test stub here: ... and adds more human.txt drift) and goldens check still reports drift (35 fixtures, formatting_only), so main's goldens look unblessed. I'm not blessing them in this PR; that needs its own goldens bless with a reason. Keeping the PR watched until the base is green.


Generated by Claude Code

@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

  • #4978 remains open by author admission; patch fixes only two of at least three known kill sites (chaos only). Hostile_repos.rs:114 and common/fixture_git.rs:358 still kill instrumented children without grace or /dev/null. Until main rust-coverage is green over several runs, the patch is a partial mitigation and reviewers should not infer #4978 is closed.

Verification questions

  • Confirm no test in this diff performs a red/green oracle: nothing asserts the child would have produced a truncated .profraw pre-patch or that it doesn't post-patch. The two env-redirect sites are silent; the red→green proof lives in the PR author's manual llvm-profdata show run (2/11→0/6).
  • Confirm no in-test assertion guards against regression: the proof of 'no truncated profraw' is the author's manual llvm-profdata show loop, not a test that would fail if the env-var were dropped. The chaos tests still pass without the LLVM_PROFILE_FILE override; they would also pass with it removed.
  • Confirm drop grace relies on stdin EOF being observed by the server within 2s; an LSP/MCP server that is mid-request and not reading stdin at the moment of drop will not exit on its own, so kill still fires and truncates a profile if it lands inside LLVM profile write.

Refuted

  • The new tests (or modified existing tests) should fail on unpatched main and pass on this PR's head, supplying the red/green oracle the review rubric asks for.; refuted because: Per the seeded author comment and PR body, this PR adds zero new oracle assertions. The 'before' state was checked by manual llvm-profdata show, not by a test that can be re-run in CI. The red→green transition is empirical, not test-resident.
  • chaos_interrupted_runs assertions are smoke-only and cannot detect the fix; refuted because: The fix is environmental (prevent the .profraw from being written at all), so in-process assertions on child behavior cannot observe it. The discrimination lives in llvm-profdata merge output, which is a CI-only witness. The PR body, author comment, and review summary acknowledge this; the change is minimal and the env-var is correctly scoped.

Parked follow-ups

  • Five Drop impls duplicate an identical 6-line grace block; divergence risk between sites if policy ever tightens (e.g. SIGKILL fallback, retry, panic-safety). Not a correctness blocker; oracle concern is maintenance, not discrimination.
  • The duplicate grace-poll snippet across 6 Drop impls invites a shared helper but adds no test value; absent a red/green oracle, helper extraction risks silently shifting behavior. Park for follow-up; not a red/green blocker.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • cargo-test sensor is scheduled-late with no receipt yet; on a tests-only diff the actual red/green signal lives in cargo test. Without the receipt the gate has no witness that the five Drop changes do not introduce a hang or panic under coverage.

@EffortlessSteven
EffortlessSteven merged commit 1bbdb48 into main Oct 17, 2026
31 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-f3osai branch October 17, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants