Skip to content

Commit ffecc35

Browse files
committed
fix(agents): forward memory flush write path
1 parent da4fec6 commit ffecc35

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Docs: https://docs.openclaw.ai
4747
- Telegram/exec approvals: reject `/approve` commands aimed at other bots, keep deterministic approval prompts visible when tool-result delivery fails, and stop resolved exact IDs from matching other pending approvals by prefix. (#37233) Thanks @huntharo.
4848
- Control UI/Sessions: restore single-column session table collapse on narrow viewport or container widths by moving the responsive table override next to the base grid rule and enabling inline-size container queries. (#12175) Thanks @benjipeng.
4949
- Telegram/final preview delivery: split active preview lifecycle from cleanup retention so missing archived preview edits avoid duplicate fallback sends without clearing the live preview or blocking later in-place finalization. (#41662) thanks @hougangdev.
50+
- Agents/memory flush: forward `memoryFlushWritePath` through `runEmbeddedPiAgent` so memory-triggered flush turns keep the append-only write guard without aborting before tool setup. Follows up on #38574.
5051

5152
## 2026.3.8
5253

src/agents/pi-embedded-runner/run.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,7 @@ export async function runEmbeddedPiAgent(
850850
sessionId: params.sessionId,
851851
sessionKey: params.sessionKey,
852852
trigger: params.trigger,
853+
memoryFlushWritePath: params.memoryFlushWritePath,
853854
messageChannel: params.messageChannel,
854855
messageProvider: params.messageProvider,
855856
agentAccountId: params.agentAccountId,

src/agents/pi-embedded-runner/usage-reporting.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,36 @@ describe("runEmbeddedPiAgent usage reporting", () => {
7979
);
8080
});
8181

82+
it("forwards memory flush write paths into memory-triggered attempts", async () => {
83+
mockedRunEmbeddedAttempt.mockResolvedValueOnce({
84+
aborted: false,
85+
promptError: null,
86+
timedOut: false,
87+
sessionIdUsed: "test-session",
88+
assistantTexts: [],
89+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
90+
} as any);
91+
92+
await runEmbeddedPiAgent({
93+
sessionId: "test-session",
94+
sessionKey: "test-key",
95+
sessionFile: "/tmp/session.json",
96+
workspaceDir: "/tmp/workspace",
97+
prompt: "flush",
98+
timeoutMs: 30000,
99+
runId: "run-memory-forwarding",
100+
trigger: "memory",
101+
memoryFlushWritePath: "memory/2026-03-10.md",
102+
});
103+
104+
expect(mockedRunEmbeddedAttempt).toHaveBeenCalledWith(
105+
expect.objectContaining({
106+
trigger: "memory",
107+
memoryFlushWritePath: "memory/2026-03-10.md",
108+
}),
109+
);
110+
});
111+
82112
it("reports total usage from the last turn instead of accumulated total", async () => {
83113
// Simulate a multi-turn run result.
84114
// Turn 1: Input 100, Output 50. Total 150.

0 commit comments

Comments
 (0)