fix: remove inline backtick fences from tool instruction prose (#11674)
The system prompt prefix and suffix contained raw triple-backtick
sequences in prose text, producing an odd number of fence markers.
This made it ambiguous for models to distinguish actual tool-call
code fences from inline mentions of the syntax. Remove inline fence
syntax from prose, relying on the adjacent examples to convey the
format.
* fix(openai-adapters): map reasoning-delta to reasoning_content
* Fix system-message tool parser for non-terminal tool calls
* Fix duplicate predefined tools in dynamic system-message section
* fix(openai-adapters): fix TS syntax error in vercelStreamConverter test
The `as typeof X & Y` type assertion was ambiguous to the TypeScript
parser without parentheses, causing TS1005 errors across all CI checks.
Simplify to `as any` since this is a test assertion.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: remove unrelated vercelStreamConverter changes
Per reviewer feedback — keeping this PR focused on the
system-message tools parser fix.
* fix: correct test expectations for post-tool-call content preservation
The 'preserves content after a tool call' test incorrectly consumed the
trailing newline and preserved text within the tool-call loop. Adjusted
the loop count from 6 to 4 (actual tool-call deltas) and added explicit
assertions for the trailing newline and preserved content chunks.
The 'mid-message' test was missing an assertion for the newline chunk
emitted between the closing codeblock fence and trailing text.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: MumuTW <mumu@novel98.com>
fix: harden system message tools instructions and wire toolOverrides to system message path
The system message tools path (used when models don't support native tool
calling) had two issues:
1. Weak format instructions - the prefix/suffix used vague prose that local
models often ignored, reverting to XML or JSON tool call formats from
their training priors. Replaced with explicit numbered rules that
prohibit alternative formats.
2. toolOverrides silently ignored - applyToolOverrides() existed and ran on
the native tools path (in BaseLLM.streamChat), but was never called on
the system message path. Config YAML toolOverrides for disabled and
description had no effect when tools were injected via system message.
Fixed by:
- Strengthening systemMessagePrefix/Suffix in toolCodeblocks framework
- Adding toolOverrides to ModelDescription interface and serialization
- Calling applyToolOverrides() in streamNormalInput before both paths
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>