Skip to content

fix(ui): install devDependencies during ui:build (closes #53027)#59267

Merged
obviyus merged 2 commits into
openclaw:mainfrom
juliabush:fix/ui-build-install
Apr 2, 2026
Merged

fix(ui): install devDependencies during ui:build (closes #53027)#59267
obviyus merged 2 commits into
openclaw:mainfrom
juliabush:fix/ui-build-install

Conversation

@juliabush

Copy link
Copy Markdown
Contributor

Summary

  • Problem: ui:build installs production-only dependencies (--prod + NODE_ENV=production), which strips devDependencies required for Vite/PostCSS.
  • Why it matters: Fresh installs fail to build the Control UI, breaking gateway startup unless users manually reinstall dependencies.
  • What changed: Removed production-only install logic and always run pnpm install with full dependency set.
  • What did NOT change (scope boundary): No changes to UI code, build config, or dependency versions.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause / Regression History (if applicable)

  • Root cause: scripts/ui.js conditionally installs dependencies with --prod and NODE_ENV=production during build, removing required devDependencies.
  • Missing detection / guardrail: No check ensuring required UI build tooling (vite, postcss) remains available after install.
  • Prior context: Introduced as an optimization to reduce install size, but incompatible with build-time tooling requirements.
  • Why this regressed now: UI build depends on devDependencies; production-only install breaks modern Vite pipeline.
  • If unknown, what was ruled out: N/A

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
  • Target test or file: UI bootstrap / gateway startup flow
  • Scenario the test should lock in: Fresh clone → ui:build succeeds without manual install
  • Why this is the smallest reliable guardrail: Requires full install + build pipeline validation
  • Existing test that already covers this (if any): None
  • If no new test is added, why not: Out of scope for minimal fix

User-visible / Behavior Changes

  • Fresh installs no longer fail during UI build
  • No manual pnpm install workaround required

Diagram (if applicable)

Before:
ui:build -> install --prod -> missing dev deps -> build fails

After:
ui:build -> install -> full deps -> build succeeds

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: Linux (Ubuntu)
  • Runtime/container: local
  • Model/provider: N/A
  • Integration/channel: CLI
  • Relevant config (redacted): default

Steps

  1. Fresh clone repo
  2. Run pnpm ui:build
  3. Observe build

Expected

  • UI builds successfully

Actual

  • Fails due to missing devDependencies

Evidence

  • Trace/log snippets

Human Verification (required)

  • Verified scenarios:
    • Fresh install + build succeeds
    • Gateway no longer errors on missing UI assets
  • Edge cases checked:
    • Re-running build does not reinstall unnecessarily
  • What you did not verify:
    • CI environments
    • Windows-specific behavior

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Risks and Mitigations

  • Risk: Slightly larger dependency install footprint
    • Mitigation: Required for correct build; aligns with standard Vite workflows

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Apr 1, 2026
@greptile-apps

greptile-apps Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a real bug where ui:build ran pnpm install --prod with NODE_ENV=production, stripping the devDependencies (e.g. vite, postcss) required for the build step, causing fresh installs to fail. The approach — removing --prod and the NODE_ENV override — is correct in spirit, but the implementation is incomplete: installEnv = process.env still passes any NODE_ENV=production that the caller's environment already has set (common in CI). pnpm treats an ambient NODE_ENV=production the same as --prod, so the root cause would regress in CI even without the explicit flag.

Key changes:

  • Removes --prod flag from pnpm install during ui:build — correct.
  • Removes explicit NODE_ENV: "production" injection — correct.
  • Does not neutralize a pre-existing NODE_ENV=production from the calling environment — this leaves the fix incomplete for CI pipelines.

The suggested fix is to destructure NODE_ENV out of process.env before passing it to runSync, so the install always sees a clean environment regardless of the caller.

Confidence Score: 4/5

  • Safe to merge for local development, but the P1 NODE_ENV passthrough means the bug will regress in any CI environment where NODE_ENV=production is already set.
  • The fix is directionally correct and solves the local development case. One P1 finding remains: process.env is passed as-is to pnpm install, so an ambient NODE_ENV=production from the calling environment (standard in CI) would still cause pnpm to omit devDependencies — the exact failure mode the PR intends to fix. The PR author explicitly noted CI environments were not verified. A one-line destructuring fix resolves this cleanly.
  • scripts/ui.js — specifically the installEnv assignment at line 187.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: scripts/ui.js
Line: 187-188

Comment:
**`NODE_ENV=production` passthrough still skips devDependencies in CI**

The fix removes the explicit `{ ...process.env, NODE_ENV: "production" }` override and the `--prod` flag, which is correct. However, `installEnv = process.env` is a direct reference to the current environment — meaning that if the caller already has `NODE_ENV=production` set (which CI pipelines routinely do), pnpm will still install production-only dependencies and skip `devDependencies` like `vite` and `postcss`. The original bug would regress in any environment where `NODE_ENV` is already `"production"`.

The fix should explicitly neutralize `NODE_ENV` for the install step:

```suggestion
    const { NODE_ENV: _stripped, ...installEnv } = process.env;
    const installArgs = ["install"];
```

This removes `NODE_ENV` from the environment passed to `pnpm install` without mutating `process.env`, ensuring devDependencies are always installed regardless of the calling environment. The actual build step (`run(runner.cmd, ...)`) still inherits the full `process.env` (including any `NODE_ENV=production`), so production-mode bundling behaviour is preserved.

Note: The PR description explicitly acknowledges "What you did NOT verify: CI environments" — this is likely why the regression would only surface there.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(ui): install devDependencies during ..." | Re-trigger Greptile

Comment thread scripts/ui.js
@obviyus obviyus self-assigned this Apr 2, 2026
@obviyus
obviyus force-pushed the fix/ui-build-install branch from bd3a492 to 64219a8 Compare April 2, 2026 09:00

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

Reviewed latest changes; landing now.

@obviyus
obviyus force-pushed the fix/ui-build-install branch from 64219a8 to 956b838 Compare April 2, 2026 09:04
@obviyus
obviyus merged commit 5c36c2d into openclaw:main Apr 2, 2026
9 checks passed
@obviyus

obviyus commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Landed on main.

Thanks @juliabush.

ngutman pushed a commit that referenced this pull request Apr 3, 2026
)

* fix(ui): install devDependencies during ui:build

* fix: keep ui:build self-heal documented (#59267) (thanks @juliabush)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
steipete pushed a commit to duncanita/openclaw that referenced this pull request Apr 4, 2026
…juliabush)

* fix(ui): install devDependencies during ui:build

* fix: keep ui:build self-heal documented (openclaw#59267) (thanks @juliabush)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
michaelhaessig added a commit to michaelhaessig/clawdbot that referenced this pull request Apr 17, 2026
scripts/ui.js self-installs devDeps for ui:build (openclaw#59267), and the
extra ui:install was removing workspace packages without re-adding
them, leaving vite off PATH.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…juliabush)

* fix(ui): install devDependencies during ui:build

* fix: keep ui:build self-heal documented (openclaw#59267) (thanks @juliabush)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…juliabush)

* fix(ui): install devDependencies during ui:build

* fix: keep ui:build self-heal documented (openclaw#59267) (thanks @juliabush)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…juliabush)

* fix(ui): install devDependencies during ui:build

* fix: keep ui:build self-heal documented (openclaw#59267) (thanks @juliabush)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…juliabush)

* fix(ui): install devDependencies during ui:build

* fix: keep ui:build self-heal documented (openclaw#59267) (thanks @juliabush)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
Nachx639 pushed a commit to Nachx639/clawdbot that referenced this pull request Jun 17, 2026
…juliabush)

* fix(ui): install devDependencies during ui:build

* fix: keep ui:build self-heal documented (openclaw#59267) (thanks @juliabush)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scripts Repository scripts size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui:build installs production-only deps and breaks Control UI asset generation

2 participants