fix(agent-core): prevent oversized media from poisoning sessions - #1657
Conversation
🦋 Changeset detectedLatest commit: 6537c65 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64db102488
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| declare const mediaStripSnapshotBrand: unique symbol; | ||
|
|
||
| /** Opaque provider-visible media identities captured at a strip transition. */ |
There was a problem hiding this comment.
Move v2 symbol comments into the file header
packages/agent-core-v2/AGENTS.md says comments in this subtree must be header-only and must never sit beside functions, methods, or statements. This newly added per-symbol doc comment introduces a non-header comment in a v2 contract file, so it violates the local convention; move the explanation into the file header or remove it.
Useful? React with 👍 / 👎.
commit: |
Related Issue
No linked issue. This addresses a reproducible user report where reading a very large local image left the session stuck on HTTP 413 responses.
Problem
Image compression is intentionally best-effort and returns the original bytes when the input exceeds the safe decode limit or a codec fails.
ReadMediaFilepreviously treated that passthrough as a successful compression result and could attach the original image to every later provider request. Base64 expansion then pushed the request over the provider body limit.The existing 413 recovery retained the two newest media parts. When the oversized image was recent, the degraded resend still contained it, so the session remained poisoned across turns.
What changed
regionandfull_resolutionreads before loading the complete file when safe decoding is impossible.normal -> media-degraded -> media-strippedsequence.Validation
changeset statusis currently blocked by the existingstabilize-approval-test-cleanupchangeset onmain, which references a package that is not in the workspace. The changeset added by this PR is scoped to@moonshot-ai/kimi-codewith a patch bump.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.