Skip to content

fix(compaction): pass maxOutputSize to resolveCompletionBudget#482

Open
liuhaoyooc wants to merge 1 commit into
MoonshotAI:mainfrom
liuhaoyooc:fix/compaction-max-output-size
Open

fix(compaction): pass maxOutputSize to resolveCompletionBudget#482
liuhaoyooc wants to merge 1 commit into
MoonshotAI:mainfrom
liuhaoyooc:fix/compaction-max-output-size

Conversation

@liuhaoyooc
Copy link
Copy Markdown

The compaction worker was not passing \maxOutputSize\ to \resolveCompletionBudget, causing it to fall back to \max_context_size\ as the completion token cap.

For models configured via the openai_legacy provider (e.g. glm-5.1), this resulted in \max_tokens\ being set to the full context window size, which upstream APIs may reject with a 400 error.

Normal chat requests already pass \maxOutputSize\ correctly via \Agent.llm. This change aligns the compaction path with the normal request path.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2026

🦋 Changeset detected

Latest commit: 17beca6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/agent-core Patch

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

The compaction worker was not passing maxOutputSize to resolveCompletionBudget,
causing it to fall back to max_context_size as the completion token cap.
For models like glm-5.1 configured via openai_legacy provider, this resulted
in max_tokens being set to the full context window (e.g. 202752), which the
upstream API rejected with a 400 error.

Normal chat requests already pass maxOutputSize correctly via Agent.llm.
@liuhaoyooc liuhaoyooc force-pushed the fix/compaction-max-output-size branch from 617184b to 17beca6 Compare June 5, 2026 11:11
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.

1 participant