Skip to content

fix(control): never render compaction fold summaries as user bubbles#3932

Merged
esengine merged 1 commit into
main-v2from
fix/3653-compaction-fold-leak
Jun 11, 2026
Merged

fix(control): never render compaction fold summaries as user bubbles#3932
esengine merged 1 commit into
main-v2from
fix/3653-compaction-fold-leak

Conversation

@esengine

Copy link
Copy Markdown
Owner

Root cause

Compaction folds store their summary as a user-role message (so the model treats it as plain context):

  • Compact<compaction-summary>… (internal/agent/compact.go)
  • SummarizeFromSummary of the later conversation (compacted from here on):…
  • SummarizeUpToSummary of earlier conversation (compacted up to here):…

The chat surfaces filter injected user-role messages through IsSyntheticUserMessage, but none of the three fold prefixes were registered. In the normal live flow you never notice — the transcript shows the compaction card built from events. The leak needs a history reload that races a compaction pass, which is exactly the repro @cinos-1 nailed down: tab A mid-/compact → switch to tab B → switch back to A. The return trip sees local.running && !backend.running (missedTurnDone), resets the transcript, and re-renders from HistoryForTab — which faithfully served the raw fold as a giant user bubble full of tool calls, commands, and console digests.

Fix

Register the three fold prefixes in syntheticPrefixes (with the sync note extended to compact.go), so every history-replay surface — desktop reload, session resume, serve — drops them, matching what the live transcript shows. Table tests cover all three folds plus a guard that an ordinary user message starting with "Summary of…" is not swallowed.

Closes #3653

Compaction stores its summary as a user-role message so the model
treats it as context, but IsSyntheticUserMessage did not recognize the
three fold prefixes. A history reload that races a compaction pass
(switch tabs mid-/compact, switch back -> missedTurnDone reload) then
rendered the entire fold - tool calls, commands, console digests - as
a giant user bubble.

Closes #3653
@esengine esengine requested a review from SivanCola as a code owner June 11, 2026 03:57
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development agent Core agent loop (internal/agent, internal/control) labels Jun 11, 2026
@esengine esengine merged commit 3370467 into main-v2 Jun 11, 2026
14 checks passed
@esengine esengine deleted the fix/3653-compaction-fold-leak branch June 11, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [桌面版] 某种情况下,气泡里会显示某种不应该显示给用户的系统数据

1 participant