From 0b25e889a57fea7c26d66ea58618d62d36643fb5 Mon Sep 17 00:00:00 2001 From: joshp123 Date: Sat, 9 May 2026 01:30:55 +0800 Subject: [PATCH] fix: keep dogfood public surface hardlink-safe Dogfood now points at an OpenClaw commit with the broader plugin hardlink work merged, but the bundled public-surface loader still needs nix-openclaw's package-root hardlink compatibility patch. Keep that patch active for dogfood and add a package-content check that fails if the compiled loader rejects hardlinked package files again. Tests: nix fmt --accept-flake-config; git diff --check; remote mac-mini nix build .#checks.aarch64-darwin.package-contents-dogfood --no-link; remote mac-mini nix build .#checks.aarch64-darwin.package-contents --no-link; remote mac-mini nix build .#checks.aarch64-darwin.default-instance --no-link Co-authored-by: Codex --- flake.nix | 3 +++ ...low-package-public-surface-hardlinks.patch | 22 +++++-------------- nix/scripts/check-package-contents.sh | 12 ++++++++++ nix/sources/openclaw-dogfood-source.nix | 1 - 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index 2a144ec..164758f 100644 --- a/flake.nix +++ b/flake.nix @@ -105,6 +105,9 @@ package-contents = pkgs.callPackage ./nix/checks/openclaw-package-contents.nix { openclawGateway = packageSetStable.openclaw-gateway; }; + package-contents-dogfood = pkgs.callPackage ./nix/checks/openclaw-package-contents.nix { + openclawGateway = packageSetDogfood.openclaw-gateway; + }; default-instance = pkgs.callPackage ./nix/checks/openclaw-default-instance.nix { }; config-validity = pkgs.callPackage ./nix/checks/openclaw-config-validity.nix { openclawGateway = packageSetStable.openclaw-gateway; diff --git a/nix/patches/allow-package-public-surface-hardlinks.patch b/nix/patches/allow-package-public-surface-hardlinks.patch index 6dde09a..56c7802 100644 --- a/nix/patches/allow-package-public-surface-hardlinks.patch +++ b/nix/patches/allow-package-public-surface-hardlinks.patch @@ -1,25 +1,13 @@ diff --git a/src/plugins/public-surface-loader.ts b/src/plugins/public-surface-loader.ts -index 1f5b5ab..c9727e1 100644 +index 5f6f939..8cb550f 100644 --- a/src/plugins/public-surface-loader.ts +++ b/src/plugins/public-surface-loader.ts -@@ -116,13 +116,16 @@ export function loadBundledPluginPublicArtifactModuleSync(para - if (cached) { - return cached as T; - } -- -+ const packageRoot = path.resolve(OPENCLAW_PACKAGE_ROOT); -+ const resolvedModulePath = path.resolve(location.modulePath); -+ const isPackagePublicSurface = resolvedModulePath.startsWith(`${packageRoot}${path.sep}`); -+ - const opened = openBoundaryFileSync({ - absolutePath: location.modulePath, +@@ -128,7 +128,7 @@ export function loadBundledPluginPublicArtifactModuleSync(para rootPath: location.boundaryRoot, -- boundaryLabel: -- location.boundaryRoot === OPENCLAW_PACKAGE_ROOT ? "OpenClaw package root" : "plugin root", + boundaryLabel: + location.boundaryRoot === OPENCLAW_PACKAGE_ROOT ? "OpenClaw package root" : "plugin root", - rejectHardlinks: true, -+ boundaryLabel: -+ location.boundaryRoot === OPENCLAW_PACKAGE_ROOT ? "OpenClaw package root" : "plugin root", -+ rejectHardlinks: !isPackagePublicSurface, ++ rejectHardlinks: location.boundaryRoot !== OPENCLAW_PACKAGE_ROOT, }); if (!opened.ok) { throw new Error( diff --git a/nix/scripts/check-package-contents.sh b/nix/scripts/check-package-contents.sh index 2fd4615..8bc77bc 100755 --- a/nix/scripts/check-package-contents.sh +++ b/nix/scripts/check-package-contents.sh @@ -35,6 +35,18 @@ require_path "${root}/skills" require_path "${root}/node_modules/hasown" require_path "${root}/node_modules/combined-stream" +public_surface_loader="$( + grep -Rsl "function loadBundledPluginPublicArtifactModuleSync" "${root}/dist" | head -1 +)" +if [ -z "$public_surface_loader" ]; then + echo "Missing bundled plugin public surface loader" >&2 + exit 1 +fi +if grep -q "rejectHardlinks: true" "$public_surface_loader"; then + echo "Bundled plugin public surface loader still rejects hardlinked package files" >&2 + exit 1 +fi + require_js_alias_target() { alias="$1" alias_path="${root}/dist/${alias}" diff --git a/nix/sources/openclaw-dogfood-source.nix b/nix/sources/openclaw-dogfood-source.nix index 16cce37..4bf5b86 100644 --- a/nix/sources/openclaw-dogfood-source.nix +++ b/nix/sources/openclaw-dogfood-source.nix @@ -12,6 +12,5 @@ hash = "sha256-jndOOSSFROyrK4RiwAsJfUuCJTj7qbmmm4Qz8BqtJ/c="; }; - applyPublicSurfaceHardlinksPatch = false; applySkipPluginAutoEnableNixModePatch = false; }