feat(model): Kimi K3 (1M context) + fix vision-blinding provider config - #143
Conversation
Adds the k3 model documented for the coding plan's third-party-agent setup: 1,048,576-token context (4x the kimi-for-coding window), image input, and deep reasoning on by default. Per the official docs only "max" is currently accepted for thinking depth (low/high are documented as planned but not yet live), so ReasoningOptions offers "max" alone. k3 takes over the provider's Recommended star from kimi-for-coding as the flagship; kimi-for-coding stays DefaultEnabled for the lower Andante tier that cannot call k3 (k3 needs Moderato or above). Output limit is unstated in the docs, so it carries the family's 32768 default pending live confirmation. Verified against the live endpoint with a real key: k3 answers image questions through the OpenAI-compatible path with the exact multipart format jcode sends, and reasoning_effort=max round-trips. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The provider add/edit form defaulted its vision/thinking switches to false and always submitted them, so saving any provider (even without touching the switches) wrote "vision": false into config. That override makes chatmodel collapse multimodal messages to text-only — the UI shows attached image thumbnails while the model receives none of them. Reproduced end to end against a logging mock endpoint: with the stored override the user turn arrives text-only; without it the same turn arrives as [text, image_url]. Fixes, verified in the browser against a live dev instance: - Remove the vision control from the provider form entirely. Image support is per-model metadata (registry modalities / custom-model attachment), not a provider connection setting. The update API uses replacement semantics, so simply not sending the field means one save of an affected provider clears the stale override from config. Hand-edited config values are still honored as an escape hatch. - Keep the thinking (enable_thinking kwarg) control for custom providers only, as a tri-state Default/On/Off that omits the field on Default instead of forcing an explicit false. Registry providers derive everything from models.dev metadata. - Rebuild the agents of live engines running on a provider after its config is updated (rebuildEnginesForProvider), so connection-level changes — api_key, base_url, headers, vision, thinking, effort — take effect on the next turn instead of after a restart or model switch. Mirrors the MCP-reload rebuild path. - Recompute the chat input's imageSupport whenever the selected model or the provider list changes. It was only set from /health at page load and from loadModels, so switching from a text-only model to a vision model in the picker left the attach button disabled (and the reverse allowed attaching to models that cannot see images) until a reload. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughThe change adds the ChangesProvider synchronization
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SettingsDialog
participant ProviderAPI
participant handleUpdateProvider
participant LiveEngine
participant Agent
SettingsDialog->>ProviderAPI: save provider settings
ProviderAPI->>handleUpdateProvider: update provider
handleUpdateProvider->>LiveEngine: rebuild matching engines
LiveEngine->>Agent: create replacement agent
Agent-->>LiveEngine: updated agent
Possibly related PRs
🚥 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 |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/src/app/store.ts (1)
474-506: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winClear stale image support when loaded metadata has no matching model.
After providers are loaded,
setProvidercan produce a missing provider/model pair and retain the previous model’s capability indefinitely. Preserve the/healthfallback only whileprovidersis empty; otherwise default unmatched selections tofalse.Proposed fix
function syncImageSupport(s: ModelState) { const cur = s.providers .find((p) => p.id === s.providerName) ?.models.find((m) => m.id === s.modelName) - if (cur) s.imageSupport = !!cur.image_support + if (cur) { + s.imageSupport = !!cur.image_support + } else if (s.providers.length > 0) { + s.imageSupport = false + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/app/store.ts` around lines 474 - 506, Update syncImageSupport in the model slice so unmatched provider/model selections set imageSupport to false once providers metadata is loaded; retain the existing /health fallback only when s.providers is empty. Ensure setProvider, setModel, and setProviders continue using this helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/web/providers.go`:
- Line 660: Update Server.rebuildEnginesForProvider to accept context.Context as
its first parameter, then propagate that context through the agent-creation
calls within the rebuild flow. Update every caller to pass its active context so
cancellation and shutdown can interrupt the synchronous rebuild operation.
- Around line 683-692: Update the agent refresh flow around eng.modelSnapshot,
eng.createAgent, and eng.setAgent to recheck the captured provider and model
while holding emu after rebuilding. Install the new agent only when the
provider/model snapshot still matches; otherwise skip the stale refresh.
In `@web/src/components/SettingsDialog.tsx`:
- Around line 1222-1224: Update the tri-state option labels in SettingsDialog to
use the existing react-i18next translation function t(...) instead of hardcoded
“Default”, “On”, and “Off” text. Add or reuse appropriate translation keys while
preserving the option values and surrounding provider-settings behavior.
---
Outside diff comments:
In `@web/src/app/store.ts`:
- Around line 474-506: Update syncImageSupport in the model slice so unmatched
provider/model selections set imageSupport to false once providers metadata is
loaded; retain the existing /health fallback only when s.providers is empty.
Ensure setProvider, setModel, and setProviders continue using this helper.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e14f7763-df03-4a00-96b7-60f9e541aa6c
📒 Files selected for processing (5)
internal/model/registry.gointernal/web/providers.goweb/src/app/store.tsweb/src/components/SettingsDialog.tsxweb/src/lib/api.ts
…llback - Guard the provider-update agent rebuild against a concurrent model switch: setAgentIfModel installs the rebuilt agent only if the engine is still on the same provider/model, checked under emu, so a switch landing mid-rebuild is never clobbered with a stale agent. - Localize the custom-provider thinking select (Default/On/Off) via new common.default/on/off keys in all five locales. - syncImageSupport: once the provider list is loaded, an unmatched provider/model pair resets imageSupport to false instead of carrying the previous model's capability forward; the /health seed only survives while providers are still empty. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
What
1. Add Kimi K3 to the Kimi For Coding provider (
internal/model/registry.go)k3: 1,048,576-token context, image input, tool calls, reasoning on by default — per the official third-party-agents doc.max: the docs state K3 accepts onlymaxtoday (low/high are "planned"), soReasoningOptionsdeclares exactly that instead of the standard four levels.kimi-for-coding; the latter stays default-enabled for the Andante tier that cannot call k3 (Moderato+ required).2. Fix the provider settings form silently blinding vision models (
web/,internal/web/providers.go)Root cause of "model says it sees no image while the UI shows thumbnails": the provider add/edit form defaulted its vision/thinking switches to false and always submitted them, so saving a provider — even without touching the switches — wrote
"vision": falseinto config, which makestoOpenAIMessagestrip every image part.enable_thinkingkwarg) control survives only for custom providers, as tri-state Default/On/Off where Default omits the field.rebuildEnginesForProvider, mirroring the MCP-reload path) — previously connection changes needed a restart or model switch to take effect.imageSupportis recomputed on every model/provider-list change; it used to be set only at page load, so switching text-only ↔ vision models left the attach button in the wrong state until a reload.Verification
reasoning_effort=maxround-trips.vision:falsethe user turn arrives text-only (bug reproduced); after clearing via the new UI — no restart — the same turn arrives as[text, image_url]and nochat_template_kwargsis sent.vision/thinkingkeys from config.go test ./internal/model ./internal/webgreen;pnpm typecheckclean.Reviewer notes
registry_generated.gois intentionally untouched (concurrent regeneration in flight on main); the statickimi-for-codingprovider does not exist in models.dev output, so there is no id collision.visionfor backward compatibility; only the frontend stopped sending it.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
k3Kimi for Coding model.Improvements