feat(context): 支持 reactive compact 模式#147
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
为后续在 provider 上下文过长错误场景下接入自动恢复能力,需要先在 context 模块提供可独立调用的
reactive compact模式。本次修改
internal/context/compact中新增ModeReactive,使Runner.Run(...)同时支持manual与reactive两种 mode。reactive继续复用 transcript 持久化、摘要生成、摘要校验与消息重组流程。reactive的默认策略固定为keep_recent,继续复用 tool call / tool result 原子块保护与最近显式用户指令保护。internal/context/compact与 compact prompt 相关测试,并更新文档说明。影响范围
compact.Run(mode=reactive)完成接入。验证
go test ./internal/context/...go test ./internal/runtime -run TestCompactSummaryGenerator关联事项