Repository navigation
Conversation
This branch has not been deployed
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.
Issue for this PR
Follow-up to #53787 (#53786).
Type of change
What does this PR do?
#53787 stops sending GIFs and other non-PNG/JPEG/WebP images to xAI, but it checks the catalog provider ID. Grok served through OpenCode Zen (
opencode/grok-4.7) has provideropencode, so the check never matches. Zen passes the GIF to xAI, getsDownloaded response does not contain a valid JPG, PNG, WebP, or ICO image., and the session stays stuck.ModelResolver.Resolvednow carries the catalog modelfamily. The image check applies when the provider isxaior the family starts withgrok(grokandgrok-buildin the catalog). This covers Zen, and Grok from other hosts such as Copilot, OpenRouter, Azure and Bedrock, which use the same families. Like fix(core): only send png, jpeg and webp images to xAI #53787, it runs when the request is built, so stuck sessions recover.invalid_imagearrives with no HTTP status andtype: "api_error".api_erroris a server code, so the error was classified asProviderInternaland retried. A stuck session spent about 95 seconds (11 attempts) on every message before failing.invalid_imageis now an invalid-request code, and an invalid-request code outranks a server code in the same body when there is no status.How did you verify your code works?
session-model-request.test.ts(Grok family under a non-xAI provider) andprovider-error.test.ts(the error body recorded from xAI). Both fail without the change.bun typecheckandbun run checkpass. The fullpackages/coreandpackages/aisuites have 7 and 2 failures (shell parsing, Bedrock PDF recordings) that also fail on cleanv2.opencode/grok-4.7(Zen): every GIF step returned 400 onv2. With this change, the model says it cannot read the GIF and the follow-ups answer. The PNG is still sent and described.xai/grok-4.7: still works as after fix(core): only send png, jpeg and webp images to xAI #53787.invalid_imagelive after the fix, because OpenCode rejects undecodable images before sending them and GIFs no longer reach xAI. The retry fix is covered by the unit test with the recorded body.Screenshots / recordings
N/A
Checklist