feat(core): promote managed attachment media on first turn - #46182
Draft
safzanpirani wants to merge 2 commits into
Draft
feat(core): promote managed attachment media on first turn#46182safzanpirani wants to merge 2 commits into
safzanpirani wants to merge 2 commits into
Conversation
Contributor
|
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 |
6 tasks
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
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