Skip to content

fix(memory): keep pre-compaction flush prompt out of user transcript#73380

Merged
vincentkoc merged 1 commit into
mainfrom
clownfish/ghcrawl-156869-autonomous-smoke
Apr 28, 2026
Merged

fix(memory): keep pre-compaction flush prompt out of user transcript#73380
vincentkoc merged 1 commit into
mainfrom
clownfish/ghcrawl-156869-autonomous-smoke

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

Context

Fixes #54408 and covers duplicate #58956. Related: #43567 for broader internal-system UI treatment and #12590/#51421 for the separate memoryFlush cadence bug.

Credit

Thanks @markgong for the canonical report and @guoyuhang9 for the v2026.3.31 reproduction details.

Validation

  • pnpm -s vitest run src/auto-reply/reply/reply-state.test.ts
  • pnpm check:changed

ProjectClownfish replacement details:

@vincentkoc vincentkoc added clownfish:human-review clawsweeper Tracked by ClawSweeper automation labels Apr 28, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Apr 28, 2026
@greptile-apps

greptile-apps Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a transcript-leak bug where the pre-compaction memory-flush prompt was being saved as a normal user message in chat.history/session transcripts. The fix adds transcriptPrompt: "" to the single runEmbeddedPiAgent call in agent-runner-memory.ts, which routes through the existing resolveRuntimeContextPromptParts mechanism: an empty transcriptPrompt with a non-empty effectivePrompt produces runtimeOnly: true, injecting the flush prompt only into the system-prompt runtime-event context and keeping it out of the user-visible message history. The runtime-context-prompt.test.ts already covers this code path at unit level, and the two new assertions verify the parameter is correctly plumbed.

Confidence Score: 5/5

Safe to merge — the one-line fix correctly uses the established runtimeOnly mechanism and has adequate layered test coverage.

The change is minimal (one added field), the underlying resolveRuntimeContextPromptParts path for transcriptPrompt: '' is already unit-tested in runtime-context-prompt.test.ts, and no logic in attempt.ts is altered. No P0 or P1 issues found.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(memory): keep pre-compaction flush p..." | Re-trigger Greptile

@vincentkoc
vincentkoc force-pushed the clownfish/ghcrawl-156869-autonomous-smoke branch from a18411c to 25c4487 Compare April 28, 2026 08:40
@vincentkoc vincentkoc self-assigned this Apr 28, 2026
@vincentkoc
vincentkoc force-pushed the clownfish/ghcrawl-156869-autonomous-smoke branch 2 times, most recently from ee51412 to f9697c6 Compare April 28, 2026 08:48
@vincentkoc

Copy link
Copy Markdown
Member Author

Thanks for the Aisle pass. I checked this before landing.

I’m leaving transcriptPrompt: "" as-is because a non-empty marker would recreate the reported bug: this transcript field is consumed as a user-visible/user-turn prompt, and the pre-compaction flush is an internal maintenance run, not a user message.

The run is still tagged on the internal path via trigger: "memory", constrained to memoryFlushWritePath, and persisted with the existing memory-flush session metadata (memoryFlushAt / memoryFlushCompactionCount). So this is intentional runtime-only context, not an external prompt-hiding bypass.

@vincentkoc
vincentkoc force-pushed the clownfish/ghcrawl-156869-autonomous-smoke branch from f9697c6 to 9f69cb1 Compare April 28, 2026 08:54
@vincentkoc
vincentkoc merged commit 7fd9c15 into main Apr 28, 2026
65 of 67 checks passed
@vincentkoc
vincentkoc deleted the clownfish/ghcrawl-156869-autonomous-smoke branch April 28, 2026 08:58
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper Tracked by ClawSweeper automation maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Pre-compaction memory flush leaks into main session as user messages and causes compaction loop

1 participant