← Back to PRs

#8644: Fix Control UI asset resolution for global installs

by codvik open 2026-02-04 07:33 View on GitHub →
app: web-ui stale
## 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