Repository navigation
fix(core): preserve notices for unsupported attachments - #56519
rudycelekli wants to merge 2 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
The fix works and looks right. I ran OpenCode from source with the simulated model and attached archive.zip through an @ mention. On the base branch, the model request had no trace of the attachment. With this change, it contains the unsupported attachment format notice. The changed core tests pass (81), and the core type check passes. The new unit tests fail on the base, as expected.
The notice uses the same ERROR: Cannot read … Inform the user. wording as unsupportedMedia in session/model-request.ts, and plain-text files still reach the model as text, so this is consistent.
Public API: unchanged.
Tests: 140 lines of tests is a lot for a 6-line fix. One small table-driven test in session-runner-message.test.ts covers the fixed behaviour. The test that compiles requests for three providers and the one that goes through prompt admission check things this change does not touch, so they can be dropped to keep the PR minimal.
Note: audio and video attachments (#54600) now get this notice too, even for models that accept audio or video. That's better than dropping them silently, but forwarding them to those models still needs a separate change.
Related: #54600
Signed-off-by: Rudy Celekli <[email protected]>
Issue for this PR
Closes #41722
Type of change
What does this PR do?
Keep unsupported user attachments visible as a format notice in model context, including attachment-only prompts. Do not forward unsupported binary data.
How did you verify your code works?
toLLMMessagestables for unsupported formats and attachment identifiers. Removed the provider-request compilation and durable prompt-admission tests requested in review.bun run check(34 tasks) passed.Screenshots / recordings
No visual UI code changed; behavior is asserted directly.
Checklist
Added by the opencode bot (AI-generated).
Related: #54600