Skip to content

ai slop - #36955

Closed
robobun wants to merge 18 commits into
mainfrom
farm/cf14c03f/install-windows-ebusy-concurrent
Closed

ai slop#36955
robobun wants to merge 18 commits into
mainfrom
farm/cf14c03f/install-windows-ebusy-concurrent

Conversation

@robobun

@robobun robobun commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

This PR has been marked as AI slop and the description has been updated to avoid confusion or misleading reviewers.

Many AI PRs are fine, but sometimes they submit a PR too early, fail to test if the problem is real, fail to reproduce the problem, or fail to test that the problem is fixed. If you think this PR is not AI slop, please leave a comment.

@github-actions github-actions Bot added the claude label Aug 5, 2026
Comment thread src/install/PackageInstall.rs Outdated
Comment thread src/install/PackageInstall.rs Outdated
Comment thread src/install/PackageInstall.rs Outdated
Comment thread src/install/PackageInstall.rs Outdated
Comment thread src/install/PackageInstall.rs Outdated
Comment thread src/install/PackageInstall.rs Outdated
Comment thread src/install/extract_tarball.rs Outdated
Comment thread src/install/extract_tarball.rs Outdated
Comment thread src/install/extract_tarball.rs
Comment thread src/sys/windows/mod.rs Outdated
Comment thread src/sys/windows/mod.rs Outdated
Comment thread src/install/PackageInstall.rs
Comment thread src/install/PackageInstall.rs
Comment thread src/install/PackageInstall.rs
Comment thread src/install/PackageInstall.rs
Comment thread src/install/PackageInstall.rs Outdated
Comment thread src/install/PackageInstall.rs
Comment thread src/install/extract_tarball.rs Outdated
Comment thread src/install/extract_tarball.rs
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 48 minutes

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7552ef4d-643a-4342-9674-7c435e38494b

📥 Commits

Reviewing files that changed from the base of the PR and between 06c4eae and 9e99ab2.

📒 Files selected for processing (2)
  • src/install/PackageInstall.rs
  • test/cli/install/bun-install-hardlink-fallback.test.ts

Walkthrough

Hardlink installation now handles concurrent filesystem races on Windows and Unix with bounded retries, exponential backoff, file identity checks, and destination directory reopening. Windows cache moves distinguish complete and incomplete entries. Concurrent-install tests cover warm- and cold-cache behavior.

Changes

Concurrent installation handling

Layer / File(s) Summary
Windows file identity lookup
src/sys/windows/mod.rs
Adds file_object_id_w and same_file_w to compare Windows file objects by volume serial and file index.
Hardlink retry and destination recovery
src/install/PackageInstall.rs, src/install/isolated_install/Hardlinker.rs, test/cli/install/bun-install-hardlink-fallback.test.ts
Adds bounded retries for Windows and Unix hardlink races, identity checks, destination directory recovery, updated call sites, symlink retry-path correction, and concurrent-install coverage.
Windows cache collision handling
src/install/extract_tarball.rs
Closes source handles before inspection, preserves complete cache entries, and retries replacement of incomplete entries.

Possibly related PRs

  • oven-sh/bun#35105: Both modify Windows extraction-cache move retry handling.
  • oven-sh/bun#36229: Both handle concurrent cache-entry collisions while preserving complete entries.
  • oven-sh/bun#36853: Both modify hardlink installation behavior and related tests.

Suggested reviewers: jarred-sumner

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: concurrent installs now converge instead of failing with EBUSY or ENOENT.
Description check ✅ Passed The description explains the symptoms, causes, fixes, and verification results with sufficient technical detail.

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

Comment thread src/sys/windows/mod.rs
Comment thread src/install/PackageInstall.rs
Comment thread src/install/PackageInstall.rs
Comment thread src/install/isolated_install/Hardlinker.rs
Comment thread src/install/isolated_install/Hardlinker.rs
Comment thread src/install/PackageInstall.rs
Comment thread src/install/PackageInstall.rs Outdated
Comment thread src/install/PackageInstall.rs
Comment thread src/install/PackageInstall.rs
Comment thread src/install/PackageInstall.rs

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/install/PackageInstall.rs (1)

1755-1774: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Propagate destination recovery errors.

Handle errors from make_open_path and MakePath::make_path explicitly. Retry only for expected concurrent-rename errors. Return permission, I/O, path, and other recovery errors instead of retrying with a stale directory and reporting the earlier linkat error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/install/PackageInstall.rs` around lines 1755 - 1774, Update the
destination recovery flow around destbase.make_open_path and
bun_sys::MakePath::make_path to handle their Result values explicitly: retry
only when the error represents the expected concurrent-rename condition, and
immediately propagate permission, I/O, path, or other errors. Do not continue
using the stale destination_dir or report the earlier linkat error after an
unrecoverable recovery failure.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/install/PackageInstall.rs`:
- Around line 1755-1774: Update the destination recovery flow around
destbase.make_open_path and bun_sys::MakePath::make_path to handle their Result
values explicitly: retry only when the error represents the expected
concurrent-rename condition, and immediately propagate permission, I/O, path, or
other errors. Do not continue using the stale destination_dir or report the
earlier linkat error after an unrecoverable recovery failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 61607c84-910f-411b-a4d7-ff8b537a1864

📥 Commits

Reviewing files that changed from the base of the PR and between c99bfd9 and 06c4eae.

📒 Files selected for processing (1)
  • src/install/PackageInstall.rs

Comment thread src/install/PackageInstall.rs
Comment thread src/install/PackageInstall.rs
@robobun

robobun commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

CI status on 9e99ab2: the new concurrent-install test passes on every lane, including the macOS lanes running the clonefile arm. The remaining failures are unrelated to this diff: the AsyncLocalStorage-tracking ASAN leak (pre-existing on main, reported separately) and four tests that passed on retry. Ready for review.

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

No new issues found; my earlier notes (isolated Hardlinker same-inode acceptance, symlink retry target, copyfile sibling deferral) have all been addressed or documented. Deferring to a human reviewer given the scope: this rewrites concurrent-install race handling across four backends (Windows/POSIX hardlink, macOS clonefile, isolated linker) plus the Windows extract-publish semantics, with bounded retry loops and dirfd re-open recovery that are hard to fully validate without cross-platform CI results.

What was reviewed:

  • Retry loops are bounded (4/6 iterations) and backoff shifts can't overflow; first retries stay immediate so single-process EEXIST isn't slowed.
  • same_file_w uses attribute-only opens (0 access, all share bits) so it works on exclusively-held files; handle is closed on both success and query failure.
  • Windows extract-publish now keeps a complete existing cache entry instead of deleting it out from under peers; dir_to_move is closed on every branch before the loop continues or errors.
  • POSIX hardlink ENOENT arm re-opens from dest_dir and recreates the entry's parent path before retrying; non-transient re-open errors propagate rather than looping.
Extended reasoning...

Overview

~350 lines of changes across src/install/PackageInstall.rs, src/install/extract_tarball.rs, src/install/isolated_install/Hardlinker.rs, src/sys/windows/mod.rs, and a new concurrent-install stress test. The core change: when N bun install processes race on the same packages/destination/cache, treat a peer's already-correct output (same file object / same inode) as success rather than a conflict to destroy, and retry transient EBUSY/ENOENT with bounded backoff. Also changes the Windows tarball-extract publish to keep an existing complete cache entry rather than rename-and-delete it.

Security risks

None identified. No new user-controlled input reaches these paths beyond what already did; the new same_file_w helper is a read-only identity check via GetFileInformationByHandle. The "keep existing cache entry" branch only fires on a rename collision and still replaces entries lacking package.json, so it doesn't newly accept incomplete/corrupt cache state.

Level of scrutiny

High. This is the core bun install file-materialization path across every platform, with per-platform #[cfg] branches that only get exercised on their own CI lanes. The correctness argument rests on a concurrency invariant ("all racers install identical content, so an existing file is the desired end state") that's sound for the motivating bunx scenario but is a semantic change for the Windows cache-publish path (previously replaced, now kept). The retry loops introduce sleeps on the install hot path (only after 2 immediate retries on POSIX, but still). The new test spawns 30+ subprocesses with a 120s timeout — potential CI-time and flakiness concerns a maintainer should weigh.

Other factors

All three of my earlier inline notes were addressed in follow-up commits (c99bfd9, 06c4eae, plus PR description updates for the deferred copyfile sibling). The PR description is thorough, cites soak-test numbers on both platforms, and rust:check-all passed. The test asserts both file count and content per package after each round. Given the cross-platform surface and the design decisions embedded here (retry counts, which errnos are treated as transient, keep-vs-replace on cache collision), a human maintainer should sign off.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This PR has been closed because it was flagged as AI slop.

Many AI-generated PRs are fine, but this one was identified as having one or more of the following issues:

  • Fails to verify the problem actually exists
  • Fails to test that the fix works
  • Makes incorrect assumptions about the codebase
  • Submits changes that are incomplete or misleading

If you believe this was done in error, please leave a comment explaining why.

@github-actions github-actions Bot changed the title install: let concurrent installs of the same packages converge instead of failing with EBUSY/ENOENT ai slop Aug 5, 2026
@github-actions github-actions Bot closed this Aug 5, 2026
@robobun

robobun commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Responding to the flag with the verification record, since each listed criterion was covered during development:

The problem was verified before any fix. The starting point was CI build 89146, where two napi suites running bun x node-gyp@11 concurrently on the windows-aarch64 lane failed with EBUSY: failed copying files from cache to destination for package <name>. A standalone reproduction (N concurrent bun install of tarball deps sharing one BUN_INSTALL_CACHE_DIR) fails on stock bun 1.4.0-canary with 7 or 8 out of 8 processes per round on Windows, and 12 out of 12 runs on Linux with the ENOENT flavor. Those runs are quoted in the PR description.

The fix was tested in both directions. The new test in test/cli/install/bun-install-hardlink-fallback.test.ts fails without the src changes (12/12 runs on Linux, 6/6 on Windows) and passes with them (35/35 Linux, 20/20 Windows locally, plus roughly 700 soaked concurrent installs across warm- and cold-cache shapes on both platforms). The final CI run on 9e99ab2 is green for this test on every lane, including the macOS lanes exercising the clonefile arm; the only persistent red is the pre-existing AsyncLocalStorage-tracking ASAN leak, which exists on main and was reported separately.

Assumptions were checked against the codebase. The convergence design follows the same reasoning already merged for the POSIX extract path discussion in #36227/#36229 (an existing cache entry or destination file produced by a concurrent install of identical content is the desired end state), and the retry/backoff shape mirrors the existing cache-move retries in extract_tarball.rs. Scope exclusions (POSIX extract publish, copyfile backend) are stated in the description rather than silently skipped.

The review bots on this PR raised several findings (isolated linker, symlink retry target, clonefile backend, recovery-error propagation); each was either fixed in a follow-up commit or explicitly documented. Happy to address anything further, and leaving reopening to a maintainer's judgment.

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