mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
test(codex): cover bad dynamic tool schemas
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import type { EmbeddedRunAttemptParams } from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import {
|
||||
embeddedAgentLog,
|
||||
type EmbeddedRunAttemptParams,
|
||||
} from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
addSandboxShellDynamicToolsIfAvailable,
|
||||
@@ -223,6 +226,38 @@ describe("Codex app-server dynamic tool build", () => {
|
||||
await expect(buildDynamicToolsForTest(params, workspaceDir)).resolves.toEqual([messageTool]);
|
||||
});
|
||||
|
||||
it("quarantines non-object plugin schemas before Codex-specific filtering", async () => {
|
||||
const warn = vi.spyOn(embeddedAgentLog, "warn").mockImplementation(() => undefined);
|
||||
const messageTool = createRuntimeDynamicTool("message");
|
||||
const brokenTool = {
|
||||
...createRuntimeDynamicTool("dofbot_move_angles"),
|
||||
parameters: { type: "array", items: { type: "number" } },
|
||||
};
|
||||
setOpenClawCodingToolsFactoryForTests(() => [brokenTool, messageTool]);
|
||||
const sessionFile = path.join(tempDir, "session.jsonl");
|
||||
const workspaceDir = path.join(tempDir, "workspace");
|
||||
const params = createParams(sessionFile, workspaceDir);
|
||||
params.disableTools = false;
|
||||
params.runtimePlan = createCodexRuntimePlanFixture();
|
||||
|
||||
await expect(buildDynamicToolsForTest(params, workspaceDir)).resolves.toEqual([messageTool]);
|
||||
expect(warn).toHaveBeenCalledWith(
|
||||
"codex app-server quarantined 1 unsupported runtime tool schema before dynamic tool registration",
|
||||
expect.objectContaining({
|
||||
runId: "run-1",
|
||||
sessionId: "session-1",
|
||||
diagnostics: [
|
||||
{
|
||||
index: 0,
|
||||
tool: "dofbot_move_angles",
|
||||
violations: ['dofbot_move_angles.parameters.type must be "object"'],
|
||||
violationCount: 1,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("limits Codex memory flush runs to managed read and write tools", async () => {
|
||||
const factoryOptions: unknown[] = [];
|
||||
setOpenClawCodingToolsFactoryForTests((options) => {
|
||||
|
||||
Reference in New Issue
Block a user