test: align agent runtime expectations

This commit is contained in:
Peter Steinberger
2026-05-02 08:35:19 +01:00
parent a483e43f80
commit d9f778fab3
3 changed files with 11 additions and 9 deletions

View File

@@ -1304,7 +1304,7 @@ describe("compactEmbeddedPiSession hooks (ownsCompaction engine)", () => {
);
});
it("rotates in the wrapper when a delegated result echoes the current transcript", async () => {
it("keeps a delegated result that echoes the current transcript on the active transcript", async () => {
const maintain = vi.fn(async (_params?: unknown) => ({
changed: false,
bytesFreed: 0,
@@ -1350,13 +1350,13 @@ describe("compactEmbeddedPiSession hooks (ownsCompaction engine)", () => {
);
expect(result.ok).toBe(true);
expect(rotateTranscriptAfterCompactionMock).toHaveBeenCalledTimes(1);
expect(result.result?.sessionId).toBe("wrapper-rotated-session");
expect(result.result?.sessionFile).toBe("/tmp/wrapper-rotated-session.jsonl");
expect(rotateTranscriptAfterCompactionMock).not.toHaveBeenCalled();
expect(result.result?.sessionId).toBeUndefined();
expect(result.result?.sessionFile).toBeUndefined();
expect(maintain).toHaveBeenCalledWith(
expect.objectContaining({
sessionId: "wrapper-rotated-session",
sessionFile: "/tmp/wrapper-rotated-session.jsonl",
sessionId: TEST_SESSION_ID,
sessionFile: TEST_SESSION_FILE,
}),
);
});

View File

@@ -263,8 +263,8 @@ describe("runEmbeddedAttempt context engine sessionKey forwarding", () => {
},
});
expect(seenPrompt).toBe("");
expect(result.finalPromptText).toBe("");
expect(seenPrompt).toBe("Continue the OpenClaw runtime event.");
expect(result.finalPromptText).toBe("Continue the OpenClaw runtime event.");
expect(result.messagesSnapshot).not.toEqual(
expect.arrayContaining([
expect.objectContaining({
@@ -280,7 +280,7 @@ describe("runEmbeddedAttempt context engine sessionKey forwarding", () => {
.split("\n")
.map((line) => JSON.parse(line) as TrajectoryEvent);
const contextCompiled = trajectoryEvents.find((event) => event.type === "context.compiled");
expect(contextCompiled?.data?.prompt).toBe("");
expect(contextCompiled?.data?.prompt).toBe("Continue the OpenClaw runtime event.");
expect(contextCompiled?.data?.systemPrompt).toContain("internal heartbeat event");
});

View File

@@ -49,6 +49,7 @@ describe('spawnSubagentDirect mode="session" diagnostics (#67400)', () => {
task: "persistent planning session",
mode: "session",
thread: true,
context: "isolated",
},
{
agentSessionKey: "agent:main:main",
@@ -119,6 +120,7 @@ describe('spawnSubagentDirect mode="session" with registered thread hooks (#6740
task: "persistent planning session",
mode: "session",
thread: true,
context: "isolated",
},
{
agentSessionKey: "agent:main:main",