[Bug]: Agent compaction summary leaks into the visible chat transcript as a normal message

Author: mowenQWQCreated Sep 17, 2026Updated Sep 17, 2026

This issue was translated automatically.

Environment

  • Cherry Studio 2.0.14 (packaged)
  • Windows 11 Home China x64
  • Agent session (Claude Code runtime), long-running automated task

What happened

During a long-running agent session, the context-compaction summary was streamed into the chat as a regular assistant message and persisted in the transcript. It starts with the summarizer's own framing, then the standard compact structure:

Let me chronologically analyze this conversation, which is a continuation of a much
longer session (previously compacted).

Context from prior summary: ...

1. Primary Request and Intent:
...

That is the compaction prompt's output — an internal artifact that should replace the prompt history, not appear as a turn in the conversation.

Frequency

Observed once so far. The session has run for a long time and compaction must have triggered more than once, but only this occurrence surfaced in the transcript.

Why Cherry's own in-loop compaction is not the source

It was disabled for this session's model:

module: inLoopCompaction
"model declares no contextWindow — in-loop compaction disabled for this request"
modelId: <provider-id>::sensenova-6.8-flash-lite
(7 occurrences in the logs)

Source (inLoopCompaction.ts:159-164): the hook returns {} as soon as resolveContextWindow(...) === null, so Cherry's compaction never ran here. The leaked summary came from the runtime's (Claude Code) own compaction path.

Impact

The full compacted summary of the conversation history is shown to the user and persisted in the transcript. For any session containing sensitive content, that history summary would be exposed in plain text in the chat UI.

Possibly related

  • #18397 — Model context window not passed to Claude Code SDK
  • #18894 — Agent v2 context grows past provider window before auto-compaction
  • #19651 — Agent gets stuck when long context triggers compression

Suggested direction

  • Don't surface the compaction artifact as a normal assistant turn — either fold it behind a "context compacted" marker (like the existing compactionSink anchor that in-loop compaction already uses) or drop it from the transcript entirely.
  • If the runtime's compaction output must be shown, label it distinctly so it is not persisted as a regular message.

Original Content

Environment

  • Cherry Studio 2.0.14 (packaged)
  • Windows 11 Home China x64
  • Agent session (Claude Code runtime), long-running automated task

What happened

During a long-running agent session, the context-compaction summary was streamed into the chat as a regular assistant message and persisted in the transcript. It starts with the summarizer's own framing, then the standard compact structure:

Let me chronologically analyze this conversation, which is a continuation of a much
longer session (previously compacted).

Context from prior summary: ...

1. Primary Request and Intent:
...

That is the compaction prompt's output — an internal artifact that should replace the prompt history, not appear as a turn in the conversation.

Frequency

Observed once so far. The session has run for a long time and compaction must have triggered more than once, but only this occurrence surfaced in the transcript.

Why Cherry's own in-loop compaction is not the source

It was disabled for this session's model:

module: inLoopCompaction
"model declares no contextWindow — in-loop compaction disabled for this request"
modelId: <provider-id>::sensenova-6.8-flash-lite
(7 occurrences in the logs)

Source (inLoopCompaction.ts:159-164): the hook returns {} as soon as resolveContextWindow(...) === null, so Cherry's compaction never ran here. The leaked summary came from the runtime's (Claude Code) own compaction path.

Impact

The full compacted summary of the conversation history is shown to the user and persisted in the transcript. For any session containing sensitive content, that history summary would be exposed in plain text in the chat UI.

Possibly related

  • #18397 — Model context window not passed to Claude Code SDK
  • #18894 — Agent v2 context grows past provider window before auto-compaction
  • #19651 — Agent gets stuck when long context triggers compression

Suggested direction

  • Don't surface the compaction artifact as a normal assistant turn — either fold it behind a "context compacted" marker (like the existing compactionSink anchor that in-loop compaction already uses) or drop it from the transcript entirely.
  • If the runtime's compaction output must be shown, label it distinctly so it is not persisted as a regular message.

中文摘要:长会话(Agent + Claude Code runtime)的上下文压缩摘要被当成正常 assistant 消息流式输出并持久化到对话里——内容以压缩提示词的产物开头("Let me chronologically analyze this conversation…"),后接 /compact 标准结构(1. Primary Request and Intent:)。日志显示 Cherry 自己的 in-loop compaction 在该模型上因 "model declares no contextWindow" 被禁用(源码 inLoopCompaction.ts:159-164 早返回),所以泄漏来自 runtime 自己的压缩路径。目前观察到 1 次。影响:整段对话历史摘要在聊天界面明文可见。建议不要把压缩产物当作正常回合展示(可复用既有 compactionSink 标记折叠,或直接从 transcript 剔除)。