mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 01:13:43 +00:00
fix: harden queue retry debounce and add regression tests
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { ImageContent } from "@mariozechner/pi-ai";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { injectHistoryImagesIntoMessages, resolvePromptBuildHookResult } from "./attempt.js";
|
||||
import {
|
||||
injectHistoryImagesIntoMessages,
|
||||
resolvePromptBuildHookResult,
|
||||
resolvePromptModeForSession,
|
||||
} from "./attempt.js";
|
||||
|
||||
describe("injectHistoryImagesIntoMessages", () => {
|
||||
const image: ImageContent = { type: "image", data: "abc", mimeType: "image/png" };
|
||||
@@ -103,3 +107,14 @@ describe("resolvePromptBuildHookResult", () => {
|
||||
expect(result.prependContext).toBe("from-hook");
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolvePromptModeForSession", () => {
|
||||
it("uses minimal mode for subagent sessions", () => {
|
||||
expect(resolvePromptModeForSession("agent:main:subagent:child")).toBe("minimal");
|
||||
});
|
||||
|
||||
it("uses full mode for cron sessions", () => {
|
||||
expect(resolvePromptModeForSession("agent:main:cron:job-1")).toBe("full");
|
||||
expect(resolvePromptModeForSession("agent:main:cron:job-1:run:run-abc")).toBe("full");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user