feat(context/runtime): 落地 manual compact(拆分自 #127)并补齐配置、TUI、事件与测试#133
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
feat: 拆分 default workdir 与 session workdir(P0-3)
minorcell
reviewed
Apr 3, 2026
minorcell
left a comment
Member
There was a problem hiding this comment.
@Yumiue
我这边主要有几点建议:
第一,尽量不要直接修改其他人负责的模块。因为你未必完全了解那部分代码的设计背景和后续计划,贸然改动容易引入不符合预期的实现,甚至会让对应 owner 在后续继续开发时,还要额外花时间理解和接手你新增的代码。
第二,既然架构上已经做了职责拆分,就应该尽量遵守这个边界。你把自己负责模块内的能力实现好、接口提供出来即可,其他模块如何接入,应当由对应负责人自己来完成。否则会越过模块边界,也容易让协作上显得比较冒犯。
第三,从 PR 组织的角度看,也建议控制改动范围,尽量保持“小步快跑”。这次你在实现自己模块功能的同时,又修改了其他模块,导致整个 PR 变得比较大,reviewer 阅读和评审都会比较吃力,也不容易判断这些跨模块改动应该和谁讨论、由谁来确认。
以这个 PR 为例,你在 context 里把 compact 功能和接口提供出来就已经足够了;后续只需要通知 @pionxe 和 @creatang,让他们分别去完成 runtime 和 tui 侧的修改即可,不建议在这个 PR 里继续直接改那两部分代码。
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.
变更背景
这是从 #127 拆出来的 manual-only 版本,但也是我最终决定只修改的版本,去掉micro compact
原 PR 同时包含了
micro compact和manual compact两部分能力,反馈是一次性改动过大。这个拆分版本只保留手动 compact 主链路,移除micro自动压缩相关实现,方便单独评审和合入。本 PR 保留的内容
internal/context/compact,提供 manual compact runnerkeep_recent/full_replace两种手动策略compact_summaryruntime.Compact(...)手动入口compact_start/compact_done/compact_error事件Run与Compact串行化,避免并发写同一会话context.compact.*配置:manual_strategymanual_keep_recent_spansmax_summary_chars/compact/compact的本地拦截,避免暴露底层session_id is emptydiscoverRuleFilesWithFinder遇到目录读取错误时显式返回错误,不再静默吞掉docs/guides/configuration.md增加 compact 配置与/compact说明docs/runtime-provider-event-flow.md补充 manual compact 事件流本 PR 明确不包含
micro compactmicro_enabled、tool_result_keep_recent、tool_result_placeholder_min_charsmicro_compact_applied事件my-changes.patch测试与验证
本地已通过:
close #120