






























@@ -1,3 +1,6 @@
1+import fs from "node:fs/promises";
2+import os from "node:os";
3+import path from "node:path";
14import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
25import type { OpenClawConfig } from "../config/config.js";
36import { withEnvAsync } from "../test-utils/env.js";
@@ -901,6 +904,38 @@ describe("maybeRepairGatewayServiceConfig", () => {
901904expect(mocks.install).not.toHaveBeenCalled();
902905});
903906});
907+908+it("warns when the gateway service entrypoint resolves to a source checkout", async () => {
909+await withEnvAsync({}, async () => {
910+const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-doctor-service-layout-"));
911+try {
912+await fs.mkdir(path.join(root, ".git"), { recursive: true });
913+await fs.mkdir(path.join(root, "src"), { recursive: true });
914+await fs.mkdir(path.join(root, "extensions"), { recursive: true });
915+await fs.mkdir(path.join(root, "dist"), { recursive: true });
916+await fs.writeFile(
917+path.join(root, "package.json"),
918+JSON.stringify({ name: "openclaw", version: "0.0.0-test" }),
919+"utf8",
920+);
921+const entrypoint = path.join(root, "dist", "index.js");
922+await fs.writeFile(entrypoint, "export {};\n", "utf8");
923+mocks.readCommand.mockResolvedValue(createGatewayCommand(entrypoint));
924+mocks.auditGatewayServiceConfig.mockResolvedValue({ ok: true, issues: [] });
925+mocks.buildGatewayInstallPlan.mockResolvedValue(createGatewayCommand(entrypoint));
926+927+await runRepair({ gateway: {} });
928+929+expect(mocks.note).toHaveBeenCalledWith(
930+expect.stringContaining("resolves to a source checkout"),
931+"Gateway service config",
932+);
933+expect(mocks.install).not.toHaveBeenCalled();
934+} finally {
935+await fs.rm(root, { recursive: true, force: true });
936+}
937+});
938+});
904939});
905940906941describe("maybeScanExtraGatewayServices", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。