mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-23 02:45:38 -06:00
test(auto-reply): align prepared harness proof with SQLite sessions
This commit is contained in:
@@ -23,6 +23,7 @@ import type { AuthProfileStore } from "../auth-profiles/types.js";
|
||||
import { extractObservedOverflowTokenCount } from "../embedded-agent-helpers/context-overflow-observation.js";
|
||||
import type { FailoverReason } from "../failover/signal.js";
|
||||
import { clearAgentHarnesses, registerAgentHarness } from "../harness/registry.js";
|
||||
import type { AgentHarnessAttemptParams } from "../harness/types.js";
|
||||
import type { ResolvedProviderAuth } from "../model-auth-runtime-shared.js";
|
||||
import type { AgentRuntimePlan } from "../runtime-plan/types.js";
|
||||
import { makeAttemptResult } from "./run.overflow-compaction.fixture.js";
|
||||
@@ -257,7 +258,7 @@ const mockedPrepareProviderRuntimeAuth = vi.fn<
|
||||
(params?: { context?: { apiKey?: string } }) => Promise<{ apiKey: string } | undefined>
|
||||
>(async () => undefined);
|
||||
export const mockedRunEmbeddedAttempt =
|
||||
vi.fn<(params: unknown) => Promise<EmbeddedRunAttemptResult>>();
|
||||
vi.fn<(params: AgentHarnessAttemptParams) => Promise<EmbeddedRunAttemptResult>>();
|
||||
export const mockedBuildEmbeddedRunPayloads = vi.fn<
|
||||
(
|
||||
...args: Parameters<typeof buildEmbeddedRunPayloads>
|
||||
|
||||
@@ -174,11 +174,11 @@ describe("prepared harness source delivery", () => {
|
||||
};
|
||||
const followupRun = createFollowupRun();
|
||||
followupRun.run.sessionKey = undefined;
|
||||
followupRun.run.sessionFile = undefined;
|
||||
followupRun.run.sessionFile = followupRun.run.sessionId;
|
||||
followupRun.run.sourceReplyDeliveryMode = runtimeOpts.sourceReplyDeliveryMode;
|
||||
setSourceReplyDeliveryModeOrigin(followupRun.run, runtimeOpts.sourceReplyDeliveryModeOrigin);
|
||||
// Dispatch already captured its session snapshot; the embedded fixture has
|
||||
// no durable transcript row and should therefore skip writer admission.
|
||||
// Dispatch already captured its session snapshot; the embedded fixture uses
|
||||
// a SQLite compatibility key and has no durable row for writer admission.
|
||||
sessionStoreMocks.currentEntry = undefined;
|
||||
const execution = await executeAgentTurn({
|
||||
commandBody: "hello",
|
||||
@@ -211,7 +211,11 @@ describe("prepared harness source delivery", () => {
|
||||
`expected settled fallback execution: ${embeddedErrorText}; ${JSON.stringify({ execution, failedParams })}`,
|
||||
);
|
||||
}
|
||||
return execution.runResult.payloads[0] satisfies ReplyPayload;
|
||||
const payload = execution.runResult.payloads?.[0];
|
||||
if (!payload) {
|
||||
throw new Error("expected settled fallback payload");
|
||||
}
|
||||
return payload satisfies ReplyPayload;
|
||||
});
|
||||
const deliver = vi.fn(async () => {});
|
||||
const onPartialReply = vi.fn(async () => {});
|
||||
|
||||
Reference in New Issue
Block a user