fix(update): build and serve Git releases outside node_modules (#201917) ## Problem #201874: on a managed Git install, a Gateway MCP turn fails before replying: ```text warn mcp-loopback request handling failed: Stripping types is currently unsupported for files under node_modules, for "<state-dir>/git-install/releases/<release>/lib/node_modules/openclaw/extensions/deepseek/web-search-contract-api.ts" error Embedded agent failed before reply: Claude Code started without the OpenClaw MCP server (status failed). ``` #199706 put each Git release, a full worktree with plugin TypeScript sources, at `releases/<id>/lib/node_modules/openclaw`. Two path rules then meet: 1. `resolvePublicSurfacePath` (`src/plugins/public-surface-runtime.ts`) picks `extensions/<plugin>/<file>.ts` before `dist` when the source exists. Only a Git release has sources; the npm package ships `dist/` only. 2. The plugin loader's Jiti options add `"openclaw"` to `nativeModules` (`src/plugins/sdk-alias.ts`). Jiti 2.7.0 turns that into `node_modules/(openclaw)/` and loads any match natively, even with `tryNative: false` (`src/require.ts:131`). Node then refuses (`lib/internal/modules/typescript.js:188`, `isUnderNodeModules(filename)`). The updater missed it because it validated a different path than it serves: `buildRelease` built and checked the release at `releases/<id>/build`, then `git worktree move` put it under `node_modules`. The only check at the final path was `openclaw.mjs --version` (`update-runner-git-release.ts`, `git-release-smoke`), which loads no plugin. Reproduced on a real release tree built by `main` at 18b04f2fd5 (2026-11-19) on this machine, through Jiti with `nativeModules: ["openclaw"]` and `tryNative: false`: `ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING` for `extensions/brave/web-search-contract-api.ts`, through both the real path and the link path. The same class, TypeScript at runtime under `node_modules`, appeared before as #19815 (2026-02-18) and #53953 (2026-03-24). ## Change Remove the cause in the owner: Git releases no longer live under `node_modules`. - Layout: `<state>/git-install/openclaw -> releases/<id>/openclaw`. Moving only the tree is not enough: the Gateway names its root by the link (`openclaw-root.ts`), and Jiti matches the link path string too. - Each release is built and validated where it serves. The build-beside-and-move step (`buildDir`, `git-release-place`) is deleted. A release path that a loader rule breaks now breaks the build before activation. - `package-release-slot-path.ts` keeps one rule for both layouts: a release keeps the package at the link's path below the prefix (npm `lib/node_modules/<name>`, Git `<name>`). Lease, retention and the switch's deselect stamp use it, not npm-only `dirname` math. - Retention resolves each retained release at the link's layout or at npm's `lib/node_modules/<name>`, where releases built before the move still live. `update status` keeps listing them, and an open update run that names one still protects it. - Migration: `servingGitReleaseSlot` reads the old link while it still serves. The first update run by this release rebuilds the serving commit at the new path, publishes the new link, and removes the old link. The old Gateway then sees its installation replaced and restarts through the launcher, which now starts the new link. No loader exception, no second source/dist rule, no flag. ## Impact - Managed Git installs load bundled plugin sources again. - Dev-channel installs on `main` builds since #199706 (they report version 2026.11.5; no published release has the layout) need one more `openclaw update` after the update to this change, because the older updater drives that first hop and still builds under the old path. - npm, plain checkouts, Docker and package-to-Git switches are unchanged. ## Evidence - **Regression test** (`src/infra/git-release.test.ts`, "loads a bundled plugin's source contract from the selected release (#201874)"). It copies `extensions/deepseek` into a release made by `createGitReleaseDirs`, publishes it, and loads `web-search-contract-api` through `loadPluginPublicArtifactModuleSync` from the release link path. - On `main` (307d9c45): fails. Under Vitest the `tsx` hooks strip the types, so the symptom is `ERR_MODULE_NOT_FOUND` for `openclaw/plugin-sdk/lazy-runtime`: the forced native import resolves the bare `openclaw/...` specifier to the release tree itself. Same cause. - On this branch: passes (`git-release.test.ts` 12/12). - **Migration test** (`update-runner-git-release.test.ts`). A release under `lib/node_modules` is rebuilt at the new path, the new link's real path has no `node_modules` segment, and the old link is gone. - **Mixed-layout inventory test** (`git-release.test.ts`). After the link moves out, a release still under `lib/node_modules/openclaw` stays listed by `listPackageReleases`, the source of `openclaw update status`. - **Exact error on a real tree.** A release built by `main` (18b04f2fd5) on a Mac profile, loaded through Jiti 2.7.0 with `nativeModules: ["openclaw"]` and `tryNative: false`: `ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING … extensions/brave/web-search-contract-api.ts`, through both the real path and the link path. - **Mutation proof (build at the final path).** The release build (`node --import ./scripts/tsx.mjs scripts/build-all.mts`): - In a worktree at `releases/r1/lib/node_modules/openclaw`: fails at once with `ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING … scripts/lib/local-check-runtime.mts`. - The same commit at `out/r2/openclaw`: passes that stage (`runtime:scripts:check` 4.61 s). - So a release path that a loader rule breaks now fails the update before activation. - **Stable tag unaffected.** A Docker lane run with a real service install of tag `v2026.11.5` (e13cf15): its updater returned `status: ok`, `root: …/git-checkout`, steps `clean-check, git-resolve-target, recovery-artifact-cleanup`. No release link was created. No published release has the release layout. - **Gates:** `pnpm tsgo:core` exit 0; line-cap check OK (13 files); oxlint and oxfmt clean on changed files. - **Every test file that reads the release layout:** 21 files. `rg -l 'git-release|gitReleaseSlot|GIT_RELEASE|usesGitReleases|package-release-slot-path|package-release-lease' src --glob '*.test.ts'`, plus `openclaw-root`, `program-args*`, `service-layout` and `stale-install`. All pass. - The first batch run (4 workers, load 22–49) timed out 6 update-cli cases. Rerun with 2 workers: 141/141. - Four suites did not load in that batch because a parallel scenario edit changed `scripts/` during the run. Rerun alone: 40/40 and 35/35. ## Not proven here - **Real upgrade from `7db69bedeab6` (the reporter's build) to this change, with a Gateway request that loads the web-search contracts.** A Linux upgrade-survivor `git-release` scenario reached the stable-tag baseline above; the run from `7db69bedeab6` did not finish before landing. The scenario is not in this PR. The reporter is asked to confirm on #201874. - **Windows.** No Windows host completed a run. On `main`, Windows Git checkouts never use releases (`usesGitReleases` returns false on win32), so they are unaffected by the bug and by this change. That comes from the code, not a run. - **The old Gateway restarting after the old link is removed.** Before this change the Gateway saw the link move; here the link disappears. INFERENCE: it reads as installation replacement too. Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Current
·
C2
·2026-11
fix(update): build and serve Git releases outside node_modules (#201917)
Find Your Interest
- fix: stop openclaw update from bricking a pnpm-linked Git checkout wh…
- fix: Git checkout updates no longer fail before the new release start…
- Critical PHP Security Release
- openclaw 2026.11.10-beta.1
- fix: keep empty chats free of message-loading placeholders (#201495)
- fix: keep the openclaw command and Gateway working after updating a p…
- fix: let the hosted model catalog publish again with the 2026.10.33 e…
- fix: explain the security audit from its info icon on Template and pl…
- fix: finish updates when another tool reads OpenClaw's databases duri…
- fix(ui): guide Chat to setup when no model is connected
Current
·
C2
·2026-11





