Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/services/api/openaiShim/requestPlanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,24 @@ export function createRequestBodyPlanner(context: RequestBodyPlannerContext) {
options.temperature = params.temperature
if (params.top_p !== undefined) options.top_p = params.top_p

// Ollama's hybrid-thinking models (e.g. Qwen3.x) default to thinking
// ENABLED when the `think` field is simply absent from the request —
// this was previously never set here, so every Ollama request silently
// ran in thinking mode regardless of --effort, burning a full reasoning
// trace even for trivial prompts with no way to disable it. Mirrors the
// effort handling already done above for the Anthropic/Gemini paths.
const think: boolean | string = request.reasoning?.effort
? ['xhigh', 'max', 'ultracode'].includes(request.reasoning.effort)
? 'high'
: request.reasoning.effort
: false

return {
model: request.resolvedModel,
messages: normalizeOllamaNativeMessages(body.messages),
stream: params.stream ?? false,
options,
think,
Comment on lines +433 to +444

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Update the native Ollama test contract before merge.

The exact-body assertion in src/services/api/openaiShim/requestPlanner.test.ts, Lines 307-341, omits think. The no-effort case now returns think: false, so that assertion will fail. Update it and add focused cases for preserved effort values and xhigh, max, and ultracode mapping to 'high'.

As per path instructions, AGENTS.md requires focused tests covering absent effort (false), preserved effort values, and xhigh/max/ultracode mapping to high.

🤖 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/services/api/openaiShim/requestPlanner.ts` around lines 433 - 444, Update
the native Ollama assertions in the request planner tests to include think:
false for absent reasoning effort, then add focused cases covering preserved
effort values and mapping xhigh, max, and ultracode to high. Anchor the cases to
the request-planning test flow exercising the think value derived from
request.reasoning.effort.

Source: Path instructions

...(body.tools ? { tools: body.tools } : {}),
}
}
Expand Down