[PR #11406] fix(console): handle nested tools and preserve strict in oa-compat #13777

Open
opened 2026-02-16 18:18:36 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11406

State: open
Merged: No


Fixes #11171

What does this PR do?

  • Ensures toOaCompatibleRequest supports tools arriving in either:
    • flat format: { name, description, parameters, strict? }
    • nested OpenAI format: { type: "function", function: { name, description, parameters, strict? } }
  • Preserves strict when building the OpenAI-compatible tool schema.

Why?

When tools arrive nested, the current mapping reads tool.name etc. as undefined, which results in empty tool definitions being sent to the model and breaks tool calling (observed with Qwen2.5).

How did you verify?

  • Confirmed the serialized request now includes correct tool fields (name/description/parameters) for nested tools.
  • Verified strict is included in the outgoing tool definition.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11406 **State:** open **Merged:** No --- Fixes #11171 ### What does this PR do? - Ensures `toOaCompatibleRequest` supports tools arriving in either: - flat format: `{ name, description, parameters, strict? }` - nested OpenAI format: `{ type: "function", function: { name, description, parameters, strict? } }` - Preserves `strict` when building the OpenAI-compatible tool schema. ### Why? When tools arrive nested, the current mapping reads `tool.name` etc. as `undefined`, which results in empty tool definitions being sent to the model and breaks tool calling (observed with Qwen2.5). ### How did you verify? - Confirmed the serialized request now includes correct tool fields (`name/description/parameters`) for nested tools. - Verified `strict` is included in the outgoing tool definition.
yindo added the pull-request label 2026-02-16 18:18:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13777