The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 14:15 UTC
fix(server): HTML and Markdown attachments no longer fail OpenCode turns (#19319)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 14, 2026 at 01:38 UTC
c8a6768f079f9448228668c40ffe2262bda202a6
2 files changed
+10
-4
packages/provider-opencode/src/server/OpenCodeRuntime.cliParsers.test.ts
+6
-2
@@ -293,11 +293,15 @@ describe("toOpenCodeFileParts", () => {
293
const parts = OpenCodeRuntime.toOpenCodeFileParts({
294
attachments: [
295
attachment("application/pdf"),
296
- attachment("text/markdown"),
296
+ attachment("text/plain"),
297
attachment("image/png"),
298
// A ZIP file part makes OpenCode's Anthropic path throw before the
299
// turn starts; it must ride only as the prompt's file path line.
300
attachment("application/zip"),
301
+ // OpenCode inlines only text/plain itself. Other text types reach the
302
+ // model API as raw file parts, which Anthropic and OpenAI reject.
303
+ attachment("text/html"),
304
+ attachment("text/markdown"),
305
attachment("application/octet-stream"),
306
// Image formats the model APIs reject stay on the fallback path too.
307
attachment("image/bmp"),
@@ -310,7 +314,7 @@ describe("toOpenCodeFileParts", () => {
314
315
NodeAssert.deepEqual(
316
parts.map((part) => part.mime),
313
- ["application/pdf", "text/markdown", "image/png"],
317
+ ["application/pdf", "text/plain", "image/png"],
318
);
319
});
320
packages/provider-opencode/src/server/OpenCodeRuntime.ts
+4
-2
@@ -469,7 +469,9 @@ export function openCodeQuestionId(
469
* else (ZIP, binaries, image formats like BMP/AVIF/SVG that model APIs
470
* reject, or files over the direct-attachment size limit) would make the turn
471
* fail before it starts, so those ride only as the file path ProviderService
472
- * puts in the prompt.
472
+ * puts in the prompt. Text is native only as text/plain, which OpenCode reads
473
+ * itself; other text types (HTML, Markdown, CSV) reach the model API as raw
474
+ * file parts, which Anthropic and OpenAI reject.
475
*/
476
const OPENCODE_NATIVE_IMAGE_MIMES = new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]);
477
const OPENCODE_NATIVE_FILE_PART_MAX_BYTES = 20 * 1024 * 1024;
@@ -484,7 +486,7 @@ function isOpenCodeNativeFilePart(input: {
486
const normalized = input.mimeType.trim().toLowerCase();
487
return (
488
OPENCODE_NATIVE_IMAGE_MIMES.has(normalized) ||
487
- normalized.startsWith("text/") ||
489
+ normalized === "text/plain" ||
490
normalized === "application/pdf"
491
);
492
}