Skip to content

Commit 7fd9c15

Browse files
authored
fix(memory): keep pre-compaction flush prompt out of user transcript (#73380)
1 parent 47dc9f7 commit 7fd9c15

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Docs: https://docs.openclaw.ai
2525
- Channels/LINE: persist inbound image, video, audio, and file downloads in `~/.openclaw/media/inbound/` instead of temporary files so agents can still read LINE media after `/tmp` cleanup. Fixes #73370. Thanks @hijirii and @wenxu007.
2626
- CLI/plugins: keep bundled plugin installs out of `plugins.load.paths` while preserving install records, so install/inspect/doctor loops no longer warn about the current bundled plugin directory. Thanks @vincentkoc.
2727
- Cron/Telegram: add `--thread-id` to `openclaw cron add` and `openclaw cron edit`, preserving Telegram forum topic delivery targets across scheduled announcements. Carries forward #51581, #60373, and #60890. Thanks @ChunHao-dev.
28+
- Memory/compaction: keep pre-compaction memory-flush prompts runtime-only so session transcripts and `chat.history` no longer expose them as normal user turns. Fixes #54408 and #58956; refs #43567. Thanks @markgong and @guoyuhang9.
2829
- Control UI/WebChat: keep large attachment payloads out of Lit state and optimistic chat messages, using object URL previews plus send-time payload serialization so PDF/image uploads no longer trigger `RangeError: Maximum call stack size exceeded`. Fixes #73360; refs #54378 and #63432. Thanks @hejunhui-73, @Ansub, and @christianhernandez3-afk.
2930
- Agents/Anthropic: cancel stalled Anthropic Messages SSE body reads when abort signals fire, so active-memory timeouts release transport resources instead of leaving hidden recall runs parked on `reader.read()`. Refs #72965 and #73120. Thanks @wdeveloper16.
3031
- Control UI/WebChat: keep pending run and typing state attached to the active client run, so unowned inject/announce/side-result finals no longer unlock unrelated active runs while completed owned runs still clear promptly. Fixes #57795; carries forward the narrow diagnosis from #57887. Thanks @haoyu-haoyu.

src/auto-reply/reply/agent-runner-memory.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,12 @@ describe("runMemoryFlushIfNeeded", () => {
154154
expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);
155155
const flushCall = runEmbeddedPiAgentMock.mock.calls[0]?.[0] as {
156156
prompt?: string;
157+
transcriptPrompt?: string;
157158
memoryFlushWritePath?: string;
158159
silentExpected?: boolean;
159160
};
160161
expect(flushCall.prompt).toContain("Pre-compaction memory flush.");
162+
expect(flushCall.transcriptPrompt).toBe("");
161163
expect(flushCall.memoryFlushWritePath).toMatch(/^memory\/\d{4}-\d{2}-\d{2}\.md$/);
162164
expect(flushCall.silentExpected).toBe(true);
163165
expect(refreshQueuedFollowupSessionMock).toHaveBeenCalledWith({
@@ -585,6 +587,7 @@ describe("runMemoryFlushIfNeeded", () => {
585587

586588
const flushCall = runEmbeddedPiAgentMock.mock.calls[0]?.[0] as {
587589
prompt?: string;
590+
transcriptPrompt?: string;
588591
extraSystemPrompt?: string;
589592
bootstrapPromptWarningSignaturesSeen?: string[];
590593
bootstrapPromptWarningSignature?: string;
@@ -594,6 +597,7 @@ describe("runMemoryFlushIfNeeded", () => {
594597
expect(flushCall.prompt).toContain("Write notes.");
595598
expect(flushCall.prompt).toContain("NO_REPLY");
596599
expect(flushCall.prompt).toContain("MEMORY.md");
600+
expect(flushCall.transcriptPrompt).toBe("");
597601
expect(flushCall.extraSystemPrompt).toContain("extra system");
598602
expect(flushCall.extraSystemPrompt).toContain("Flush memory now.");
599603
expect(flushCall.memoryFlushWritePath).toBe("memory/2023-11-14.md");

src/auto-reply/reply/agent-runner-memory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ export async function runMemoryFlushIfNeeded(params: {
854854
trigger: "memory",
855855
memoryFlushWritePath,
856856
prompt: activeMemoryFlushPlan.prompt,
857+
transcriptPrompt: "",
857858
extraSystemPrompt: flushSystemPrompt,
858859
bootstrapPromptWarningSignaturesSeen,
859860
bootstrapPromptWarningSignature:

0 commit comments

Comments
 (0)