fix: forward model variants to opencode prompt body#15
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR removes ChangesVariant Parameter Refactoring
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/tools/message.ts (1)
231-239:⚠️ Potential issue | 🟠 Major | ⚡ Quick win
opencode_shell_executedropsvariantfrom the request bodyLine 234 accepts
variant, but the body built around Line 236-Line 239 never forwards it. This causes shell requests to ignore the requested variant while other updated tools now send it correctly.Proposed fix
const body: Record<string, unknown> = { command, agent }; const shellModel = applyModelDefaults(providerID, modelID); if (shellModel) body.model = shellModel; + if (variant) body.variant = variant; const result = await client.post( `/session/${sessionId}/shell`, body, { directory }, );🤖 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 `@src/tools/message.ts` around lines 231 - 239, The opencode_shell_execute handler accepts variant but never forwards it in the request body; update the async handler (the anonymous function receiving { sessionId, command, agent, providerID, modelID, variant, directory }) to add variant to the constructed body when present (e.g., body.variant = variant or include within body.model if your API expects it), so that applyModelDefaults(providerID, modelID), the body object, and the subsequent client.post call carry the variant through to the backend; ensure the field name matches what the server expects and keep the conditional (only set variant when defined).
🤖 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.
Outside diff comments:
In `@src/tools/message.ts`:
- Around line 231-239: The opencode_shell_execute handler accepts variant but
never forwards it in the request body; update the async handler (the anonymous
function receiving { sessionId, command, agent, providerID, modelID, variant,
directory }) to add variant to the constructed body when present (e.g.,
body.variant = variant or include within body.model if your API expects it), so
that applyModelDefaults(providerID, modelID), the body object, and the
subsequent client.post call carry the variant through to the backend; ensure the
field name matches what the server expects and keep the conditional (only set
variant when defined).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f832f78f-a49c-4a4a-8890-6aae44902c7b
📒 Files selected for processing (4)
src/helpers.tssrc/tools/message.tssrc/tools/workflow.tstests/tools.test.ts
Summary
variantas a top-level prompt/command body field instead of nesting it undermodel.modelpayloads limited to{ providerID, modelID }so OpenCode can apply the requested variant/effort correctly.opencode_ask,opencode_reply, andopencode_message_send.Why
OpenCode's session prompt API accepts
variantnext tomodel, not insidemodel. Nesting it undermodelcauses model selection to work while the requested variant is ignored and the agent/default variant is used instead.Verification
npm run buildnpm testgit diff --checkSummary by CodeRabbit
Refactor
Tests