Skip to content

fix(agents): suppress memory flush UI leakage (#58956)#1786

Open
BingqingLyu wants to merge 1 commit into
mainfrom
fork-pr-58975-fix-58956-memory-flush-ui-leak
Open

fix(agents): suppress memory flush UI leakage (#58956)#1786
BingqingLyu wants to merge 1 commit into
mainfrom
fork-pr-58975-fix-58956-memory-flush-ui-leak

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 28, 2026

Copy link
Copy Markdown
Owner

Summary

Fix pre-compaction memory flush leaking internal prompts into chat UI and blocking user's active turn.

Root Cause

Memory flush execution increased autoCompactionCount, which triggered:

  1. System event enqueue → displayed via drainFormattedSystemEvents in subsequent turns
  2. Verbose notification → showed "🧹 Auto-compaction complete" to users

Fix

Track performedMemoryFlush flag and suppress UI-visible side effects:

  • Skip enqueueSystemEvent() for memory flush runs
  • Skip verbose notification for memory flush runs

Changes

  • src/auto-reply/reply/agent-runner-memory.ts: Add MemoryFlushResult type, return flag
  • src/auto-reply/reply/agent-runner.ts: Use flag to suppress UI side effects
  • src/auto-reply/reply/agent-runner-memory.flush-leak.test.ts: Add 14 unit tests

Testing

  • ✅ 14 new unit tests (all passing)
  • ✅ 15 existing tests (regression check, all passing)
  • ✅ Build successful

Related

Fixes openclaw#58956

Prevent pre-compaction memory flush from leaking internal prompts into
the chat UI and blocking user's active turn.

Root cause: Memory flush increased autoCompactionCount, which triggered
system event enqueue and verbose notifications in subsequent turns.

Fix: Track performedMemoryFlush flag and suppress UI-visible side effects:
- Skip enqueueSystemEvent() for memory flush runs
- Skip verbose 'Auto-compaction complete' notification for memory flush runs

Tests: Add 14 unit tests covering suppression logic and edge cases.

Fixes openclaw#58956
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Pre-compaction memory flush leaks into chat UI and blocks the user’s active turn in 2026.3.31

2 participants