|
|
|
|
@ -4,14 +4,12 @@ import path from "node:path";
|
|
|
|
|
import type { AssistantMessage } from "@mariozechner/pi-ai";
|
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
|
import type { OpenClawConfig } from "../config/config.js";
|
|
|
|
|
import { registerLogTransport, resetLogger, setLoggerOverride } from "../logging/logger.js";
|
|
|
|
|
import { redactIdentifier } from "../logging/redact-identifier.js";
|
|
|
|
|
import type { AuthProfileFailureReason } from "./auth-profiles.js";
|
|
|
|
|
import type { EmbeddedRunAttemptResult } from "./pi-embedded-runner/run/types.js";
|
|
|
|
|
|
|
|
|
|
const runEmbeddedAttemptMock = vi.fn<(params: unknown) => Promise<EmbeddedRunAttemptResult>>();
|
|
|
|
|
const resolveCopilotApiTokenMock = vi.fn();
|
|
|
|
|
const COPILOT_TOKEN_URL = "https://api.github.com/copilot_internal/v2/token";
|
|
|
|
|
const { computeBackoffMock, sleepWithAbortMock } = vi.hoisted(() => ({
|
|
|
|
|
computeBackoffMock: vi.fn(
|
|
|
|
|
(
|
|
|
|
|
@ -22,63 +20,121 @@ const { computeBackoffMock, sleepWithAbortMock } = vi.hoisted(() => ({
|
|
|
|
|
sleepWithAbortMock: vi.fn(async (_ms: number, _abortSignal?: AbortSignal) => undefined),
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
vi.mock("./pi-embedded-runner/run/attempt.js", () => ({
|
|
|
|
|
runEmbeddedAttempt: (params: unknown) => runEmbeddedAttemptMock(params),
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
vi.mock("../infra/backoff.js", () => ({
|
|
|
|
|
computeBackoff: (
|
|
|
|
|
policy: { initialMs: number; maxMs: number; factor: number; jitter: number },
|
|
|
|
|
attempt: number,
|
|
|
|
|
) => computeBackoffMock(policy, attempt),
|
|
|
|
|
sleepWithAbort: (ms: number, abortSignal?: AbortSignal) => sleepWithAbortMock(ms, abortSignal),
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
vi.mock("../../extensions/github-copilot/token.js", () => ({
|
|
|
|
|
DEFAULT_COPILOT_API_BASE_URL: "https://api.individual.githubcopilot.com",
|
|
|
|
|
resolveCopilotApiToken: (...args: unknown[]) => resolveCopilotApiTokenMock(...args),
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
vi.mock("./pi-embedded-runner/compact.js", () => ({
|
|
|
|
|
compactEmbeddedPiSessionDirect: vi.fn(async () => {
|
|
|
|
|
throw new Error("compact should not run in auth profile rotation tests");
|
|
|
|
|
}),
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
vi.mock("./models-config.js", async (importOriginal) => {
|
|
|
|
|
const mod = await importOriginal<typeof import("./models-config.js")>();
|
|
|
|
|
return {
|
|
|
|
|
...mod,
|
|
|
|
|
ensureOpenClawModelsJson: vi.fn(async () => ({ wrote: false })),
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
const installRunEmbeddedMocks = () => {
|
|
|
|
|
vi.doMock("../plugins/hook-runner-global.js", () => ({
|
|
|
|
|
getGlobalHookRunner: vi.fn(() => undefined),
|
|
|
|
|
}));
|
|
|
|
|
vi.doMock("../context-engine/index.js", () => ({
|
|
|
|
|
ensureContextEnginesInitialized: vi.fn(),
|
|
|
|
|
resolveContextEngine: vi.fn(async () => ({
|
|
|
|
|
dispose: async () => undefined,
|
|
|
|
|
})),
|
|
|
|
|
}));
|
|
|
|
|
vi.doMock("./runtime-plugins.js", () => ({
|
|
|
|
|
ensureRuntimePluginsLoaded: vi.fn(),
|
|
|
|
|
}));
|
|
|
|
|
vi.doMock("./pi-embedded-runner/model.js", () => ({
|
|
|
|
|
resolveModelAsync: async (provider: string, modelId: string) => ({
|
|
|
|
|
model: {
|
|
|
|
|
id: modelId,
|
|
|
|
|
name: modelId,
|
|
|
|
|
api: "openai-responses",
|
|
|
|
|
provider,
|
|
|
|
|
baseUrl:
|
|
|
|
|
provider === "github-copilot" ? "https://api.copilot.example" : "https://example.com",
|
|
|
|
|
reasoning: false,
|
|
|
|
|
input: ["text"],
|
|
|
|
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
|
|
|
contextWindow: 16_000,
|
|
|
|
|
maxTokens: 2048,
|
|
|
|
|
},
|
|
|
|
|
error: undefined,
|
|
|
|
|
authStorage: {
|
|
|
|
|
setRuntimeApiKey: vi.fn(),
|
|
|
|
|
},
|
|
|
|
|
modelRegistry: {},
|
|
|
|
|
}),
|
|
|
|
|
}));
|
|
|
|
|
vi.doMock("./pi-embedded-runner/run/attempt.js", () => ({
|
|
|
|
|
runEmbeddedAttempt: (params: unknown) => runEmbeddedAttemptMock(params),
|
|
|
|
|
}));
|
|
|
|
|
vi.doMock("../plugins/provider-runtime.runtime.js", () => ({
|
|
|
|
|
prepareProviderRuntimeAuth: async (params: {
|
|
|
|
|
provider: string;
|
|
|
|
|
context: { apiKey: string };
|
|
|
|
|
}) => {
|
|
|
|
|
if (params.provider !== "github-copilot") {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
const token = await resolveCopilotApiTokenMock(params.context.apiKey);
|
|
|
|
|
return {
|
|
|
|
|
apiKey: token.token,
|
|
|
|
|
baseUrl: token.baseUrl,
|
|
|
|
|
expiresAt: token.expiresAt,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
}));
|
|
|
|
|
vi.doMock("../infra/backoff.js", () => ({
|
|
|
|
|
computeBackoff: (
|
|
|
|
|
policy: { initialMs: number; maxMs: number; factor: number; jitter: number },
|
|
|
|
|
attempt: number,
|
|
|
|
|
) => computeBackoffMock(policy, attempt),
|
|
|
|
|
sleepWithAbort: (ms: number, abortSignal?: AbortSignal) => sleepWithAbortMock(ms, abortSignal),
|
|
|
|
|
}));
|
|
|
|
|
vi.doMock("./pi-embedded-runner/compact.js", () => ({
|
|
|
|
|
compactEmbeddedPiSessionDirect: vi.fn(async () => {
|
|
|
|
|
throw new Error("compact should not run in auth profile rotation tests");
|
|
|
|
|
}),
|
|
|
|
|
}));
|
|
|
|
|
vi.doMock("./models-config.js", async (importOriginal) => {
|
|
|
|
|
const mod = await importOriginal<typeof import("./models-config.js")>();
|
|
|
|
|
return {
|
|
|
|
|
...mod,
|
|
|
|
|
ensureOpenClawModelsJson: vi.fn(async () => ({ wrote: false })),
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let runEmbeddedPiAgent: typeof import("./pi-embedded-runner/run.js").runEmbeddedPiAgent;
|
|
|
|
|
let unregisterLogTransport: (() => void) | undefined;
|
|
|
|
|
let registerLogTransportFn: typeof import("../logging/logger.js").registerLogTransport;
|
|
|
|
|
let resetLoggerFn: typeof import("../logging/logger.js").resetLogger;
|
|
|
|
|
let setLoggerOverrideFn: typeof import("../logging/logger.js").setLoggerOverride;
|
|
|
|
|
const originalFetch = globalThis.fetch;
|
|
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
|
|
|
|
vi.resetModules();
|
|
|
|
|
installRunEmbeddedMocks();
|
|
|
|
|
({ runEmbeddedPiAgent } = await import("./pi-embedded-runner/run.js"));
|
|
|
|
|
({
|
|
|
|
|
registerLogTransport: registerLogTransportFn,
|
|
|
|
|
resetLogger: resetLoggerFn,
|
|
|
|
|
setLoggerOverride: setLoggerOverrideFn,
|
|
|
|
|
} = await import("../logging/logger.js"));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
async function runEmbeddedPiAgentInline(
|
|
|
|
|
params: Parameters<typeof runEmbeddedPiAgent>[0],
|
|
|
|
|
): Promise<Awaited<ReturnType<typeof runEmbeddedPiAgent>>> {
|
|
|
|
|
return await runEmbeddedPiAgent({
|
|
|
|
|
...params,
|
|
|
|
|
enqueue: async (task) => await task(),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
vi.useRealTimers();
|
|
|
|
|
runEmbeddedAttemptMock.mockClear();
|
|
|
|
|
runEmbeddedAttemptMock.mockReset();
|
|
|
|
|
runEmbeddedAttemptMock.mockImplementation(async () => {
|
|
|
|
|
throw new Error("unexpected extra runEmbeddedAttempt call");
|
|
|
|
|
});
|
|
|
|
|
resolveCopilotApiTokenMock.mockReset();
|
|
|
|
|
resolveCopilotApiTokenMock.mockImplementation(async () => {
|
|
|
|
|
throw new Error("unexpected extra Copilot token refresh");
|
|
|
|
|
});
|
|
|
|
|
globalThis.fetch = vi.fn(async (input: string | URL | Request) => {
|
|
|
|
|
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
|
|
|
if (url !== COPILOT_TOKEN_URL) {
|
|
|
|
|
throw new Error(`Unexpected fetch in test: ${url}`);
|
|
|
|
|
}
|
|
|
|
|
const token = await resolveCopilotApiTokenMock();
|
|
|
|
|
return {
|
|
|
|
|
ok: true,
|
|
|
|
|
status: 200,
|
|
|
|
|
json: async () => ({
|
|
|
|
|
token: token.token,
|
|
|
|
|
expires_at: Math.floor(token.expiresAt / 1000),
|
|
|
|
|
}),
|
|
|
|
|
} as Response;
|
|
|
|
|
throw new Error(`Unexpected fetch in test: ${url}`);
|
|
|
|
|
}) as typeof fetch;
|
|
|
|
|
computeBackoffMock.mockClear();
|
|
|
|
|
sleepWithAbortMock.mockClear();
|
|
|
|
|
@ -88,8 +144,8 @@ afterEach(() => {
|
|
|
|
|
globalThis.fetch = originalFetch;
|
|
|
|
|
unregisterLogTransport?.();
|
|
|
|
|
unregisterLogTransport = undefined;
|
|
|
|
|
setLoggerOverride(null);
|
|
|
|
|
resetLogger();
|
|
|
|
|
setLoggerOverrideFn(null);
|
|
|
|
|
resetLoggerFn();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const baseUsage = {
|
|
|
|
|
@ -324,7 +380,7 @@ async function runAutoPinnedOpenAiTurn(params: {
|
|
|
|
|
runId: string;
|
|
|
|
|
authProfileId?: string;
|
|
|
|
|
}) {
|
|
|
|
|
await runEmbeddedPiAgent({
|
|
|
|
|
await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: params.sessionKey,
|
|
|
|
|
sessionFile: path.join(params.workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -368,7 +424,7 @@ async function runAutoPinnedRotationCase(params: {
|
|
|
|
|
sessionKey: string;
|
|
|
|
|
runId: string;
|
|
|
|
|
}) {
|
|
|
|
|
runEmbeddedAttemptMock.mockClear();
|
|
|
|
|
runEmbeddedAttemptMock.mockReset();
|
|
|
|
|
return withAgentWorkspace(async ({ agentDir, workspaceDir }) => {
|
|
|
|
|
await writeAuthStore(agentDir);
|
|
|
|
|
mockFailedThenSuccessfulAttempt(params.errorMessage);
|
|
|
|
|
@ -390,7 +446,7 @@ async function runAutoPinnedPromptErrorRotationCase(params: {
|
|
|
|
|
sessionKey: string;
|
|
|
|
|
runId: string;
|
|
|
|
|
}) {
|
|
|
|
|
runEmbeddedAttemptMock.mockClear();
|
|
|
|
|
runEmbeddedAttemptMock.mockReset();
|
|
|
|
|
return withAgentWorkspace(async ({ agentDir, workspaceDir }) => {
|
|
|
|
|
await writeAuthStore(agentDir);
|
|
|
|
|
mockPromptErrorThenSuccessfulAttempt(params.errorMessage);
|
|
|
|
|
@ -486,7 +542,7 @@ async function runTurnWithCooldownSeed(params: {
|
|
|
|
|
});
|
|
|
|
|
mockSingleSuccessfulAttempt();
|
|
|
|
|
|
|
|
|
|
await runEmbeddedPiAgent({
|
|
|
|
|
await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: params.sessionKey,
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -518,7 +574,9 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
resolveCopilotApiTokenMock
|
|
|
|
|
.mockResolvedValueOnce({
|
|
|
|
|
token: "copilot-initial",
|
|
|
|
|
expiresAt: now + 2 * 60 * 1000,
|
|
|
|
|
// Keep expiry beyond the runtime refresh margin so the test only
|
|
|
|
|
// exercises auth-error refresh, not the background scheduler.
|
|
|
|
|
expiresAt: now + 10 * 60 * 1000,
|
|
|
|
|
source: "mock",
|
|
|
|
|
baseUrl: "https://api.copilot.example",
|
|
|
|
|
})
|
|
|
|
|
@ -549,7 +607,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await runEmbeddedPiAgent({
|
|
|
|
|
await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:copilot-auth-error",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -582,13 +640,14 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
resolveCopilotApiTokenMock
|
|
|
|
|
.mockResolvedValueOnce({
|
|
|
|
|
token: "copilot-initial",
|
|
|
|
|
expiresAt: now + 2 * 60 * 1000,
|
|
|
|
|
// Avoid an immediate scheduled refresh racing the explicit auth retry.
|
|
|
|
|
expiresAt: now + 10 * 60 * 1000,
|
|
|
|
|
source: "mock",
|
|
|
|
|
baseUrl: "https://api.copilot.example",
|
|
|
|
|
})
|
|
|
|
|
.mockResolvedValueOnce({
|
|
|
|
|
token: "copilot-refresh-1",
|
|
|
|
|
expiresAt: now + 4 * 60 * 1000,
|
|
|
|
|
expiresAt: now + 10 * 60 * 1000,
|
|
|
|
|
source: "mock",
|
|
|
|
|
baseUrl: "https://api.copilot.example",
|
|
|
|
|
})
|
|
|
|
|
@ -633,7 +692,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await runEmbeddedPiAgent({
|
|
|
|
|
await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:copilot-auth-repeat",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -647,7 +706,6 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
timeoutMs: 5_000,
|
|
|
|
|
runId: "run:copilot-auth-repeat",
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(runEmbeddedAttemptMock).toHaveBeenCalledTimes(4);
|
|
|
|
|
expect(resolveCopilotApiTokenMock).toHaveBeenCalledTimes(3);
|
|
|
|
|
} finally {
|
|
|
|
|
@ -682,7 +740,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const runPromise = runEmbeddedPiAgent({
|
|
|
|
|
const runPromise = runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:copilot-shutdown",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -744,12 +802,12 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
|
|
|
|
|
it("logs structured failover decision metadata for overloaded assistant rotation", async () => {
|
|
|
|
|
const records: Array<Record<string, unknown>> = [];
|
|
|
|
|
setLoggerOverride({
|
|
|
|
|
setLoggerOverrideFn({
|
|
|
|
|
level: "trace",
|
|
|
|
|
consoleLevel: "silent",
|
|
|
|
|
file: path.join(os.tmpdir(), `openclaw-auth-rotation-${Date.now()}.log`),
|
|
|
|
|
});
|
|
|
|
|
unregisterLogTransport = registerLogTransport((record) => {
|
|
|
|
|
unregisterLogTransport = registerLogTransportFn((record) => {
|
|
|
|
|
records.push(record);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -858,7 +916,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const result = await runEmbeddedPiAgent({
|
|
|
|
|
const result = await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:compaction-timeout",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -887,7 +945,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
|
|
|
|
|
mockSingleErrorAttempt({ errorMessage: "rate limit" });
|
|
|
|
|
|
|
|
|
|
await runEmbeddedPiAgent({
|
|
|
|
|
await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:user",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -935,7 +993,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await runEmbeddedPiAgent({
|
|
|
|
|
await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:mismatch",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -977,7 +1035,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
runEmbeddedPiAgent({
|
|
|
|
|
runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:cooldown-failover",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -1021,7 +1079,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const result = await runEmbeddedPiAgent({
|
|
|
|
|
const result = await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:cooldown-probe",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -1069,7 +1127,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const result = await runEmbeddedPiAgent({
|
|
|
|
|
const result = await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:overloaded-cooldown-probe",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -1117,7 +1175,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const result = await runEmbeddedPiAgent({
|
|
|
|
|
const result = await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:billing-cooldown-probe-no-fallbacks",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -1148,7 +1206,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
runEmbeddedPiAgent({
|
|
|
|
|
runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:support:cooldown-failover",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -1193,7 +1251,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
runEmbeddedPiAgent({
|
|
|
|
|
runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:disabled-failover",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -1227,7 +1285,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
await fs.writeFile(authPath, JSON.stringify({ version: 1, profiles: {}, usageStats: {} }));
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
|
runEmbeddedPiAgent({
|
|
|
|
|
runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:auth-unavailable",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
@ -1265,7 +1323,7 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
|
|
|
|
|
|
|
|
|
let thrown: unknown;
|
|
|
|
|
try {
|
|
|
|
|
await runEmbeddedPiAgent({
|
|
|
|
|
await runEmbeddedPiAgentInline({
|
|
|
|
|
sessionId: "session:test",
|
|
|
|
|
sessionKey: "agent:test:billing-failover-active-model",
|
|
|
|
|
sessionFile: path.join(workspaceDir, "session.jsonl"),
|
|
|
|
|
|