Conversation
AvailableModels RPC can exceed the default 5s bridge timeout, causing a silent fallback to GetUsableModels with flattened 200k context windows. Increase discovery timeouts, normalize reasoning_effort/supportsImages/ supportsThinking, infer context from variant params and tooltip data, and emit accurate image/reasoning flags in provider descriptors.
Read context window from variant-level tooltipData (e.g. Gemini 1M), take the max context across grouped variants, and set attachment: true on config model descriptors so OpenCode does not strip image inputs.
|
Hi maintainers — thanks for maintaining this plugin! This PR bundles three fixes found during real-world use with Cursor OAuth on a slower network. All changes are covered by the smoke test suite and verified locally against live Cursor API responses. What was broken:
Note on CI: The repo only has a manual Release workflow — no PR checks run automatically. I ran Happy to split into separate PRs or adjust anything. Let me know if you'd like a live repro script or logs. |
|
+1 — hit exactly this on Independently traced the same root cause before finding this PR: the live Verified the fix direction locally: bumping the RPC default from 5s → 30s makes a fresh Looking forward to this being merged — the tooltip-based context inference for models whose variants don't carry a |
Summary
Fixes three related metadata/runtime issues discovered while using Cursor models in OpenCode on slower networks.
1. Model discovery metadata (AvailableModels path)
GetUsableModelsreasoning_effort,supportsImages, andsupportsThinkingfrom Cursor API responsescontextTokenLimitForMaxMode, and tooltip markdown (including variant-level tooltip, e.g. Gemini 1M)Math.maxcontext across grouped variantsattachment: trueon config model descriptors so OpenCode does not strip image inputs before they reach the proxy2. Session title generation (NameAgent path)
"Generate a brief title", etc.)Root cause
Models: On slow links, the default 5s RPC budget caused
AvailableModelsto time out and silently degrade toGetUsableModels, flattening capability metadata (notably context window to 200k). The normalizer also ignored Gemini-stylereasoning_effort, never mapped API image/thinking flags, missed variant-level tooltip context, and config descriptors lackedattachment: true— causing all models to appear text-only in the UI.Titles: OpenCode sends
agent=titlerequests through the plugin proxy. The plugin routes these to Cursor'sNameAgentRPC (not the user's chat model). The default 5s client timeout was shorter than typical end-to-end latency, so title generation silently no-op'd and sessions stayed atNew session - <timestamp>.Test plan
npm run buildnpm run test(smoke suite — regression cases forreasoning_effort,supportsImages, variant tooltip context,contextTokenLimitForMaxMode, configattachment, grouped variantMath.max)