mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-20 13:14:59 +00:00
fix(agents): forward memory flush write path (#41761)
Merged via squash.
Prepared head SHA: 0a8ebf8e5b
Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com>
Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com>
Reviewed-by: @frankekn
This commit is contained in:
@@ -850,6 +850,7 @@ export async function runEmbeddedPiAgent(
|
||||
sessionId: params.sessionId,
|
||||
sessionKey: params.sessionKey,
|
||||
trigger: params.trigger,
|
||||
memoryFlushWritePath: params.memoryFlushWritePath,
|
||||
messageChannel: params.messageChannel,
|
||||
messageProvider: params.messageProvider,
|
||||
agentAccountId: params.agentAccountId,
|
||||
|
||||
@@ -79,6 +79,36 @@ describe("runEmbeddedPiAgent usage reporting", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("forwards memory flush write paths into memory-triggered attempts", async () => {
|
||||
mockedRunEmbeddedAttempt.mockResolvedValueOnce({
|
||||
aborted: false,
|
||||
promptError: null,
|
||||
timedOut: false,
|
||||
sessionIdUsed: "test-session",
|
||||
assistantTexts: [],
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any);
|
||||
|
||||
await runEmbeddedPiAgent({
|
||||
sessionId: "test-session",
|
||||
sessionKey: "test-key",
|
||||
sessionFile: "/tmp/session.json",
|
||||
workspaceDir: "/tmp/workspace",
|
||||
prompt: "flush",
|
||||
timeoutMs: 30000,
|
||||
runId: "run-memory-forwarding",
|
||||
trigger: "memory",
|
||||
memoryFlushWritePath: "memory/2026-03-10.md",
|
||||
});
|
||||
|
||||
expect(mockedRunEmbeddedAttempt).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
trigger: "memory",
|
||||
memoryFlushWritePath: "memory/2026-03-10.md",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("reports total usage from the last turn instead of accumulated total", async () => {
|
||||
// Simulate a multi-turn run result.
|
||||
// Turn 1: Input 100, Output 50. Total 150.
|
||||
|
||||
Reference in New Issue
Block a user