mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 16:11:25 +00:00
test: remove redundant configured memory-flush prompt case
This commit is contained in:
@@ -855,66 +855,6 @@ describe("runReplyAgent memory flush", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses configured prompts for memory flush runs", async () => {
|
|
||||||
await withTempStore(async (storePath) => {
|
|
||||||
const sessionKey = "main";
|
|
||||||
const sessionEntry = {
|
|
||||||
sessionId: "session",
|
|
||||||
updatedAt: Date.now(),
|
|
||||||
totalTokens: 80_000,
|
|
||||||
compactionCount: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
await seedSessionStore({ storePath, sessionKey, entry: sessionEntry });
|
|
||||||
|
|
||||||
const calls: Array<EmbeddedRunParams> = [];
|
|
||||||
state.runEmbeddedPiAgentMock.mockImplementation(async (params: EmbeddedRunParams) => {
|
|
||||||
calls.push(params);
|
|
||||||
if (params.prompt?.includes("Pre-compaction memory flush.")) {
|
|
||||||
return { payloads: [], meta: {} };
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
payloads: [{ text: "ok" }],
|
|
||||||
meta: { agentMeta: { usage: { input: 1, output: 1 } } },
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const baseRun = createBaseRun({
|
|
||||||
storePath,
|
|
||||||
sessionEntry,
|
|
||||||
config: {
|
|
||||||
agents: {
|
|
||||||
defaults: {
|
|
||||||
compaction: {
|
|
||||||
memoryFlush: {
|
|
||||||
prompt: "Write notes.",
|
|
||||||
systemPrompt: "Flush memory now.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
runOverrides: { extraSystemPrompt: "extra system" },
|
|
||||||
});
|
|
||||||
|
|
||||||
await runReplyAgentWithBase({
|
|
||||||
baseRun,
|
|
||||||
storePath,
|
|
||||||
sessionKey,
|
|
||||||
sessionEntry,
|
|
||||||
commandBody: "hello",
|
|
||||||
});
|
|
||||||
|
|
||||||
const flushCall = calls[0];
|
|
||||||
expect(flushCall?.prompt).toContain("Write notes.");
|
|
||||||
expect(flushCall?.prompt).toContain("NO_REPLY");
|
|
||||||
expect(flushCall?.extraSystemPrompt).toContain("extra system");
|
|
||||||
expect(flushCall?.extraSystemPrompt).toContain("Flush memory now.");
|
|
||||||
expect(flushCall?.extraSystemPrompt).toContain("NO_REPLY");
|
|
||||||
expect(calls[1]?.prompt).toBe("hello");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("runs a memory flush turn and updates session metadata", async () => {
|
it("runs a memory flush turn and updates session metadata", async () => {
|
||||||
await withTempStore(async (storePath) => {
|
await withTempStore(async (storePath) => {
|
||||||
const sessionKey = "main";
|
const sessionKey = "main";
|
||||||
|
|||||||
Reference in New Issue
Block a user