#8644: Fix Control UI asset resolution for global installs
app: web-ui
stale
Cluster:
UI Improvements and Fixes
## Summary
- Resolve Control UI dist path using module URL/cwd fallback so global npm shims don’t break detection.
- Use import.meta.url in asset checks to avoid false “Missing Control UI assets”.
- Add unit test for shim argv1 + moduleUrl scenario.
## Testing
- pnpm exec vitest src/infra/control-ui-assets.test.ts
## Verification
- Local global-install check: dist/control-ui/index.html present in global package.
- Gateway startup did not report “Missing Control UI assets” (startup required config/token).
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR improves Control UI asset detection in global-install scenarios by enhancing `resolveControlUiDistIndexPath` to accept `{ argv1, moduleUrl, cwd }` and by calling it from `ensureControlUiAssetsBuilt` with `import.meta.url` and `process.cwd()` so that global npm shim paths don’t break package-root resolution. It also adds a unit test covering the shim `argv1` + `moduleUrl` fallback path.
Overall, this fits into the existing multi-candidate asset/root resolution approach (`openclaw-root.ts` and `control-ui-assets.ts`) by expanding the inputs used to locate the package root and Control UI `dist/control-ui/index.html`.
<h3>Confidence Score: 4/5</h3>
- This PR looks safe to merge and should improve Control UI asset detection for global installs.
- The changes are localized to asset resolution and add a targeted unit test; the main concern is an early-return that can still drop the new moduleUrl/cwd fallbacks when argv1 is missing, which could limit the fix in certain launch environments.
- src/infra/control-ui-assets.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#16037: fix(canvas): resolve A2UI assets from dist + retry resolution
by AlexAnys · 2026-02-14
78.6%
#20585: fix: pre-flight ownership check before global update
by mwfj · 2026-02-19
76.3%
#9628: fix: resolve tsconfig rootDir errors by separating UI config (AI-as...
by KGBos · 2026-02-05
75.2%
#12804: fix(daemon): use wrapper script for pnpm global installs in service...
by odinho · 2026-02-09
75.1%
#9803: fix(#9801): auto-build control ui assets on demand
by dead-pool-aka-wilson · 2026-02-05
74.5%
#17237: fix(update): guard post-install imports after npm global update
by tdjackey · 2026-02-15
74.3%
#17815: fix: use $HOME as cwd for global update to prevent path-dedot panic
by frankekn · 2026-02-16
73.6%
#18961: fix: detect pnpm package manager in openclaw update
by norci · 2026-02-17
73.3%
#13960: fix(ui): preserve structured config validation error details
by constansino · 2026-02-11
73.0%
#22910: fix(browser): resolve symlinks in upload path validation
by erdinccurebal · 2026-02-21
72.9%