Skip to content

feat: recover from image rejections and add Files API image upload - #101

Merged
mbuckaway merged 2 commits into
fork/mainfrom
feat/deepseek-image-support
Sep 2, 2026
Merged

mbuckaway merged 2 commits into
fork/mainfrom
feat/deepseek-image-support

Conversation

@mbuckaway

Copy link
Copy Markdown
Owner

Related Issue

Not tied to an upstream issue — fork-internal change requested by the maintainer.

Problem

When a provider (e.g. DeepSeek) rejects an image with a 400, the session is permanently frozen: the offending image stays in the conversation history and is re-sent on every subsequent prompt, so every turn fails until the user starts a new session. There is also no way to send an image via the provider's Files API — only inline base64 and passthrough URLs — so large images or images over the 48 MiB body limit cannot be processed.

What changed

  • Classify DeepSeek's image-rejection 400 messages as recoverable image errors in both engines (agent-core-v2 and the v1 kosong/agent-core).
  • Make the media-strip sticky across turns and durable across a session reload, so a rejected image stays stripped instead of being re-sent.
  • Capability-gate remote http(s) media (previously only daemon-file media was gated) and drop the non-standard id field on the OpenAI image_url wire part.
  • Add a config-declared image_file_api capability that sends images via the provider's Files API (file content part with file_id), alongside inline base64 and URL passthrough.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (fork-internal change; no upstream issue).
  • I have added tests that prove the feature works.
  • Ran gen-changesets skill.
  • Ran gen-docs skill, or this PR needs no doc update.

When a provider rejects an image (e.g. DeepSeek's 'This model does not support image' 400), the session is no longer frozen: the rejected image is stripped from all later requests, across turns and session reloads. Remote http(s) media is now capability-gated, the non-standard image_url id is dropped, and a config-declared image_file_api capability sends images via the provider's Files API in addition to inline base64 and URLs.
@mbuckaway
mbuckaway merged commit da83a11 into fork/main Sep 2, 2026
12 checks passed
@mbuckaway
mbuckaway deleted the feat/deepseek-image-support branch September 2, 2026 12:37
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.

1 participant