test(codex): mock lightweight app-server runtime

This commit is contained in:
Peter Steinberger
2026-04-23 05:45:49 +01:00
parent d5c0f70e95
commit 56c7ed0f8a
3 changed files with 10 additions and 7 deletions

View File

@@ -1,9 +1,12 @@
import { callGatewayTool, type EmbeddedRunAttemptParams } from "openclaw/plugin-sdk/agent-harness";
import {
callGatewayTool,
type EmbeddedRunAttemptParams,
} from "openclaw/plugin-sdk/agent-harness-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { buildApprovalResponse, handleCodexAppServerApprovalRequest } from "./approval-bridge.js";
vi.mock("openclaw/plugin-sdk/agent-harness", async (importOriginal) => ({
...(await importOriginal<typeof import("openclaw/plugin-sdk/agent-harness")>()),
vi.mock("openclaw/plugin-sdk/agent-harness-runtime", async (importOriginal) => ({
...(await importOriginal<typeof import("openclaw/plugin-sdk/agent-harness-runtime")>()),
callGatewayTool: vi.fn(),
}));

View File

@@ -2,12 +2,12 @@ import {
callGatewayTool,
embeddedAgentLog,
type EmbeddedRunAttemptParams,
} from "openclaw/plugin-sdk/agent-harness";
} from "openclaw/plugin-sdk/agent-harness-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { handleCodexAppServerElicitationRequest } from "./elicitation-bridge.js";
vi.mock("openclaw/plugin-sdk/agent-harness", async (importOriginal) => ({
...(await importOriginal<typeof import("openclaw/plugin-sdk/agent-harness")>()),
vi.mock("openclaw/plugin-sdk/agent-harness-runtime", async (importOriginal) => ({
...(await importOriginal<typeof import("openclaw/plugin-sdk/agent-harness-runtime")>()),
callGatewayTool: vi.fn(),
}));

View File

@@ -80,7 +80,7 @@ type EnvSnapshot = {
};
function resolveLiveTimeoutMs(raw: string | undefined, fallback: number): number {
const parsed = raw ? Number(raw) : NaN;
const parsed = raw ? Number(raw) : Number.NaN;
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : fallback;
}