Skip to content

fix: isolate memory flush messages from main agent history - #7

Merged
eddmann merged 2 commits into
mainfrom
claude/fix-memory-flush-leak-0EKBu
Mar 12, 2026
Merged

fix: isolate memory flush messages from main agent history#7
eddmann merged 2 commits into
mainfrom
claude/fix-memory-flush-leak-0EKBu

Conversation

@eddmann

@eddmann eddmann commented Mar 12, 2026

Copy link
Copy Markdown
Owner

The flush prompt and its tool call messages were pushed into the main
history and newMessages arrays. After compaction kept recent messages,
the flush prompt became the last user message — causing the LLM to
respond to it instead of the original request, leaking flush text to
the user via Telegram.

The flush now operates on a separate flushHistory copy. Flush messages
are persisted to the session store for audit but never touch the
working history or newMessages. Compaction sees only the clean
original conversation.

https://claude.ai/code/session_01Ac1E6X4Yw9Bt3iyktMoS5C

claude added 2 commits March 12, 2026 14:47
The flush prompt and its tool call messages were pushed into the main
history and newMessages arrays. After compaction kept recent messages,
the flush prompt became the last user message — causing the LLM to
respond to it instead of the original request, leaking flush text to
the user via Telegram.

The flush now operates on a separate flushHistory copy. Flush messages
are persisted to the session store for audit but never touch the
working history or newMessages. Compaction sees only the clean
original conversation.

https://claude.ai/code/session_01Ac1E6X4Yw9Bt3iyktMoS5C
…kens

Since compactAndSync now receives the clean original history (without
flush messages), the token count should reflect the original history
size. The flushTokens variable is no longer needed.

https://claude.ai/code/session_01Ac1E6X4Yw9Bt3iyktMoS5C
@eddmann
eddmann merged commit 7d22f8c into main Mar 12, 2026
2 checks passed
@eddmann
eddmann deleted the claude/fix-memory-flush-leak-0EKBu branch March 12, 2026 14:59
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.

2 participants