Skip to content

fix(agent-core): recover from unsupported image_url variants - #2764

Open
030611 wants to merge 1 commit into
MoonshotAI:mainfrom
030611:fix/compaction-image-url-2759
Open

fix(agent-core): recover from unsupported image_url variants#2764
030611 wants to merge 1 commit into
MoonshotAI:mainfrom
030611:fix/compaction-image-url-2759

Conversation

@030611

@030611 030611 commented Aug 9, 2026

Copy link
Copy Markdown

Related Issue

Resolve #2759

Problem

During context compaction, text-only providers can reject retained image blocks with unknown variant image_url, expected text. This diagnostic was not classified as an image-format error, so the existing media-stripped retry did not run.

What changed

  • Recognize the provider diagnostic in isImageFormatError.
  • Cover it in the classifier test and the full-compaction recovery test.
  • Add a patch changeset for the CLI behavior fix.

Tests:

  • pnpm --filter @moonshot-ai/agent-core-v2 test -- test/kosong/contract/errors.test.ts test/agent/fullCompaction/fullCompaction.test.ts (89 passed)
  • pnpm --filter @moonshot-ai/agent-core-v2 lint:imports
  • pnpm --filter @moonshot-ai/agent-core-v2 typecheck
  • pnpm exec oxlint on the changed TypeScript files

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.

Signed-off-by: Errant <2843409461@qq.com>
@changeset-bot

changeset-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fdfa8ab

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/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

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.

不支持图片的模型在上下文压缩时因 image_url 内容报 400 错误

1 participant