Skip to content

perf(lsp): skip the disclosure-probe worker on the diagnostics refresh path (#7716) - #7757

Merged
EffortlessSteven merged 5 commits into
mainfrom
fix/perf-lsp-didopen
Oct 14, 2026
Merged

EffortlessSteven merged 5 commits into
mainfrom
fix/perf-lsp-didopen

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Proposal: n/a
Spec: RIPR-SPEC-0116 (check-worktree mode; disclosures unchanged on every rendering surface) / RIPR-SPEC-0105 honesty (no deferred state is claimed)
ADR: n/a
Plan item: n/a
Governing issue or accepted claim: #7716 (LSP didOpen still 2.2–3.6x pre-regression baseline); mechanism identified by the #5257/#7716 bisect lane at #5997 (9cc79a167)
Acceptance delta (one sentence): LSP didOpen first-publish latency returns to its pre-regression band while every rendered disclosure (CLI check output, JSON envelope, GitHub annotations, MCP workspace status) keeps its probes.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): fix/perf-lsp-didopen
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): n/a
Accepted winner and losing candidate disposition (when decided): n/a

Scope

Scope Classification

  • One production behavior

Production delta:

  • DisclosureProbes (crates/ripr/src/analysis/mod.rs), threaded through run_worktree_analysis_with_oracle_policy_and_rust_config → run_worktree_pipeline_with_oracle_policy_and_rust_config; Skip returns before the probe worker. The LSP entry check_workspace_worktree_with_sources_open_rust_paths_and_progress (crates/ripr/src/app/check.rs) passes Skip; every other entry keeps Run.
  • LoadedDiff::resolved_base_commit / LoadedDiff::merge_base_origin (crates/ripr/src/analysis/diff/load.rs), captured by resolve_effective_base_core_with_commit and worktree_diff_origin; consumed by resolve_analyzed_revisions (new loaded_base_commit/loaded_merge_base parameters with the original probes as fallback).

Evidence/support delta:

Single acceptance criterion:

  • On the pinned mid corpus, cargo xtask bench-agent-surfaces --corpus mid M3 LSP didOpen cold p50 returns to the pre-regression band (this host: 5678ms → 3428ms, versus 3130ms measured at the pre-regression endpoint on the same host), with no disclosure removed from any rendered surface.

Non-goals:

  • Removing the disclosures from CLI/JSON/GitHub/MCP output (they keep Run).
  • The pre-existing serial loader probes (rev-parse --git-path warning probe, base verification, merge-base origin, the diff itself) and the LSP identity rev-parse — all present at the pre-regression endpoint; further reduction is a separate claim.
  • The M2 MCP per-seam currentness probe cost (ce154a67c, named by perf(analysis): recover the #7292 LSP/MCP refresh regression (two serialized git-probe causes) #7395): MCP keeps its probes here; that lane is separate.

Support-tier Impact

  • none

Claim/proof notes:

  • The LSP saved-workspace untracked-file boundary remains disclosed by the LSP's static limits note (SAVED_WORKTREE_LIMITS_NOTE), which is how RIPR-SPEC-0116's LSP contract names it today; the skipped probe fields were never rendered by the LSP.

Policy Impact

  • none

Ledger or exception notes:

  • none

Proof

cargo xtask bench-agent-surfaces --corpus mid --m1-cold 1 --m1-warm 1 --m2-sessions 1 --m3-cold 3 --m3-warm 1 --m5-cold 1 --m5-warm 1 --timeout-ms 900000
cargo fmt --check
cargo clippy -p ripr --all-targets --locked -- -D warnings
cargo test -p ripr --lib probe
cargo test -p ripr --lib analysis::diff::load
cargo xtask goldens check
cargo xtask check-fast

(The ask's --m1-cold 0 zero-flag form is rejected by the harness — bench-agent-surfaces --m1-cold must be positive, positive_count at xtask/src/reports/bench_agent_surfaces.rs:272 — so every population runs at its minimum count 1, with M3 cold at n=3 for p50 stability. The literal zero-flag command was run once and its exit 1 recorded.)

Result, failures, or skipped proof:

Results on the published head d75a948d0 (candidate e9721e2 reconciled with main's #7386 stack; base 3480fb20a, one Windows host):

  • Discriminating bench (cargo xtask bench-agent-surfaces --corpus mid, harness-minimum populations, M3 cold n=3), clean idle-host runs, identical command:
  • Mechanism A/B (GIT_TRACE2_PERF, replica corpus): before = 10 git children, ~2235ms git self-time in the didOpen window, didOpen→publish 7670ms, with the four feat(check): analyze the dirty working tree by default and name base/head #5997 probe children at the tail; after = 6 children (~1217ms), 4362ms.
  • cargo fmt --check: pass. cargo clippy -p ripr --all-targets --locked -- -D warnings: pass (re-run on the merged head).
  • Targeted tests on the merged head: cargo test -p ripr --lib -- worktree_pipeline typed_worktree_timeout probe → 424 passed, 0 failed. On the pre-merge candidate the wider 548-test filter also passed except the two probe-seam tests under this host's maximum concurrent load (see residuals).
  • cargo xtask goldens check: exit 0, pass on the merged head (Status: pass in target/ripr/reports/goldens.md).
  • cargo xtask check-fast: with the uncommitted candidate it selected 0 files (vacuous, discarded); with the committed candidate every gate that ran passed (static-language, command-catalog, no-panic-family, allow-attributes, file-policy, generated, generated-clean, lint-policy) and the run then failed at cargo clippy --workspace --all-targets -- -D warnings on tools/repo-policy (lib test) clippy::unwrap-used — reproduced on the exact base 3480fb2 (cargo clippy -p repo-policy --all-targets --locked at base: error: could not compile repo-policy (lib test)), an inherited main-tree condition untouched by this diff; routed separately, not fixed here.
  • Policy cascade on the merged head (each run explicitly, exit 0): check-no-panic-family, check-process-policy, check-allow-attributes, check-static-language, check-executable-files, check-network-policy, check-lint-policy. (check-process-policy initially flagged the new test's second process spawn in pipeline.rs; resolved by reading back through the existing fixture_git helper's single policy-accounted spawn, not by widening the allowlist. An check-allow-attributes failure observed mid-rebase was an artifact of scanning an unmerged index; it passes on the committed merge and on pure main.)

Negative experiments:

  • worktree_pipeline_skip_disclosure_probes_spawns_no_probe_worker fails on the pre-change head: there is no Skip, the worker starts, and the flag flips.
  • The de-dup pins in worktree_pipeline_probes_overlap_the_analysis fail if the loader stops capturing the base commit (naming falls back to absent/stale probes) or if the merge-base filter is dropped.
  • GIT_TRACE2_PERF A/B above is the removal experiment: the four probe children vanish from the didOpen window and the publish latency follows them.

Residuals:

  • The pre-existing worktree_pipeline_probes_overlap_the_analysis has a load-sensitive 30s worker-start bound: under this host's maximum concurrent test load the probe thread starved past the bound and the test failed once; at lower concurrency it passes repeatedly. Bounds untouched (pre-existing test); noted for the hosted full-matrix run.
  • cargo xtask check-fast remains red on main independent of this PR via the repo-policy unwrap-used lint in its own tests; this PR does not repair it.

Claim Boundary

  • May claim: the LSP didOpen refresh no longer pays the feat(check): analyze the dirty working tree by default and name base/head #5997 disclosure-probe worker, and worktree/committed-history runs that keep the probes spawn two fewer git children per run (de-dup).
  • Must not claim:
    • M2 MCP refresh recovery — ripr_refresh keeps its probes and its separate perf(analysis): recover the #7292 LSP/MCP refresh regression (two serialized git-probe causes) #7395-named per-seam currentness cost (ce154a67c); any M2 delta here is incidental.
    • A host-independent latency figure — all measurements are one Windows host at one revision, pinned corpora, harness-minimum populations (the harness rejects zero-count flags).
    • That the remaining ~1.2s of serial git children on the didOpen path (warning probe, base verification, merge-base origin, diff, LSP identity) are minimal — they predate the regression and were not re-derived here.

Rollback

  • Revert the squash commit. Skip disappears, every caller returns to Run, and the probe worker runs for all consumers as at the parent commit.

Spec-Test-Code Traceability

  • Spec: docs/specs/RIPR-SPEC-0116-check-worktree-mode.md (disclosures unchanged on every rendering surface; LSP boundary already named by its static note)
  • Tests: crates/ripr/src/analysis/pipeline.rs (worktree_pipeline_skip_disclosure_probes_spawns_no_probe_worker, worktree_pipeline_probes_overlap_the_analysis)
  • Code: crates/ripr/src/analysis/mod.rs (DisclosureProbes), crates/ripr/src/analysis/pipeline.rs, crates/ripr/src/analysis/diff/load.rs, crates/ripr/src/app/check.rs
  • Golden outputs: none (no rendered output changes)
  • Metrics: bench-agent-surfaces M3 LSP didOpen mid populations

…h path (#7716)

The #5997 worktree probes (untracked-routed-files status, analyzed-revisions
rev-parse/merge-base) run on a #7292 worker thread overlapped with the
analysis, but on a loaded host the analysis thread pool starves the worker,
the overlap is lost, and the join extends every LSP refresh by the probes'
full wall time: GIT_TRACE2_PERF measured 10 git children (~2.2s self-time)
inside the didOpen -> first-publish window, with the four probe children at
its tail. The LSP renders neither probe field, so it now passes
DisclosureProbes::Skip and runs no worker; CLI/MCP check output keeps Run
and every rendered disclosure.

Also stop re-spawning what the diff loader already resolved: the
analyzed-revisions naming now reuses the loader's own base-commit
verification id and the worktree diff's merge-base origin (two fewer git
children per worktree run), which also names the exact origin the diff
started from.

Measured on the pinned mid corpus (one Windows host, harness-minimum
populations): M3 LSP didOpen cold p50 5678ms -> 3428ms; the pre-regression
endpoint measured 3130ms on the same host. didOpen->publish replica probe:
7670ms -> 4362ms, git children 10 -> 6.

Fixes #7716 (M3 didOpen lane; M2 ripr_refresh keeps its probes and its
#7395-named per-seam currentness cost).
@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 Oct 13, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

The included review limit has been reached and this organization has disabled usage-based review continuation. Wait for reviews to reset or ask a billing admin to change After included review limits.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f55836a2-c9bb-44a0-b81e-7cfd50eb03dc
📥 Commits

Reviewing files that changed from the base of the PR and between 0e5bccd and bd82074.

📒 Files selected for processing: 6
  • changelog.d/7757-lsp-didopen-probe-skip.md
  • crates/ripr/src/analysis/diff/load.rs
  • crates/ripr/src/analysis/git_candidate_execution.rs
  • crates/ripr/src/analysis/mod.rs
  • crates/ripr/src/analysis/pipeline.rs
  • crates/ripr/src/app/check.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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 3 potential issues.

Devin Review

Comment thread crates/ripr/src/analysis/diff/load.rs Resolved
Comment thread crates/ripr/src/analysis/pipeline.rs Resolved
Comment thread crates/ripr/src/app/check.rs Resolved
# Conflicts:
#	crates/ripr/src/analysis/git_candidate_execution.rs
#	crates/ripr/src/analysis/mod.rs
#	crates/ripr/src/analysis/pipeline.rs
#	crates/ripr/src/app/check.rs

@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.

Confirmed findings

  • No test exercises resolve_effective_base_core_with_commit's commit capture or LoadedDiff::resolved_base_commit / merge_base_origin population on the worktree loader path. The two new tests assert end-to-end naming but never pin that the loader itself captured the id (a regression where the loader drops the capture and the consumer falls back to the probe would still satisfy naming correctness). Add a unit test on load_worktree_diff_with_effective_base_core asserting resolved_base_commit.is_some() and merge_base_origin matches worktree_diff_origin output. (crates/ripr/src/analysis/diff/load.rs:475).
  • crates/ripr/src/app/check.rs:97 — DisclosureProbes::Skip is hard-coded at the LSP entry; the comment 'renders neither field' is implicit. Make the predicate (consumer name -> Skip|Run) a named function or table so a future entry that renders neither field cannot silently fall into Run, and one that renders one field cannot silently Skip.
  • git_candidate_execution.rs test signature was updated to pass DisclosureProbes::Run; the test fails closed on a subject and does not assert the Skip/Run distinction, but it is a closed-form negative test and the funnel parameter is correctly threaded.
  • PROBE_OVERLAP_TEST_LOCK is a std::sync::Mutex used as a serial barrier; a poisoned lock from a panicking sibling test would propagate poison to the Skip test's _seam_guard. The unwrap_or_else recovers, but if the sibling panic leaked a partial flag state, the Skip test's WAIT_FOR_WORKER=true / WORKER_STARTED=false setup could observe leftover state from the recovered sibling. Document an explicit reset or use a fresh flag scope per test.

Verification questions

  • Confirm pROBE_OVERLAP_TEST_LOCK is acquired in the new skip test BEFORE clearing PROBE_OVERLAP_WORKER_STARTED to false; if a sibling Run-path test was in flight and saw the true flag concurrently, the cleared value could race the joiner's check. The mutex serializes the seam tests, but PROBE_OVERLAP_WAIT_FOR_WORKER/WORKER_STARTED are still global atomics shared with non-test code paths and their Store/Release/Acquire ordering depends on the mutex — a poisoned lock from a sibling panic is unwrapped via into_inner(), so the test continues with stale atomic state rather than aborting.
  • Confirm probe-policy decision lives at the LSP app/check.rs funnel but is parameterized through the pipeline. This couples a product-surface latency claim to an analysis-internal flag; the policy's 'renders neither field' predicate is invisible from pipeline.rs.
  • Confirm de-dup pin test asserts real commit ids via fixture_git_output (single policy-accounted spawn) and merge_base stays absent on linear history.
  • Confirm de-dup pin in worktree_pipeline_probes_overlap_the_analysis asserts merge_base_commit is None when it equals the base tip. On a linear fixture this discriminates (fallback probe WOULD set it), but on a non-linear fixture the fallback would also keep it absent (merge-base != base tip), so the pin is fixture-shape-dependent rather than path-dependent.
  • Confirm skip test stores WAIT_FOR_WORKER=true then asserts WORKER_STARTED=false - but a Run-path test running concurrently could flip WORKER_STARTED under the same flag. PROBE_OVERLAP_TEST_LOCK guards this, yet std::sync::Mutex serializes per-mutex-acquire; if cargo test --test-threads=1 is not enforced the test could still race via the global atomic alone.
  • Confirm committed-history pipeline in pipeline.rs:140-160 calls resolve_analyzed_revisions with loaded_base_commit but passes None for the merge base, so the diff-pipeline path still spawns its own merge-base probe. Asymmetric with the worktree path which now reuses the loader's merge_base_origin.
  • Confirm pROBE_OVERLAP_TEST_LOCK is acquired in worktree_pipeline_probes_overlap_the_analysis and worktree_pipeline_skip_disclosure_probes_spawns_no_probe_worker only. Other probe-seam tests (any pre-existing test that flips PROBE_OVERLAP_WORKER_STARTED) would race the Skip test's 'never started' assertion.

Refuted

  • Devin: 'The new commit assertions also pass if resolved_base_commit is dropped and the fallback probe returns the same commit. They verify output values, not the claimed reduction in Git processes.'; refuted because: Equality pin accepts the fallback's identical output, so dropping loaded_base_commit while the fallback still resolves HEAD~1^{commit} keeps the test green. The discrimination gap is real; recorded as a medium test-gap with proof intent to add a spawn-count assertion.

#7716)

Review follow-up on #7757:
- worktree_loader_carries_the_revisions_it_already_resolved pins that
  load_worktree_diff_with_effective_base_core itself populates
  resolved_base_commit and merge_base_origin, so a regression that drops the
  capture cannot hide behind the consumer's fallback probe.
- resolve_analyzed_revisions_prefers_the_loader_ids_over_fresh_probes pins
  the preference semantics with fabricated loaded ids (a fallback that
  re-derives identical values cannot satisfy them), plus the empty-value
  fallback and the merge-base-equals-base filter on the fallback path.
- The LSP-only DisclosureProbes::Skip decision moves into a named policy
  function documenting the consumer table and the two-part proof a new
  consumer needs.
- changelog fragment for the LSP refresh behavior change.
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Review disposition (ef8cc96):

Addressed

  • Loader-capture gap: worktree_loader_carries_the_revisions_it_already_resolved pins that the worktree loader populates resolved_base_commit/merge_base_origin; resolve_analyzed_revisions_prefers_the_loader_ids_over_fresh_probes pins the preference with fabricated ids plus the fallback and equality-filter paths.
  • Named predicate: the LSP-only decision is now lsp_diagnostics_refresh_disclosure_probes with the consumer table in its doc comment.
  • Changelog: changelog.d/7757-lsp-didopen-probe-skip.md.

Refuted / by design

  • Lock + stale atomics: both seam tests re-store WAIT_FOR_WORKER/WORKER_STARTED to fresh values immediately after acquiring PROBE_OVERLAP_TEST_LOCK (and take it via unwrap_or_else(into_inner)), so a panicking sibling's leaked flag state is overwritten before either test reads it; the flags have no non-test writers.
  • Only these two tests touch the seam flags (grep: PROBE_OVERLAP_WORKER_STARTED has exactly two test writers, both under the lock).
  • Committed-history pipeline passing None for the merge base is deliberate and documented at the call site: git diff <base>...HEAD never had the loader compute a merge base, unlike the worktree origin.
  • The merge-base-absent pin is a naming-contract pin (field stays absent when equal to the base tip); the path discrimination the reviewer wanted lives in the new fabricated-ids test, which the fallback path cannot satisfy.

Proof refreshed on ef8cc96: fmt, clippy -p ripr --all-targets -D warnings, 425 targeted lib tests, goldens check, the seven-gate policy cascade, check-changelog-fragments, check-static-language — all pass.

@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

  • Author's PR body notes that under maximum concurrent test load the existing seam test (worktree_pipeline_probes_overlap_the_analysis) has a load-sensitive 30s worker-start bound where the probe thread starved past the bound and failed once. This is a test-harness flakiness residual, not a UB or worker-handoff issue; flagged for awareness only.
  • git_candidate_execution.rs test only adds DisclosureProbes::Run to the call; existing closed-form negative ('worktree mode must fail closed on a subject') is unaffected, but no assertion pins Skip vs Run choice at this entry point. Acceptable because Skip is not yet a consumer of this path.

Verification questions

  • Confirm loadedDiff::resolved_base_commit is populated only on explicit-base verification success; merge_base_origin only on the worktree loader path. Committed-history/diff/stdin arms remain None, matching the contract that callers pass None for that field.
  • Confirm claim boundary: PR explicitly disclaims the remaining ~1.2s of serial git children on the didOpen path (warning probe, base verification, merge-base origin, diff, LSP identity). The '~1550–1610ms against the 1491–1752ms baseline rows' figure is back-scaled from the host's pre-regression 3130ms to a different host's baseline band; that back-scaling is not reproducible in a CI witness and is correctly fenced as not-claimable. No action; noted as a watch-item for future iterations.

Refuted

  • merge_base_origin ownership could be partially moved out of LoadedDiff leaving consumers with a torn Option/String view.; refuted because: Diff shows the field is built inside the Ok(...) constructor of load_worktree_diff_with_effective_base_core and only ever read via .clone() / .as_deref() at consumption sites; no consuming path drops the value before ownership.
  • The de-dup reduction's spawn-count claim is asserted only by the seam flag, not by an in-process counter, so test instrumentation could mask regressions; refuted because: The PR body's GIT_TRACE2_PERF A/B supplies the receipt for the spawn-count claim (10→6 children on the didOpen window, worker 4→2 on CLI/MCP). Adding an in-process counter would be new production instrumentation; the existing acceptance criterion does not require it. Outside the red/green proof scope.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@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.

REPAIR_REQUIRED — one blocking test/oracle defect, independently verified; pending CI is a separate evidence state.

reviewed_head_sha: ef8cc96
integration_basis: PR base metadata and actual merge-base are 0e5bccd. Read-only origin/main observation was c96a792; git merge-tree --write-tree for that main/head completed without conflicts, tree 9e043f2443d75f121e6d4fa8047b7d2b80493b8d. This is a constructed integration tree, not an executed qualification or the GitHub merge object. PR metadata reports merge object 2cec45d; native merge-ref fetch was unavailable, so its parents/tree were not independently inspected.
claim_boundary: #7716 LSP didOpen recovery through removal of unrendered disclosure probes; retained rendered disclosures and loader-owned revision reuse. No M2 recovery, host-independent latency or release claim.

Blocking finding: #7799 / inline comment — process-global worker seam still admits ordinary concurrent Run writers despite the new test mutex. Repair in this existing candidate; preserve its writer. This is a verified source/test-oracle defect, not an attribution of pending CI.

Inspected scope:

  • All six changed files and complete diff; analysis policy plumbing, worktree/diff pipeline, loader capture/fallback, app routing and changelog.
  • Actual LSP diagnostics caller (diagnostics.rs:968), projection into snapshot, no production reads of either removed field under lsp, and backend's saved-worktree limits note/status projection. Empty and nonempty open-path branches both select Skip. Generic CLI/library/MCP routes keep Run.
  • Human/JSON/GitHub/SARIF analyzed-revision consumers and MCP workspace untracked projection; source contract RIPR-SPEC-0116. Skip returns before worker creation and leaves normal effective-base binding.
  • Explicit/default-base, worktree/committed-history, diff-file/stdin, failed probe/empty-id, equal and divergent merge-base forms. Worktree loader captures the actual origin; committed loader has no origin and deliberately retains its merge-base fallback.
  • Worker cancellation propagation, joins/error handling, immutable-candidate/worktree exclusion; no dependency/workflow/platform-specific production branch changed.
  • New test stimulus/oracles plus ordinary sibling worktree test callers, process-global atomic writers and lock boundaries.
  • Existing three unresolved Devin threads and current replies. None resolved by this pass.

Actual independent results:

  1. Pinned rustc 1.95.0 (59807616e 2026-04-14), Linux x86_64. Exact complete pipeline-function extraction SHA-256 b8dd148f1b7b3a3ee9dd314065d4d6f7a9d459c1b4f8f6f39b5d61880b379ab9, compiled --edition 2024 --cfg test; dependencies explicitly stubbed. Isolated Skip: no worker signal, disclosures absent. Controlled unrelated Run while seam lock held: worker flag true and Skip negative oracle falsely fails, native exit 101. Full libtest pair was not executed.
  2. Exact revision resolver and resolve_base_commit source extracted into a narrow executable with real /usr/local/bin/git and a divergent Git fixture. Correct base/head/origin and loaded-id precedence; equal merge/base suppressed. Resolver children: worktree explicit=1, worktree default=2, committed explicit=2, all fallback=3. Exit 0. Removing loaded-base reuse produces 2 versus expected 1 child, exit 101. Deadline/process wrappers are simplified in this experiment; no full-product equivalence claimed.

Non-blocking claim correction: the PR body's unconditional “worktree/committed-history ... two fewer git children per run” is broader than the code. Explicit worktree saves two; default worktree saves one because default-base search discards the verified id; explicit committed-history saves one; default committed-history saves none. Update the public claim without expanding production scope.

Existing findings:

  • Loader-capture/preference tests now address the prior fallback-only oracle gap for carried values. They do not themselves count worker spawns; the independently executed resolver removal control above does.
  • Changelog and named app policy are present; no rendered-output contract change was found in the inspected LSP path. Missing changelog claim is stale.
  • Moving-ref thread: verification uses the symbolic base, origin calculation re-resolves it, so there remains a real snapshot race. The old worker also had an unbound fresh-probe race. The reply establishes that old behavior was imperfect; it does not establish atomic input/header binding or remove the new ordering's counterexample. Keep this unresolved residual and avoid an exact-transaction claim; no separate newly introduced production regression is established by this pass.
  • Reset-after-lock handles leaked initial flag state; it does not address ordinary unguarded worker writes during the test (#7799).

Observed hosted evidence at current head:
CI run 38487289089 is in progress. Rust-only feature job 115603887684 is executing cargo test -p ripr --locked --no-default-features --features lang-rust --no-fail-fast; fixture dependency preparation succeeded. vscode/msrv/Perl-release jobs skipped in that run. Windows advisory run 38487288966 remains in progress (subset job 115603887458: lsp::gap_artifacts step completed successfully, cache-warning step in progress); full Windows advisory job skipped. Droid run 38487289050 pending. Wheel qualification 38487289081 in progress. Security 38487289062, Printed Command Paste 38487289041 and ub-review 38487289085 report success; coverage/analytics/future-clippy skipped. Aggregate success is not a substituted semantic review; final artifacts/denominators for running jobs are absent.

Missing/unverified:
No full product build/test/CLI/LSP runtime, native Windows bench, or broad golden rerun was performed in this independent pass. PR-body Windows performance and policy/libtest claims remain reported, not independently executed: raw F:/... bench/Trace2 receipts were not accessible here. Older d75a948/e9721e2e4 measurements stay bound to their original objects; test/policy edits at ef8cc96 do not turn them into fresh current-head executions. Combined current-main tree has no executed proof in this pass. Native gh API/GraphQL access and merge-ref fetch were unavailable; no denied helper was retried/bypassed or CI retriggered.

Next executable action: existing #7757 writer repairs only invocation-scoped seam ownership under #7799, adds the concurrent ordinary Run control and own-worker removal/mutation control, corrects the two-fewer claim and prior flag-writer reply, publishes through the existing workflow, then returns new head and raw focused proof for delta review. Parent retains Ready/merge. Actual Perl #17479 publication/#17573 integration and paused #17623 cancellation/#17655 fsync holds remain unchanged.

Local resources: /workspace/review7757-evidence retained for the repair/delta-review consumer (small Rust experiment sources, logs, binaries and Git fixture; no inherited Cargo target touched). Review-owned detached source tree is scheduled for normal worktree removal after this record; root/candidate checkout remains unchanged.

Comment thread crates/ripr/src/analysis/pipeline.rs Resolved
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 14, 2026 00:20
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 14, 2026 00:20
@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!

check-public-api rejects unintended public exports; no library consumer
selects a disclosure policy, so the enum is not a public contract.

@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.

Confirmed findings

  • Cfg(test) seam flags and lock are not in the production attack surface; production code paths cannot reach them. Test-isolation defects are not security blockers. Track under repo-ops/quality rather than security.
  • Worker-start flag remains a process global written by the Run path without the lock; a concurrent non-seam Run test (e.g. worktree_artifact_round_trip_reuses_recorded_findings) can flip it during the Skip test and falsely fail the new negative assertion.
  • git_candidate_execution.rs test now passes DisclosureProbes::Run but the closed-form negative ('worktree mode must fail closed on a subject') does not assert the Skip/Run distinction; since Skip is not yet a consumer of this path, no action required, but a doc comment naming the test as a closed-form negative (not a discrimination oracle) would prevent a future reader from inferring that Skip coverage exists here.

Verification questions

  • Confirm pROBE_OVERLAP_TEST_LOCK is acquired only by the two seam tests; the Run-path worker body at pipeline.rs:317 stores PROBE_OVERLAP_WORKER_STARTED=true unconditionally and is reachable from cfg(test) callers that pass Run (e.g. worktree_artifact_round_trip_reuses_recorded_findings), so the Skip negative assertion is raceable in-process.
  • Confirm worktree_loader_carries_the_revisions_it_already_resolved only checks the public LoadedDiff fields; it cannot distinguish 'loader captured the id itself' from 'a future loader change re-derives the id via a still-allowed probe that returns the same commit' — and the loader has no internal hook to assert the call site bypassed resolve_base_commit.
  • Confirm sibling-path gap: app/check.rs not updated for the second-branch early return when open_rust_index_paths is empty; the new open_rust_index_paths argument now travels through the new helper, so future additions must thread it. No missing sibling today.

Refuted

  • The Skip boundary should live at the analysis entry (analysis/mod.rs) so future consumers don't need a per-app policy table.; refuted because: A per-app policy table is preferable to a per-consumer enum value: the policy is 'consumer renders neither field and is latency-critical', which is a UI/transport concern that belongs at the entry, not in the analysis crate. Centralizing at the entry (as lsp_diagnostics_refresh_disclosure_probes does) makes the consumer table the single source of truth and keeps DisclosureProbes crate-internal. The author's chosen shape is the smaller and more honest one.
  • No ArrayBuffer/TypedArray/resizable-buffer surface in diff. Pure Rust, no wasm-bindgen, no napi, no FFI. The only 'view' constructs are stack/heap Strings and Option clone-moved into scope-spawned closures; closures join before return so no stale view persists.
  • A Skip early-return could detach the probe worker thread, leaving a stale view of LoadedDiff fields referenced after the pipeline returns.; refuted because: The Skip branch returns before std::thread::scope is entered, so no worker is ever spawned on that path. On the Run path, std::thread::scope joins all spawned threads before returning; closures own cloned Option values, not borrows into a backing store. No ArrayBuffer/TypedArray/resizable-buffer surface exists in this Rust crate, so an active-view/whole-backing-store mismatch is structurally impossible.
  • A second consumer that renders neither disclosure field but calls run_worktree_pipeline_* without Skip would silently pay the probe cost and need a sibling update.; refuted because: Only check_workspace_worktree_with_sources_open_rust_paths_and_progress calls lsp_diagnostics_refresh_disclosure_probes(); every other worktree caller hard-codes or threads DisclosureProbes::Run. The named policy table in app/check.rs is the single funnel, so no parallel sibling exists in this diff.
  • Attacker can influence LoadedDiff::resolved_base_commit or merge_base_origin and have those values flow back into a child-process argv as untrusted flags or paths, producing command injection or path traversal in the probe chain.; refuted because: The captured values flow only into AnalyzedRevisions naming outputs (base_commit/base_ref/merge_base_commit). The only consumer that feeds a value back into a git invocation is resolve_base_commit on the base ref name (the explicit --base argument), which was the pre-existing behavior on the same ref before this diff; the captured commit id is not re-argv'd. UTF-8: null/empty filter plus the existing ref-validation at resolve_effective_base_core blocks the only first-order arg-injection surface.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@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.

REPAIR_REQUIRED — #7799 remains verified at the current published head. No observer repair or process-count claim correction is present in this head.

reviewed_head_sha: e754c8b
integration_basis: PR base metadata and actual merge-base 0e5bccd; fetched current main ff4a2fc. git merge-tree --write-tree completed without conflicts, constructed tree f9f9d0e55c2af278a60f6706312e23a634ab221d. No executed combined-tree proof is claimed; GitHub's reported merge object was not independently inspected.

Changed scope inspected: complete ef8cc96..e754c8b delta, current pipeline worker/global flag/mutex and both seam tests, ordinary worktree sibling route, revision resolver/loader applicability and current PR claims; issue #7799 has no repair comment. The only published delta makes DisclosureProbes crate-internal and documents its scope. That API correction is appropriate. All other previously inspected production/test surfaces are unchanged.

Blocking finding: the existing inline finding and #7799 remain current. Every cfg(test) Run worker can still store true into the process-global observer without the two seam tests' mutex. It can falsely fail Skip or credit the overlap test with a sibling worker. No duplicate inline finding was added and no existing thread was resolved.

Observed fresh narrow proof: exact complete current-head pipeline function extracted unchanged; SHA-256 b8dd148f1b7b3a3ee9dd314065d4d6f7a9d459c1b4f8f6f39b5d61880b379ab9. Pinned rustc 1.95.0 (59807616e 2026-04-14), Linux x86_64, --edition 2024 --cfg test. Retained control rerun after resource admission: isolated Skip passes; controlled ordinary Run while the seam mutex is held flips started=true while Skip's disclosures remain absent; identical negative assertion fails, native exit 101. Loader/analysis dependencies are explicitly stubbed. This proves the synchronization counterexample, not full-product runtime or hosted failure frequency. Fresh inputs/binary/log: /workspace/review7757-evidence/e754c8bfe/; original witnesses preserved.

Process-count claim: still overbroad in Summary and Claim Boundary. Unchanged loader/resolver source means the earlier real-Git resolver controls remain applicable: explicit worktree saves two, default worktree saves one, explicit committed-history saves one, default committed-history saves none. No new resolver execution is claimed. Correct prose without expanding production scope.

Hosted evidence is separate from the source defect: current-head CI run 38491642046 succeeded. Inspected actual raw job log 115617964816: cargo test -p ripr --locked --no-default-features --features lang-rust --no-fail-fast, lib 8940 passed / 0 failed / 1 ignored / 0 filtered; both seam tests and ordinary worktree_artifact_round_trip_reuses_recorded_findings passed. This green scheduling outcome does not challenge the forced interleaving. CI vscode/msrv/Perl-release skipped. Windows advisory subset job 115617965141 in run 38491642094 reports all named subset, clippy and recovery steps successful; full Windows advisory skipped. Security/printed-command/wheel/ub-review runs report success, coverage/analytics/future-clippy skipped; Droid 38491642133 pending. No duplicate CI was triggered.

Missing: actual repaired invocation-scoped source and its own-worker negative control; full real regression with deterministic interleaving; independently accessible historical Windows bench/Trace2 raw artifacts; executed current-main combined-tree proof. Source review is complete for this delta; missing proof and pending review do not become invented source defects. Prior moving-ref residual remains recorded without a newly established regression.

Next executable action: existing writer implements the #7799 scoped observer repair and controls, corrects the count claims and prior reply, then supplies a new head and raw focused proof for delta review. Parent owns Ready/merge. No candidate/root checkout mutation, new worktree, inherited-target modification, policy change, external-agent contact, release, deployment or held Perl/cancellation/fsync action occurred. Evidence directory retained for the repair/delta-review consumer within the admitted 25 MiB addition; prior witnesses retained.

)

P1 review on #7757 (reproduction #7799): the seam's worker-start flag was
process-global and stored unconditionally by every cfg(test) Run worktree
pipeline, so an ordinary parallel test (for example the check-artifact
round-trip reaching the pipeline through check_workspace_worktree_with_config)
could flip it and fail the new Skip test's 'never started' assertion — and
the overlap test could observe a sibling's worker instead of its own.

The seam becomes an invocation-scoped ProbeWorkerObserver: the driving test
installs it via an owned RAII guard on its own thread, the pipeline captures
that observer from the invoking thread before spawning the worker, and the
worker signals only the observer of the invocation that spawned it. Ordinary
Run invocations register nothing. The process-global flag pair and the
serialization mutex are removed.

Validation per the review handoff:
- paired regression: the full probe/worktree/load/app::check libtest filter
  (553 tests, ordinary Run pipelines racing the Skip test) passes; the same
  filter failed the Skip test under the global flag.
- mutation: reverting the Skip branch to the Run path fails the Skip test
  with 'the disclosure-probe worker started under Skip' on its own observer.
- the overlap wait bound moves to a load-tolerant 2 minutes with the
  failure oracle aligned to that bound, so a saturated host's scheduling
  delay no longer reads as an overlap regression while a pre-overlap change
  still fails decisively.

@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

  • ub-active-view has no applicable surface in this Rust analysis-only PR; no ArrayBuffer/TypedArray/resize/detach/transfer or stale length-snapshot code path exists or is introduced.
  • Acceptance criterion ('M3 LSP didOpen cold p50 returns to pre-regression band') is pinned to one Windows host at one corpus with the harness rejecting --m1-cold 0. PR body disclaims host-independence, but the recovery claim (5678ms → 3309ms vs 3130ms pre-regression) is single-sample and load-sensitive. No reproducible harness config is published for hosted CI.

Verification questions

  • Confirm in-process spawn counter for the four worker probes is still absent; the 4->2 (worktree/committed-history) and 4->0 (LSP) reduction is proven only by the GIT_TRACE2_PERF A/B receipt in the PR body. Author correctly noted an in-process counter would be new instrumentation. Acceptable as a residual, but the seam tests cannot be the sole oracle for the spawn-count claim.

Refuted

  • LoadedDiff::resolved_base_commit / merge_base_origin create a resizable-backing-store active-view hazard analogous to ArrayBuffer.transfer / TypedArray length-stale snapshots when the probe worker thread reads them.; refuted because: These fields are heap-allocated Strings owned by the LoadedDiff value, captured by .clone() into the worker closure under std::thread::scope::spawn (move semantics). Strings have no transferable backing store, no detach semantics, and no length-snapshot to go stale. The probe worker reads fully-owned data; there is no view to invalidate. Pure plumbing, no active-view surface.
  • There is a sibling run_diff_pipeline_with_* Skip branch or another canary caller of lsp_diagnostics_refresh_disclosure_probes; refuted because: No Skip branch was added to run_diff_pipeline_with_* (kept Run for committed-history). No other workspace entry uses the new policy table; grep confirms only check_workspace_worktree_with_sources_open_rust_paths_and_progress consumes it.
  • DisclosureProbes as a crate-internal enum could be bypassed by a future caller that defaults to Run without consulting lsp_diagnostics_refresh_disclosure_probes, defeating the named-table guarantee.; refuted because: The named function lsp_diagnostics_refresh_disclosure_probes() is called from the sole LSP-bearing worktree entry; every other entry funnels through check_with_progress_and_origins which hard-codes DisclosureProbes::Run. A future entry that bypasses this table would also need to skip the entire policy plumbing — no silent fall-through path exists today.
  • cfg(test) thread_local observer could leak into a sibling process or affect a parallel test's signals (DoS / info disclosure in test harness).; refuted because: ProbeWorkerObserverGuard::drop clears the slot; Arc dropped with the worker body; even with a panic-skipping Drop, the slot is per-thread and tests run single-threaded per test fn. Test seams are not a security boundary.
  • Devin review (diff/load.rs:255): moving base refs mislabel worktree results because worktree_diff_origin runs after the loader's verification probe and could see a new tip; refuted because: Author refutes as a strict binding improvement, not a regression: the new code names the merge base of the diff this call started from (worktree_diff_origin's exact output) rather than a value mid-analysis re-derived seconds later. base_commit names the loader's verification instant, merge_base_origin names the diff origin — together they are strictly more bound than the prior probe-derivation path. Race window shrinks from seconds to the order of git itself resolving the ref at git diff start.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@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.

Current-head independent delta review: #7799's blocking sibling-observer defect is addressed at bd82074. No blocking source finding in this observer delta. Overall disposition: REVIEW_INCOMPLETE for merge qualification; parent owns integration and remaining acceptance evidence.

reviewed_head_sha: bd82074 (re-read before submission; open, Ready).
integration_basis: merge-base 0e5bccd; refreshed origin/main 78312b3. Constructed current-main merge tree 552e72580eef17191ba0d3f24b3b14bbf7375511 has no conflicts; it was not executed. Existing CI instead ran merge object fce1b7f, whose fetched parents are d40e2b4 and this reviewed head.
claim_boundary: independent observer/counterexample verification and process-count reconciliation; existing Windows source writer retains ownership. No new latency campaign, CI trigger, source edit, push, merge or release action.

Observed independent proof, Linux x86_64, rustc 1.95.0 (59807616e 2026-04-14):

  • Compiled the complete worktree pipeline function AND its test observer/guard/wait code extracted unchanged from this commit, --edition 2024 --cfg test. SHA-256 of that extraction: 7cd8ee6d777c25dcacf98521444d24ca83c1e796d571574408a4298cb4de4eab. Loader, cancellation, analysis and disclosure dependencies are explicitly stubbed; this is synchronization/source proof, not a full-product or native-Windows execution.
  • A barrier in the analysis stub holds Skip inside analysis until an ordinary unregistered sibling Run finishes its real extracted worker path. Skip observer remains false and disclosures absent; sibling Run retains both disclosures: exit 0. The same forced schedule on e754c8b passes isolated Skip then falsely fails the negative assertion from the sibling worker: exit 101. This discriminates the actual repair from the older global seam.
  • Own-worker negative control: disabling only the Skip early-return branch starts its own worker and fails "own worker started under Skip": exit 101. Correct isolated Skip: exit 0.
  • Overlap attribution: completing an unrelated Run cannot signal a registered demanding observer; the subsequent own Run does: exit 0. Removing the own-worker signal still fails after a sibling Run, exit 101. For this removal control only, the two-minute wait bound is reduced to 50ms; no current-head timing claim is made.
  • Guard cleanup through ? early return and caught unwind clears registration; a following ordinary Run cannot signal the old observer: exit 0.
  • Nested registration counterexample: install outer, install/drop inner, then Run on outer scope loses outer observation: exit 101. ProbeWorkerObserverGuard::install overwrites the slot and Drop clears it instead of restoring the previous registration (pipeline.rs:445-458). P2/non-blocking hardening: either explicitly reject nesting or retain/restore previous state. Only the two existing tests install this guard, with no nesting today; no current production failure is claimed.

Process-count claim correction remains needed in PR Summary/Claim Boundary and prior replies:

Mode Resolver git children after Saved versus prior resolver
Explicit worktree 1 2
Default worktree 2 1
Explicit committed history 2 1
Default committed history 3 0
Fresh narrow executable compiled the exact current resolve_analyzed_revisions, resolve_base_commit and git_ref_output source with a counted wrapper calling real /usr/local/bin/git in a two-commit fixture; all four rows and real commit naming/equal-base suppression passed, exit 0. Deadline/process containment wrappers are simplified. Source explains the modes: default-base resolution discards the verified commit ID; only worktree loading carries an origin, while committed loading retains merge-base fallback. The unconditional "two fewer per worktree/committed-history run" is therefore overbroad. Worktree worker also runs status and conditionally rev-parse --show-prefix when untracked records exist; "four children" is a measured fixture shape, not a universal count. LSP Skip removes the whole worker independently of these counts. No new production counter is required for this correction.

Inspected source/contracts: complete six-file PR diff and e754c8b..bd82074 delta; invoking-thread observer capture before spawn, Arc ownership, Run/Skip branch and worker join/cancellation/error ordering; app LSP policy and empty/nonempty open-path branches; sole production LSP caller and retained CLI/library/MCP Run routes; loader explicit/default and worktree/committed capture/fallback; RIPR-SPEC-0116 disclosure contract and changelog. Production routing is unchanged by the latest test-only delta. Older value-equality assertions alone still do not prove de-dup, but loader-capture/fabricated-ID tests provide the discriminator. No dependency, workflow, security, release or platform-specific production change is introduced.

Hosted proof directly inspected:

  • CI run 38499436277, job 115642624038: Ubuntu, cargo test -p ripr --locked --no-default-features --features lang-rust --no-fail-fast, on the merge object named above. Lib inventory 8956: 8955 passed, 0 failed, 1 ignored, 0 filtered; both worktree seam tests and worktree_artifact_round_trip_reuses_recorded_findings individually passed. vscode/MSRV/Perl-release jobs skipped.
  • Windows advisory run 38499436351, job 115642624336 checks out exact bd82074. Despite aggregate success, its raw Cargo-home subset is 4 passed, 1 failed: cargo_home_fallback_and_relative_paths_bind_configuration_or_refuse_discovery, relative/absolute explicit-home identity mismatch at cargo_input_identity.rs:236. Gap-artifact subset 77 passed, cache-warning smoke 1 passed; full Windows advisory job skipped. This unrelated advisory failure is not attributed to this observer delta, and no baseline reproduction was run here. Parent should retain its existing owner/route, not call the Windows subsets uniformly green.
  • Security, printed-command, wheel and ub-review runs report success; Droid run 38499436384 remains pending in the observed snapshot. No rerun was requested.

Reported, not independently rerun: author's Windows 553-test paired filter and own-worker mutant in discussion_r4266042537. Our deterministic source experiment independently confirms their mechanism; existing actual-product CI adds a nonempty real regression execution.
Missing/residual: raw historical Windows latency/Trace2 receipts were not retrieved or requalified, and current-main constructed tree was not executed. The existing moving-ref snapshot residual is unchanged; no atomic input/header binding claim is made. The total-elapsed overlap assertion still includes fixture/analysis/probe work and remains load-sensitive, although the threshold now matches its generous bound; the wait's elapsed comment must not be treated as proof of why total time exceeded it. These limits prevent this bounded review from issuing an overall merge qualification.

Prior #7799/global-mutex source finding is superseded by this exact-head evidence; issue remains open for parent reconciliation. Existing thread is already resolved; this pass did not change thread states. Local reproducible inputs, binaries and native-exit logs: /workspace/review-evidence/{generate.py,run.py,baseline.py,counts.py,results.json}; the durable results/hashes above are delivered in this review. Candidate/root source remains untouched. Parent resumes integration, corrects public count prose and preserves all release/upstream holds.

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.

1 participant