Skip to content

refactor(compaction): 压缩提示消歧义 — removed→summarized + before→after 展示#204

Merged
yishuiliunian merged 1 commit into
mainfrom
refactor/compaction-wording
Jun 25, 2026
Merged

refactor(compaction): 压缩提示消歧义 — removed→summarized + before→after 展示#204
yishuiliunian merged 1 commit into
mainfrom
refactor/compaction-wording

Conversation

@yishuiliunian

Copy link
Copy Markdown
Contributor

Summary

  • 压缩完成的系统提示 "N messages removed, M kept" 两个词都误导:"removed" 像删除丢弃(实际是摘要进 summary、还会 rehydrate 重读文件),"kept" 像原样留着(实际是压缩的消息总数,含新生成的 summary)。
  • 纯命名/文案改动,无行为变化。

Changes

  • 协议字段 CompactionSummary.removedsummarized(加 doc:condensed 进 summary,非 discarded)。
  • 用户文案改成 before→after 转移,与 tokens 行平行:
    • 旧:406 messages removed, 11 kept. 222325→11121 tokens (94% freed)
    • 新:417→11 messages (406 summarized), 222325→11121 tokens (94% freed)
  • 改动链:loopal-protocol(字段)、loopal-runtime(compaction_run 构造/日志)、loopal-view-state(mutators/conversation_display 渲染)。
  • wire-pin 测试(event_lifecycle_test)+ 6 个 e2e/单测构造点同步更新。

Test plan

  • 本地全量 94/94、clippy 零警告、rustfmt。
  • CI passes

压缩完成的系统提示原文是 "N messages removed, M kept",两个词都误导:
- "removed" 像是把消息删掉丢弃了 —— 实际是被 LLM 摘要进 summary(内容
  还在,还会 rehydrate 重读文件)。
- "kept" 像是把这些原样留着 —— 实际 kept 是压缩**后**的消息总数,含新
  生成的 summary,不是"保留的原文"。

改法:
- 协议字段 `CompactionSummary.removed` → `summarized`(加 doc 说明是
  condensed 进 summary,非 discarded)。
- 用户文案改成 before→after 转移,和 tokens 那行平行:
  旧 "406 messages removed, 11 kept. 222325→11121 tokens (94% freed)"
  新 "417→11 messages (406 summarized), 222325→11121 tokens (94% freed)"
  一眼看出上下文从 417 条缩到 11 条,无歧义词。

纯命名/文案改动,无行为变化。wire-pin 测试 + 6 个 e2e/单测构造点同步更新。
@yishuiliunian yishuiliunian merged commit 87ad2b9 into main Jun 25, 2026
4 checks passed
@yishuiliunian yishuiliunian deleted the refactor/compaction-wording branch June 25, 2026 16:01
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.

1 participant