Skip to content

fix: harden system message tools and wire toolOverrides to system message path#10485

Open
shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
shanevcantwell:fix/system-message-tools-local-models
Open

fix: harden system message tools and wire toolOverrides to system message path#10485
shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
shanevcantwell:fix/system-message-tools-local-models

Conversation

@shanevcantwell
Copy link
Contributor

@shanevcantwell shanevcantwell commented Feb 13, 2026

Summary

  • Strengthened system message tool instructions for models on the non-native tools path (used by local models via capabilities: [] or experimental.onlyUseSystemMessageTools). The previous prose instructions were too vague — local models reverted to XML/JSON tool call formats from their training priors.
  • Fixed toolOverrides being silently ignored on the system message path. applyToolOverrides() already existed and ran on the native tools path (in BaseLLM.streamChat()), but was never called when tools were injected via system message text. Config YAML toolOverrides for disabled and description now take effect on both paths.

Changes

  1. core/tools/systemMessageTools/toolCodeblocks/index.ts — Replaced prose systemMessagePrefix/systemMessageSuffix with explicit numbered rules that prohibit XML tags, JSON format, and tool invention
  2. core/index.d.ts — Added toolOverrides to ModelDescription interface
  3. core/config/load.ts — Serialized toolOverrides in llmToSerializedModelDescription()
  4. gui/src/redux/thunks/streamNormalInput.ts — Imported applyToolOverrides and applied model-level overrides to activeTools before both the native and system message paths

Test plan

  • cd core && npm run vitest — 1654 passed, 0 failures
  • Built vsix, tested with local models (nemotron-3-nano-30b, gpt-oss-20b, mirothinker-v1.5-30b) via LM Studio
  • Verified view_diff with disabled: true is absent from system message
  • Verified hardened numbered rules appear in system message prefix/suffix
  • Verified local models follow codeblock format through multi-step tool call chains
  • Verify native tools path unaffected (cloud models)

🤖 Generated with Claude Code


Summary by cubic

Improves reliability of system-message tool calls for local models and applies model-level toolOverrides on that path. Local models now follow the codeblock format, and disabled/description overrides from config are respected.

  • Bug Fixes
    • Hardened system message with clear, numbered rules: use only tool code blocks; no XML/JSON; one tool per response; code block last; no invented tools.
    • Applied applyToolOverrides before both native and system-message paths and added toolOverrides to ModelDescription serialization, so per-model disabled/description overrides take effect.

Written for commit 1a59f1a. Summary will update on new commits.

…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>
@shanevcantwell shanevcantwell requested a review from a team as a code owner February 13, 2026 04:35
@shanevcantwell shanevcantwell requested review from Patrick-Erichsen and removed request for a team February 13, 2026 04:35
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 13, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant