Skip to content

fix: apply output cap during compaction#742

Closed
ktwu01 wants to merge 1 commit into
MoonshotAI:mainfrom
ktwu01:codex/compaction-max-output-size
Closed

fix: apply output cap during compaction#742
ktwu01 wants to merge 1 commit into
MoonshotAI:mainfrom
ktwu01:codex/compaction-max-output-size

Conversation

@ktwu01

@ktwu01 ktwu01 commented Jun 14, 2026

Copy link
Copy Markdown

Related Issue

Fixes #476

Problem

Normal model requests pass the configured model maxOutputSize into completion budget resolution, but full compaction requests only passed the reserved-context fallback. For models with a very large context window and a smaller output cap, compaction could therefore send a completion cap based on context size rather than the model output limit.

What changed

  • Pass this.agent.config.maxOutputSize into full compaction's completion budget resolution.
  • Added a regression test that patches the resolved runtime provider with a model output cap and verifies compaction sends that cap.
  • Added a changeset for @moonshot-ai/agent-core and the CLI bundle.

Validation

  • pnpm --filter @moonshot-ai/agent-core exec vitest run test/agent/compaction/full.test.ts
  • pnpm --filter @moonshot-ai/agent-core typecheck
  • pnpm --filter @moonshot-ai/kimi-code typecheck
  • pnpm exec oxlint --type-aware packages/agent-core/src/agent/compaction/full.ts packages/agent-core/test/agent/compaction/full.test.ts
  • Read-only staged diff audit for internal identifiers and secrets: clean

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a7b66d6

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

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core Patch
@moonshot-ai/kimi-code 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

@liruifengv

liruifengv commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Thanks for contributing. This PR appears to be part of a batch generated by AI scanning the issue list, and we are not accepting this kind of bulk PR, so it is being closed.

@liruifengv liruifengv closed this Jun 15, 2026
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.

Compaction Fails with APIContextOverflow due to sending the wrong context length

2 participants