From eacf6774fa5ca96df9f65770aa6b4425edad2f5e Mon Sep 17 00:00:00 2001 From: joshavant <830519+joshavant@users.noreply.github.com> Date: Mon, 10 Aug 2026 21:01:23 -0500 Subject: [PATCH] test(auto-reply): align prepared harness proof with SQLite sessions --- .../run.overflow-compaction.harness.ts | 3 ++- ...pared-harness-source-delivery.integration.test.ts | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/agents/embedded-agent-runner/run.overflow-compaction.harness.ts b/src/agents/embedded-agent-runner/run.overflow-compaction.harness.ts index be31d586abf4..59c810e8e599 100644 --- a/src/agents/embedded-agent-runner/run.overflow-compaction.harness.ts +++ b/src/agents/embedded-agent-runner/run.overflow-compaction.harness.ts @@ -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>(); + vi.fn<(params: AgentHarnessAttemptParams) => Promise>(); export const mockedBuildEmbeddedRunPayloads = vi.fn< ( ...args: Parameters diff --git a/src/auto-reply/reply/prepared-harness-source-delivery.integration.test.ts b/src/auto-reply/reply/prepared-harness-source-delivery.integration.test.ts index ea6515573af2..a59e6cc31c70 100644 --- a/src/auto-reply/reply/prepared-harness-source-delivery.integration.test.ts +++ b/src/auto-reply/reply/prepared-harness-source-delivery.integration.test.ts @@ -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 () => {});