mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 03:00:21 +00:00
fix(doctor): align qmd probe cwd with runtime
This commit is contained in:
@@ -6,6 +6,7 @@ import type { checkQmdBinaryAvailability as checkQmdBinaryAvailabilityFn } from
|
||||
const note = vi.hoisted(() => vi.fn());
|
||||
const resolveDefaultAgentId = vi.hoisted(() => vi.fn(() => "agent-default"));
|
||||
const resolveAgentDir = vi.hoisted(() => vi.fn(() => "/tmp/agent-default"));
|
||||
const resolveAgentWorkspaceDir = vi.hoisted(() => vi.fn(() => "/tmp/agent-default/workspace"));
|
||||
const resolveMemorySearchConfig = vi.hoisted(() => vi.fn());
|
||||
const resolveApiKeyForProvider = vi.hoisted(() => vi.fn());
|
||||
const resolveActiveMemoryBackendConfig = vi.hoisted(() => vi.fn());
|
||||
@@ -21,6 +22,7 @@ vi.mock("../terminal/note.js", () => ({
|
||||
vi.mock("../agents/agent-scope.js", () => ({
|
||||
resolveDefaultAgentId,
|
||||
resolveAgentDir,
|
||||
resolveAgentWorkspaceDir,
|
||||
}));
|
||||
|
||||
vi.mock("../agents/memory-search.js", () => ({
|
||||
@@ -62,6 +64,7 @@ describe("noteMemorySearchHealth", () => {
|
||||
note.mockClear();
|
||||
resolveDefaultAgentId.mockClear();
|
||||
resolveAgentDir.mockClear();
|
||||
resolveAgentWorkspaceDir.mockClear();
|
||||
resolveMemorySearchConfig.mockReset();
|
||||
resolveApiKeyForProvider.mockReset();
|
||||
resolveApiKeyForProvider.mockRejectedValue(new Error("missing key"));
|
||||
@@ -141,6 +144,11 @@ describe("noteMemorySearchHealth", () => {
|
||||
await noteMemorySearchHealth(cfg, {});
|
||||
|
||||
expect(note).not.toHaveBeenCalled();
|
||||
expect(checkQmdBinaryAvailability).toHaveBeenCalledWith({
|
||||
command: "qmd",
|
||||
env: process.env,
|
||||
cwd: "/tmp/agent-default/workspace",
|
||||
});
|
||||
});
|
||||
|
||||
it("warns when QMD backend is active but the qmd binary is unavailable", async () => {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import fsSync from "node:fs";
|
||||
import { resolveAgentDir, resolveDefaultAgentId } from "../agents/agent-scope.js";
|
||||
import {
|
||||
resolveAgentDir,
|
||||
resolveAgentWorkspaceDir,
|
||||
resolveDefaultAgentId,
|
||||
} from "../agents/agent-scope.js";
|
||||
import { resolveMemorySearchConfig } from "../agents/memory-search.js";
|
||||
import { resolveApiKeyForProvider } from "../agents/model-auth.js";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
@@ -58,6 +62,7 @@ export async function noteMemorySearchHealth(
|
||||
const qmdCheck = await checkQmdBinaryAvailability({
|
||||
command: backendConfig.qmd?.command ?? "qmd",
|
||||
env: process.env,
|
||||
cwd: resolveAgentWorkspaceDir(cfg, agentId),
|
||||
});
|
||||
if (!qmdCheck.available) {
|
||||
note(
|
||||
|
||||
Reference in New Issue
Block a user