refactor(context): unify request budgeting and context pipeline across agent and repair flows - #50
Merged
Merged
Conversation
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.
背景
本次变更完善了模型请求的 Token 预算治理,并重新整理 Context 模块职责边界。
此前预算只覆盖 Runtime Context Sections,没有完整计算 System Prompt、Transcript、Tool Calls、Tool Results、Tool Schemas 和消息协议开销。同时,ContextManager 承担了过多 pipeline 内部编排职责,Repair 阶段也缺少明确的 stage 和验证失败 Section。
主要变更
availableSectionTokens。ContextWindowExceededError,不发送非法请求。ContextPipeline,统一负责:ContextManagerOptions,隐藏 pipeline 内部实现细节。stage: "repair",并将验证失败作为高优先级、required 的临时 Context Section 注入。兼容性
maxInputTokens暂时保留为兼容字段,内部 Section 预算改用availableSectionTokens。验证
PIXELLE_CONFIG_HOME路径模拟测试,与本次变更无关