mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-16 15:31:37 +00:00
* refactor(browser): collapse Playwright export paths * refactor(browser): remove dead plugin exports * refactor(codex): remove dead app-server exports * refactor(codex): remove remaining dead exports * test(codex): use canonical private-type owners * test(browser): isolate proxy startup state * test(browser): remove stale chrome imports * refactor(codex): privatize remaining helpers * chore(deadcode): refresh export baseline after rebase * refactor(browser): finish canonical helper ownership * refactor: fix dead-export cleanup gates * refactor(codex): keep runtime facades LOC-neutral * chore(ci): refresh TypeScript LOC baseline * chore(deadcode): refresh ratchets after rebase * chore(ci): refresh LOC baseline after main advance * chore(deadcode): align ratchets with latest main
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
// Codex tests cover command rpc plugin behavior.
|
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
import { codexControlRequest } from "./command-rpc.js";
|
|
|
|
const requestCodexAppServerJsonMock = vi.hoisted(() => vi.fn());
|
|
|
|
vi.mock("./app-server/request.js", () => ({
|
|
requestCodexAppServerJson: requestCodexAppServerJsonMock,
|
|
}));
|
|
|
|
describe("Codex command RPC helpers", () => {
|
|
beforeEach(() => {
|
|
requestCodexAppServerJsonMock.mockReset();
|
|
});
|
|
|
|
it("uses an explicit control connection instead of ordinary harness start options", async () => {
|
|
requestCodexAppServerJsonMock.mockResolvedValue({ thread: { id: "thread-1" } });
|
|
const startOptions = {
|
|
transport: "stdio" as const,
|
|
homeScope: "user" as const,
|
|
command: "codex",
|
|
args: ["app-server", "--listen", "stdio://"],
|
|
headers: {},
|
|
};
|
|
|
|
await codexControlRequest(
|
|
{},
|
|
"thread/read",
|
|
{ threadId: "thread-1", includeTurns: false },
|
|
{ startOptions },
|
|
);
|
|
|
|
expect(requestCodexAppServerJsonMock).toHaveBeenCalledWith(
|
|
expect.objectContaining({ startOptions }),
|
|
);
|
|
});
|
|
|
|
it("forwards explicit native auth for supervised control connections", async () => {
|
|
requestCodexAppServerJsonMock.mockResolvedValue({});
|
|
|
|
await codexControlRequest(
|
|
{},
|
|
"thread/compact/start",
|
|
{ threadId: "thread-1" },
|
|
{
|
|
authProfileId: null,
|
|
},
|
|
);
|
|
|
|
expect(requestCodexAppServerJsonMock).toHaveBeenCalledWith(
|
|
expect.objectContaining({ authProfileId: null }),
|
|
);
|
|
});
|
|
|
|
it("forwards an explicit per-request timeout budget", async () => {
|
|
requestCodexAppServerJsonMock.mockResolvedValue({ data: [] });
|
|
|
|
await codexControlRequest({}, "thread/list", { archived: false }, { timeoutMs: 321 });
|
|
|
|
expect(requestCodexAppServerJsonMock).toHaveBeenCalledWith(
|
|
expect.objectContaining({ timeoutMs: 321 }),
|
|
);
|
|
});
|
|
});
|