fix(llm): compact on provider image limits - #127
Merged
Conversation
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.
Problem
Fireworks rejects Kimi conversations after more than 60 images with HTTP 400:
Too many images were provided, we currently limit the number of images per conversation to 60.BrowserCode currently classifies that as a fatal
APIError, so its existing automatic media-stripping compaction never runs. Production saw this exact signature across multiple Kimi runs.Fix
Classify the provider image-count rejection as context overflow. That routes it through the existing overflow recovery path: compact with media stripped, retry the interrupted turn, and preserve the stable compacted prefix instead of truncating every request to the newest 60 images.
This composes with #125, which ensures a recovered overflow does not emit a terminal error or exit nonzero.
Verification
packages/llm:bun test test/provider-error.test.ts(2 passed)packages/llm:bun typecheckpackages/opencode:bun test test/session/message-v2.test.ts(36 passed)packages/opencode:bun typecheckgit diff --checkRelease
Include this and merged #125 in stable
v0.1.14; Cloud should update its exact bcode pin only after that release has published all binaries.Summary by cubic
Classifies Fireworks/Kimi “Too many images … limit 60” errors as context overflow so we compact by stripping media and retry, instead of failing. This avoids 400s on long image threads and preserves the stable compacted prefix.
/too many images (?:were )?provided/ito overflow patterns inpackages/llm.packages/llmandpackages/opencodeto cover the new classification.Written for commit 2968a2a. Summary will update on new commits.