fix(gateway): sync dirty plugin metadata in watch mode · openclaw/openclaw@6e3fd67
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -17,6 +17,17 @@ const manifest = JSON.parse(
|
17 | 17 | }>; |
18 | 18 | }; |
19 | 19 | |
| 20 | +const packageJson = JSON.parse( |
| 21 | +readFileSync(new URL("./package.json", import.meta.url), "utf8"), |
| 22 | +) as { |
| 23 | +dependencies?: Record<string, string>; |
| 24 | +openclaw?: { |
| 25 | +bundle?: { |
| 26 | +stageRuntimeDependencies?: boolean; |
| 27 | +}; |
| 28 | +}; |
| 29 | +}; |
| 30 | + |
20 | 31 | function manifestComparableWizardFields(choice: { |
21 | 32 | choiceId?: string; |
22 | 33 | choiceLabel?: string; |
@@ -53,6 +64,12 @@ function providerWizardByKey() {
|
53 | 64 | } |
54 | 65 | |
55 | 66 | describe("OpenAI plugin manifest", () => { |
| 67 | +it("opts into staging bundled runtime dependencies", () => { |
| 68 | +expect(packageJson.dependencies?.["@mariozechner/pi-ai"]).toBe("0.70.6"); |
| 69 | +expect(packageJson.dependencies?.ws).toBe("^8.20.0"); |
| 70 | +expect(packageJson.openclaw?.bundle?.stageRuntimeDependencies).toBe(true); |
| 71 | +}); |
| 72 | + |
56 | 73 | it("keeps removed Codex CLI import auth choice as a deprecated browser-login alias", () => { |
57 | 74 | const codexBrowserLogin = manifest.providerAuthChoices?.find( |
58 | 75 | (choice) => choice.choiceId === "openai-codex", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,9 @@
|
12 | 12 | "@openclaw/plugin-sdk": "workspace:*" |
13 | 13 | }, |
14 | 14 | "openclaw": { |
| 15 | +"bundle": { |
| 16 | +"stageRuntimeDependencies": true |
| 17 | + }, |
15 | 18 | "extensions": [ |
16 | 19 | "./index.ts" |
17 | 20 | ] |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -798,7 +798,10 @@ const writeBuildStamp = (deps) => {
|
798 | 798 | } |
799 | 799 | }; |
800 | 800 | |
801 | | -const shouldSkipCleanWatchRuntimeSync = (deps) => deps.env.OPENCLAW_WATCH_MODE === "1"; |
| 801 | +const shouldSkipWatchRuntimeSync = (deps, requirement) => |
| 802 | +deps.env.OPENCLAW_WATCH_MODE === "1" && |
| 803 | +requirement.reason === "missing_runtime_postbuild_stamp" && |
| 804 | +hasDirtyRuntimePostBuildInputs(deps) !== true; |
802 | 805 | |
803 | 806 | const isGatewayClientCommand = (args) => |
804 | 807 | args[0] === "gateway" && (args[1] === "call" || args[1] === "status"); |
@@ -885,9 +888,12 @@ export async function runNodeMain(params = {}) {
|
885 | 888 | return await closeRunNodeOutputTee(deps, exitCode); |
886 | 889 | } |
887 | 890 | if (!buildRequirement.shouldBuild) { |
888 | | -if (!useExistingGatewayClientDist && !shouldSkipCleanWatchRuntimeSync(deps)) { |
| 891 | +if (!useExistingGatewayClientDist) { |
889 | 892 | const runtimePostBuildRequirement = resolveRuntimePostBuildRequirement(deps); |
890 | | -if (runtimePostBuildRequirement.shouldSync) { |
| 893 | +if ( |
| 894 | +runtimePostBuildRequirement.shouldSync && |
| 895 | +!shouldSkipWatchRuntimeSync(deps, runtimePostBuildRequirement) |
| 896 | +) { |
891 | 897 | const synced = await withRunNodeBuildLock(deps, async () => { |
892 | 898 | const lockedRuntimePostBuildRequirement = resolveRuntimePostBuildRequirement(deps); |
893 | 899 | if (!lockedRuntimePostBuildRequirement.shouldSync) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -697,6 +697,44 @@ describe("run-node script", () => {
|
697 | 697 | }); |
698 | 698 | }); |
699 | 699 | |
| 700 | +it("restages dirty runtime metadata in watch mode when dist is already current", async () => { |
| 701 | +await withTempDir({ prefix: "openclaw-run-node-" }, async (tmp) => { |
| 702 | +await setupTrackedProject(tmp, { |
| 703 | +files: { |
| 704 | +[ROOT_SRC]: "export const value = 1;\n", |
| 705 | +[EXTENSION_PACKAGE]: '{"openclaw":{"bundle":{"stageRuntimeDependencies":true}}}\n', |
| 706 | +[RUNTIME_POSTBUILD_STAMP]: '{"head":"abc123"}\n', |
| 707 | +}, |
| 708 | +buildPaths: [ |
| 709 | +ROOT_SRC, |
| 710 | +EXTENSION_PACKAGE, |
| 711 | +ROOT_TSCONFIG, |
| 712 | +ROOT_PACKAGE, |
| 713 | +DIST_ENTRY, |
| 714 | +BUILD_STAMP, |
| 715 | +RUNTIME_POSTBUILD_STAMP, |
| 716 | +], |
| 717 | +}); |
| 718 | + |
| 719 | +const runRuntimePostBuild = vi.fn(); |
| 720 | +const { spawnCalls, spawn, spawnSync } = createSpawnRecorder({ |
| 721 | +gitHead: "abc123\n", |
| 722 | +gitStatus: ` M ${EXTENSION_PACKAGE}\n`, |
| 723 | +}); |
| 724 | +const exitCode = await runStatusCommand({ |
| 725 | + tmp, |
| 726 | + spawn, |
| 727 | + spawnSync, |
| 728 | +env: { OPENCLAW_WATCH_MODE: "1" }, |
| 729 | + runRuntimePostBuild, |
| 730 | +}); |
| 731 | + |
| 732 | +expect(exitCode).toBe(0); |
| 733 | +expect(spawnCalls).toEqual([statusCommandSpawn()]); |
| 734 | +expect(runRuntimePostBuild).toHaveBeenCalledOnce(); |
| 735 | +}); |
| 736 | +}); |
| 737 | + |
700 | 738 | it("runs QA parity report from source without rebuilding private QA dist", async () => { |
701 | 739 | await withTempDir({ prefix: "openclaw-run-node-" }, async (tmp) => { |
702 | 740 | await setupTrackedProject(tmp, { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。