Skip to content

fix(xtask): run pnpm install before build_mcp_widget#2070

Merged
rgbkrk merged 1 commit intomainfrom
fix/xtask-build-pnpm-order
Apr 23, 2026
Merged

fix(xtask): run pnpm install before build_mcp_widget#2070
rgbkrk merged 1 commit intomainfrom
fix/xtask-build-pnpm-order

Conversation

@rgbkrk
Copy link
Copy Markdown
Member

@rgbkrk rgbkrk commented Apr 23, 2026

Summary

cargo xtask build on a fresh clone failed because build_mcp_widget was the first step to touch pnpm, and it runs pnpm --filter nteract-mcp-app install — which assumes the workspace is already initialized. Without a prior root pnpm install, that filtered install races with the background root install that cmd_build used to kick off afterwards.

Fix moves ensure_pnpm_install() up to Phase 0a, before the widget build. Drops the now-redundant background-install thread and its join point.

Also fixes the same class of bug in build_with_bundle (cargo xtask build-app / build-dmg): it called run_frontend_build without any upstream pnpm install, so a fresh-clone release build would fail with missing-workspace-package errors. Adds ensure_pnpm_install() right after require_pnpm().

Why the old order existed

cmd_build's background-install thread made sense when build_mcp_widget didn't also shell out to pnpm. At some point the widget step was added and the fresh-clone case silently regressed.

What's unchanged

  • cargo xtask dev, cargo xtask notebook, cargo xtask vite all already call ensure_pnpm_install() synchronously up front. Their ordering is correct and untouched.
  • ensure_pnpm_install() is still idempotent and short-circuits when node_modules/.modules.yaml is newer than package.json and pnpm-lock.yaml — no-op cost on warm trees.
  • build_mcp_widget's own pnpm --filter nteract-mcp-app install is kept as a safety belt for any future caller from a different code path.

Test plan

  • cargo build -p xtask, cargo test -p xtask (9/9), cargo clippy -p xtask --all-targets -- -D warnings — all clean.
  • Ran cargo xtask build on the warm tree; confirmed order of operations is "Skipping pnpm install" → "Skipping MCP Apps widget build" → "Building Rust targets...".
  • CI green.
  • Optional follow-up: smoke test on a fresh checkout (git clone && cargo xtask build) to confirm the original fresh-clone path now succeeds.

Fresh clones failed `cargo xtask build` because `build_mcp_widget`
was the first step to touch pnpm — and it runs
`pnpm --filter nteract-mcp-app install`, which assumes the workspace
is already initialized. Without a prior `pnpm install`, the filtered
install either errors or triggers its own root install sequence,
which races with the background pnpm install that cmd_build used
to fire after.

Fix: move `ensure_pnpm_install()` up to Phase 0a, before
`build_mcp_widget`. Drop the subsequent thread-spawned install plus
its join point — there's nothing left to parallelize with at that
phase since the widget step now runs synchronously after install.

Also fix the same class of bug in `build_with_bundle` (backs
`cargo xtask build-app` / `build-dmg`): it called `run_frontend_build`
without any upstream pnpm install, so a fresh-clone release build
would fail with missing-workspace-package errors.
@rgbkrk rgbkrk merged commit 43a20d1 into main Apr 23, 2026
17 checks passed
@rgbkrk rgbkrk deleted the fix/xtask-build-pnpm-order branch April 23, 2026 05:13
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