Revert: trust user-declared modalities in openai-compatible

Merged
AL
5mo ago
+0-15

Reverts #83 (merge 8f9db1737). Restores unsupportedParts to its pre-#83 behavior.

Why revert

#83 added an early-return for @ai-sdk/openai-compatible providers in unsupportedParts, intended as a defense against the gateway dropping screenshots when models.dev had no entry to seed image capability. After cutting v0.1.9-rc1 from this branch we discovered:

  1. The defensive layer is redundant. Cloud-side fix browser-use/cloud#4461 makes the v4-worker write modalities: { input: ["text", "image"], output: ["text"] } into the worker's opencode.json. provider.ts:1298-1304 already reads that and sets capability.input.image = true, so the original unsupportedParts correctly forwards image parts. Vision was confirmed working end-to-end on v0.1.8 + cloud #4461 (smoketest ea8aec3d-a34f-43f7-b84b-a0dd955ce5e8 — model transcribed example.com H1/body/link verbatim from a captured screenshot, prompt-cache hits visible at cache.read=19071 per turn).
  2. v0.1.9-rc1 (this branch's content) hangs at startup. Multiple AgentCore runs with rc1 either issued zero LLM calls or fired only the title-generation request and then went unresponsive. Root cause not pinned to source diff vs v0.1.8 (the only code-path change was the 15-line addition reverted here), but the released binary is non-functional and rolling forward to ship it served no purpose given (1).

Reverting to keep the codebase free of untested, unnecessary capability-handling code paths and to restore main to a state that builds into a working binary identical in behavior to v0.1.8.

Diff

  • packages/opencode/src/provider/transform.ts: removed the early-return guard for @ai-sdk/openai-compatible (15 lines).

Tests

bun typecheck from packages/opencode/ produces no new errors in transform.ts (existing unrelated drizzle SQL type errors pre-date this change).

Follow-up

  • Re-cut release tag (likely v0.1.10 directly, skipping a "real" v0.1.9 since rc1 burned the number) from this main after merge.
  • Cloud #4461 modalities declaration remains the single source of truth for image support over the v4 gateway.

Summary by cubic

Reverts #83 by removing the @ai-sdk/openai-compatible early-return in unsupportedParts, restoring the original pre-#83 behavior. This returns to v0.1.8 behavior where image parts are forwarded based on cloud-declared modalities and avoids the startup hangs seen in v0.1.9-rc1.