fix(opencode): export per-model attachment and modalities capabilities - #4291
fix(opencode): export per-model attachment and modalities capabilities#4291L4XB wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughOpenCode model catalog entries now preserve declared input modalities. Config export maps recognized modalities to ChangesOpenCode modality propagation
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant ProxyRows
participant opencodeCatalogFromProxyRows
participant opencodeCapabilityFields
participant opencodeProviderBlocks
participant OpenCode
ProxyRows->>opencodeCatalogFromProxyRows: provide inputModalities
opencodeCatalogFromProxyRows->>opencodeCapabilityFields: preserve catalog modalities
opencodeCapabilityFields->>opencodeProviderBlocks: derive attachment and modalities
opencodeProviderBlocks->>OpenCode: emit V1 and V2 model capabilities
Merge Risk: ⚪ Minimal · up to OpenCode exports now expose supported declared input capabilities without changing the default behavior for models lacking modality declarations. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. |
리뷰 · 우선순위 71 / 80이 PR은 OpenCode로 내보내는 모델 설정에 이미지(첨부) 능력 표시가 빠져 있던 구멍을 메웁니다. 지금 고치는 길은 세 갈래로 이어집니다. 첫째, 선언이 없는 모델은 능력 필드를 아예 안 씁니다. Pi·Gajae는 이미
메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
The OpenCode config export emitted only name and limit per model. With the custom opencodex provider id absent from models.dev, opencode's model loader defaulted capabilities.attachment and capabilities.input.image to false, so every exported model was cataloged text-only and the client blocked image attachments before a request reached the proxy, including vision-capable native slugs and rows whose /api/models entry declares ["text","image"]. Carry inputModalities from the proxy row into OpencodeCatalogModel (and hand-assembled routed models) and have opencodeProviderBlocks emit attachment plus modalities on both the V1 and V2 entries when a model declares its modalities. Values outside opencode's schema are dropped with text as the floor; a model with nothing declared stays capability-free so the client keeps its own default. The export command now reads the modalities from the catalog entry instead of re-joining them by key. Refs lidge-jun#4286
30ce6f8 to
ee35b25
Compare
|
Superseded / landed via maintainer carry #4300 (squash merge |
Summary
nameandlimitper model. Because the customopencodexprovider id is absent from models.dev, opencode's model loader defaultedcapabilities.attachmentandcapabilities.input.imagetofalse, so every exported model was cataloged text-only and the client blocked image attachments before a request reached the proxy, including vision-capable native slugs and rows whose/api/modelsentry declares["text","image"]([Bug]: OpenCode config export omits per-model image capabilities — attachments blocked for every opencodex model #4286).inputModalitiesfrom the/api/modelsrow is now carried intoOpencodeCatalogModel(and into hand-assembled routed models for the launch block), andopencodeProviderBlocks()emitsattachmentplusmodalitieson both the V1 and V2 entries when a model declares its modalities. Declared values are filtered to what opencode's schema accepts (text,audio,image,video,pdf); if none remain,textis the floor. A model with nothing declared stays capability-free so the client keeps its own default rather than a guessed one, which mirrors the existing "no metadata is guessed" rule forlimit. V1 and V2 own separatemodalitiesobjects, likelimit.exportModelsFromProxyRowsreads the modalities from the catalog entry instead of re-joining them bynamespaced, so the visible, deduped row is the single source for modalities as it already is for the effort ladder.{"name": "gpt-5.6-luna (native)", "limit": {...}, "attachment": true, "modalities": {"input": ["text","image"], "output": ["text"]}}.Closes #4286 (to be closed by hand once this is on
dev, per the branch policy).Verification
bun x tsc --noEmit: clean.bun test tests/config/client-config-export.test.ts tests/providers/opencode-cli.test.ts tests/cli/cli-export-command.test.ts: 152 pass, 0 fail. New tests cover: image-capable, text-only, audio-only, unknown-only and undeclared rows on both blocks; separatemodalitiesobjects per block;opencodeCatalogFromProxyRowscarryinginputModalities(empty arrays dropped); hand-assembled routed models throughbuildOpencodeProviderBlock. The existing Fast-expansion test now expects the capability fields for its image-capable fixture.bun test tests/config tests/providers tests/cli tests/clients: 5652 pass / 30 fail on this branch, and the same 30 failures on currentorigin/devin this environment (Kiro per-account quota and similar network-dependent cases); no failure is unique to the branch.Checklist
Summary by CodeRabbit
New Features
Tests
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.