Skip to content

chore: finish slimclaw runtime convergence#1087

Merged
lefarcen merged 37 commits intomainfrom
feat/openclaw-runtime-optimization
Apr 15, 2026
Merged

chore: finish slimclaw runtime convergence#1087
lefarcen merged 37 commits intomainfrom
feat/openclaw-runtime-optimization

Conversation

@PerishCode
Copy link
Copy Markdown
Contributor

What

Converges repo-local OpenClaw runtime ownership behind packages/slimclaw, migrates the local dev CLI into tools/dev, and removes the controller-side fallback that was duplicating slimclaw runtime assets into the Windows desktop package.

Why

This branch finishes the runtime-boundary cleanup needed to keep desktop/dev flows controller-first while shrinking packaging risk and clarifying runtime ownership. It also fixes the Windows installer bloat caused by the controller sidecar carrying a full slimclaw runtime payload instead of relying on desktop/dev launcher injection.

How

  • moves the repo-local runtime contract, staging, and patch ownership into packages/slimclaw
  • migrates the pnpm dev implementation from scripts/dev to tools/dev and hardens service readiness/progress reporting
  • routes controller runtime resolution through launcher-injected OPENCLAW_* env instead of a direct slimclaw runtime dependency, which removes duplicated sidecar payloads in Windows packaging
  • updates desktop packaging / CI / workflow paths to follow the slimclaw-owned runtime layout

Affected areas

  • Desktop app (Electron shell)
  • Controller (backend / API)
  • Web dashboard (React UI)
  • OpenClaw runtime
  • Skills
  • Shared schemas / packages
  • Build / CI / Tooling

Checklist

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes
  • pnpm generate-types run (if API routes/schemas changed)
  • No credentials or tokens in code or logs
  • No any types introduced (use unknown with narrowing)

Notes for reviewers

  • The Windows packaging regression that originally produced an ~885 MB installer has been reduced to ~338 MB after removing the controller runtime dependency on @nexu/slimclaw.
  • Manual Windows install / launch / uninstall regression was run successfully on the rebuilt installer, and follow-up log review did not surface unexpected fatal errors.

PerishCode and others added 25 commits April 9, 2026 14:09
docs: add slimclaw runtime unification plan
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac091c3438

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/controller/src/runtime/slimclaw-runtime-resolution.ts
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 14, 2026

Deploying nexu-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: d991005
Status: ✅  Deploy successful!
Preview URL: https://f59c25fe.nexu-docs.pages.dev
Branch Preview URL: https://feat-openclaw-runtime-optimi.nexu-docs.pages.dev

View logs

@lefarcen
Copy link
Copy Markdown
Collaborator

Reviewed the runtime-resolution layer against the actual sources. Three things worth a second look before merging:

1. resolveExplicitEnvRuntime env check and error message disagree

apps/controller/src/runtime/slimclaw-runtime-resolution.ts:54,90-92

The explicit-env branch is keyed only on OPENCLAW_EXTENSIONS_DIR, but the error thrown when neither branch matches says requires OPENCLAW_BIN and OPENCLAW_EXTENSIONS_DIR from the launcher. If a launcher injects OPENCLAW_BIN but forgets OPENCLAW_EXTENSIONS_DIR, the operator reads the message and goes hunting for a missing OPENCLAW_BIN that is actually present.

Either assert env.openclawBin is non-default inside resolveExplicitEnvRuntime, or make the error name the variable that is actually missing.

2. resolveOpenClawEntryFromBin has no existence check

apps/controller/src/runtime/slimclaw-runtime-resolution.ts:31-49,59-61

entryPath is derived purely from path arithmetic (<bin>/../node_modules/openclaw/openclaw.mjs), with a packageDir/openclaw.mjs fallback. If a launcher ever injects an OPENCLAW_BIN that does not match that layout and the fallback also doesn't exist, the failure surfaces only when OPENCLAW_ELECTRON_EXECUTABLE is set and spawn runs with a bogus entry path — far from the misconfiguration.

Consider fs.existsSync(entryPath) before returning, and throw with the attempted path if missing.

3. OPENCLAW_BIN default "openclaw" conflicts with the packaged-app PATH rule

apps/controller/src/app/env.ts:96

OPENCLAW_BIN defaults to the literal string "openclaw", which relies on the user's PATH. AGENTS.md is explicit: packaged desktop must never depend on the user's PATH. In the external-bin-only branch (manageOpenclawProcess=false + launcher forgets OPENCLAW_BIN), the controller silently falls back to spawning "openclaw" against PATH in a context where PATH is not defined for packaged Electron children. The explicit-env branch indirectly hides this today because it gates on OPENCLAW_EXTENSIONS_DIR, but the default is still a live foot-gun.

Either drop the default and require explicit injection, or add a guard in resolveControllerOpenClawRuntime that refuses the literal unresolved "openclaw" in packaged mode.


Orthogonal nit: the PR checklist still has pnpm typecheck / lint / test unchecked. Given the scope (5007+/4052-, cross-package symbol renames), pasting a green CI run into the PR body before merge would be reassuring.

Everything else I checked — OpenClaw 2026.3.7 version alignment, CI cache key (packages/slimclaw/runtime-seed/package-lock.json exists), scripts/dev-launchd.sh references, doc sync in AGENTS/README/CLAUDE, consumer call sites of resolveControllerOpenClawRuntime — all looked clean.

@lefarcen lefarcen merged commit 6ff1507 into main Apr 15, 2026
26 of 27 checks passed
@mrcfps mrcfps deleted the feat/openclaw-runtime-optimization branch April 15, 2026 07:00
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.

2 participants