fix(agent-core): use max output size for compaction budget - #1129
Merged
wbxl2000 merged 4 commits intoJun 27, 2026
Conversation
🦋 Changeset detectedLatest commit: 22844a0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
Collaborator
|
👍 Thanks for the PR — this will be included in the next release. |
Merged
5 tasks
This was referenced Jun 27, 2026
Open
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.
三周前v0.8.0的bug了,现在v0.20.0了,PR还没通过,也没人修,真的希望能解决一下
Related Issue
Resolve #476
Problem
这个版本在v0.8.0的时候就有了,我那时候提了个PR 点击查看,这个只需要1行代码就能解决,但是没人审核,没想到现在还没人通过。
这个问题也很简单的,就是对于OpenAI格式的第三方模型,运行/compact 的时候,只暴露了兜底值reservedContextSize,没有传入模型配置里的 maxOutputSize。只需要传入就好了,我还补了一些测试用例和changeset。感觉是之前写的时候漏掉了这个路径。
What changed
packages/agent-core/src/agent/compaction/full.ts 里添加了一行代码:
maxOutputSize: this.agent.config.maxOutputSize
让上下文压缩的时候,传入的maxOutputSize与普通对话路径 (packages/agent-core/src/agent/index.ts) 保持一致。
同时新增测试用例,验证 compaction 从模型配置读取maxOutputSize作为 hard cap。
before:

after:

Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.