Skip to content

refactor: 移除 MicroCompact 子系统#707

Open
Yumiue wants to merge 1 commit into
1024XEngineer:mainfrom
Yumiue:main
Open

refactor: 移除 MicroCompact 子系统#707
Yumiue wants to merge 1 commit into
1024XEngineer:mainfrom
Yumiue:main

Conversation

@Yumiue
Copy link
Copy Markdown
Collaborator

@Yumiue Yumiue commented Jun 1, 2026

概述

本 PR 彻底移除 MicroCompact 子系统,降低上下文管理模块的复杂度,明确 compact 策略的单一职责。

Closes #706

变更内容

删除文件(9 个,约 2200 行)

文件 说明
internal/context/microcompact.go 核心压缩逻辑
internal/context/microcompact_test.go 单元测试
internal/context/microcompact_summarizer_test.go summarizer 测试
internal/context/pin_checker.go pin 检查器
internal/context/pin_checker_test.go pin 检查器测试
internal/tools/micro_compact_policy.go policy 定义
internal/tools/micro_compact_summarizer.go summarizer 接口
internal/tools/micro_compact_summarizer_test.go summarizer 测试
internal/tools/micro_compact_summarizers_builtin.go 内置 summarizer 实现

修改文件(约 20 个)

  • internal/context/types.go — 移除 MicroCompact 相关类型与字段
  • internal/context/builder.go — 移除 microcompact 引用与构建逻辑
  • internal/context/projection.go — 移除 microcompact 投影逻辑
  • internal/config/context.go — 移除 microcompact 配置项
  • internal/config/loader.go — 移除配置加载中的 microcompact 分支
  • internal/tools/manager.go — 移除 summarizer 注册
  • internal/tools/registry.go — 移除 microcompact 工具注册
  • internal/runtime/runtime.go — 移除 runtime 中的 microcompact 引用
  • internal/app/bootstrap.go — 移除启动时的 microcompact 初始化
  • docs/context-compact.md — 移除 microcompact 相关文档
  • docs/tech-debt.md — 更新技术债务清单
  • docs/roadmap.md — 更新路线图
  • 各工具文件 — 移除 microcompact 相关的 import 与引用

影响分析

  • 编译go build ./... 通过 ✅
  • 测试go test ./... 通过 ✅
  • 主链路:无影响,microcompact 未被 runtime 主链路调用
  • 配置:microcompact 配置项已移除,不影响其他配置加载
  • 文档:已同步更新,无残留引用

测试计划

  • go build ./... 编译通过
  • go test ./... 全部通过
  • go vet ./... 无警告
  • grep 确认无残留 microcompact 引用
  • 相关文档已同步更新

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/context/projection.go 86.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review found two noteworthy issues: one read-time context bounding regression and one formatting regression. Targeted tests passed with go test ./internal/context ./internal/config ./internal/runtime ./internal/tools.

StableSystemPrompt: stablePrompt,
DynamicSystemPrompt: dynamicPrompt,
Messages: applyReadTimeContextProjection(
Messages: ProjectToolMessagesForModel(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With micro-compact removed, this path now projects every retained tool result at full DefaultOutputLimitBytes size. The default read_time_max_message_spans=24 can therefore send many 64 KiB tool outputs back through prompt estimation/provider calls, and it also keeps sensitive tool output visible longer than before. Please keep a read-time per-tool excerpt/sanitization step here (similar to the recent/memo projection) or otherwise bound projected tool content after trimming.

})
}

contextBuilder = agentcontext.NewConfiguredBuilder()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is not gofmt-formatted (the assignment and closing brace are over-indented). Running gofmt also changes several nearby files touched by this PR, so please format the changed Go files before merging.

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.

refactor: 移除 MicroCompact 子系统

1 participant