Skip to content

feat(context): 支持 reactive compact 模式#147

Merged
minorcell merged 1 commit into
1024XEngineer:mainfrom
wynxing:new_Feat-manual
Apr 4, 2026
Merged

feat(context): 支持 reactive compact 模式#147
minorcell merged 1 commit into
1024XEngineer:mainfrom
wynxing:new_Feat-manual

Conversation

@wynxing

@wynxing wynxing commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

背景

为后续在 provider 上下文过长错误场景下接入自动恢复能力,需要先在 context 模块提供可独立调用的 reactive compact 模式。

本次修改

  • internal/context/compact 中新增 ModeReactive,使 Runner.Run(...) 同时支持 manualreactive 两种 mode。
  • 保持单一 compact 管线不变,reactive 继续复用 transcript 持久化、摘要生成、摘要校验与消息重组流程。
  • reactive 的默认策略固定为 keep_recent,继续复用 tool call / tool result 原子块保护与最近显式用户指令保护。
  • 将真实 mode 透传到 compact prompt,便于后续 runtime 接入时保持上下文语义一致。
  • 补充 internal/context/compact 与 compact prompt 相关测试,并更新文档说明。

影响范围

  • 本次仅交付 context 侧能力。
  • 尚未包含 provider 过长错误识别、runtime 自动触发、单次重试门禁与 TUI 事件扩展。
  • 后续可由 runtime 直接调用 compact.Run(mode=reactive) 完成接入。

验证

  • go test ./internal/context/...
  • go test ./internal/runtime -run TestCompactSummaryGenerator

关联事项

@codecov

codecov Bot commented Apr 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@minorcell minorcell merged commit d4e63ca into 1024XEngineer:main Apr 4, 2026
2 checks passed
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