refactor(install): isolate runtime and script state - #1027
Conversation
|
Warning Review limit reached
Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR scopes the Node runtime selection and lifecycle-script settings to each explicit install invocation using Tokio task-locals, preventing concurrent installs from cross-wiring their contexts while retaining process-wide fallbacks for non-install CLI commands.
Confidence Score: 5/5Safe to merge; the isolation mechanism is correctly implemented and the new multi-thread tests validate that concurrent installs cannot observe each other's runtime or script-settings contexts. All changed paths use established Tokio task-local idioms with correct capture-before-spawn sequencing. The scope_current wrappers are applied consistently across fetch and lifecycle spawn sites. The run_set post-install ensure() call correctly targets the process-wide cell after the install scope has exited, and the bats test now asserts the resulting status message. No logic gaps or missing propagation paths were identified. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "fix(runtime): restore runtime set status" | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 981a00b. Configure here.

Summary
Why
OpenCode starts package installations for independent directories concurrently. PR #1026 made explicit-directory installs and their project locks reentrant, but the install pipeline could still share the selected Node runtime and lifecycle-script settings between projects.
This change removes those remaining mutable snapshots from the concurrent install path. Each install receives its own task-local runtime cell and script-settings slot. Spawned work explicitly inherits the owning install's context, while unrelated installs cannot observe or replace it.
This is a prerequisite for #1025. Once merged, the Node-API addon can remove its addon-wide install mutex and allow independent OpenCode installs to execute in parallel.
Validation
cargo fmt --checkcargo clippy --all-targets -- -D warningscargo testmise run test:bats test/runtime.bats(23 tests)mise run test:bats test/lifecycle_scripts.bats(42 tests)mise run test:bats test/pnpm_install_hooks.bats(21 tests)Note
Medium Risk
Touches install orchestration, runtime resolution, and script env for all lifecycle/fetch spawns; behavior change is intentional for concurrency but regressions could affect wrong Node binary or script settings under parallel installs.
Overview
Parallel installs no longer share a single process-wide Node runtime or lifecycle script settings. Each install runs inside nested task-local scopes (
runtime,aube_scripts, existingdep_chain), withscope_currenton spawned fetch and dependency lifecycle tasks so children inherit the owning install’s context. Non-install CLI commands still use the process-wide fallbacks.The install entry path is
run_scoped, which nests those scopes andBox::pinsrun_innerto avoid Tokio worker stack overflow when scopes stack.aube runtime setre-readspackage.jsonand resolves the lockfile-pinned runtime for its status line instead of trusting a possibly stale process cache.RuntimeContextis now returned asArcfromcurrent/ensure. Isolation is covered by new multi-thread tests; bats expectsnode … ready (aube)afteraube runtime set.Reviewed by Cursor Bugbot for commit 06641d9. Bugbot is set up for automated code reviews on this repo. Configure here.