Repository navigation
feat(core): promote managed attachment media on first turn - #46182
safzanpirani wants to merge 2 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search results, I found one related PR that is not a duplicate but rather a stacked dependency: Related PR (not a duplicate):
This is intentional as per the PR description which states this is "PR 2 of the 3-PR plan" and only the top commit represents the current PR's diff, with the rest being #46175's base. The searches also found PR #43314 about degrading undecodable image attachments, but this is addressing a different concern (error handling) rather than native media delivery. No duplicate PRs found |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #46173 (PR 2 of the 3-PR plan there; stacked on #46175 — only the top commit
f9e6c06c6is this PR's diff, the rest is #46175's base)Type of change
What does this PR do?
Native media delivery for managed attachments. On the first provider turn that consumes a prompt, a stored image or PDF is sent as native media (path in the media part's filename) when the model's catalog capabilities, the sniffed MIME, the protocol route, and the decoded-size limit all allow it. Anything disqualified degrades to the path-only text part from #46175 instead of aborting. Later turns replay path-only — the file is never re-read or re-encoded, and no base64 is persisted (the #42263 failure class). Delivery is at-most-once via a durable
nativeMediaDeliveredAtmarker written before provider I/O. Media admission is owned by each protocol (Chat Completions: images only; Responses/Anthropic/Gemini: images + PDF), so core can't drift from what lowering accepts.How did you verify your code works?
packages/core: focused suites 124 pass — includes a two-real-runner-turn test with a recording LLM client that kills and reopens the runtime/store between turns, then asserts the replay request is path-only and raw session_message rows contain no media base64. Typecheck clean.packages/llm: 300 pass / 30 skipped, typecheck clean — per-protocol admission and PDF lowering tests for Responses, Anthropic, Gemini; Chat Completions PDF rejection.packages/opencode: HTTP attachment suite 5 pass.Screenshots / recordings
Not a UI change.
Checklist