Skip to content

feat: enable agent mode support for LM Studio models#10327

Open
veeceey wants to merge 7 commits intocontinuedev:mainfrom
veeceey:fix/issue-5182-lmstudio-agent-mode
Open

feat: enable agent mode support for LM Studio models#10327
veeceey wants to merge 7 commits intocontinuedev:mainfrom
veeceey:fix/issue-5182-lmstudio-agent-mode

Conversation

@veeceey
Copy link

@veeceey veeceey commented Feb 7, 2026

Summary

Adds LM Studio to PROVIDER_TOOL_SUPPORT to enable Agent mode for LM Studio models.

Changes

  • Added lmstudio entry to PROVIDER_TOOL_SUPPORT that references Ollama's tool support implementation
  • Added comprehensive tests for LM Studio tool support in toolSupport.test.ts

Rationale

LM Studio uses an OpenAI-compatible API similar to Ollama and serves similar models with tool calling support. By referencing Ollama's implementation, LM Studio models can now use Agent mode with the same model compatibility logic.

Test Plan

Added unit tests that verify:

  • Supported models (llama3.1, llama3.2, qwen2, mixtral, mistral) return true
  • Explicitly unsupported models (vision, math, guard) return false
  • Case insensitivity works correctly
  • Empty model names return false

The implementation follows the same pattern as other providers in the codebase and reuses the battle-tested Ollama logic.

Closes #5182


Continue Tasks: ▶️ 2 queued — View all


Summary by cubic

Enables Agent mode for LM Studio models by delegating tool support to Ollama, with safe handling for hyphenated model IDs. Exclusion checks now block mistral-openorca and mistral-lite in both hyphenated and non-hyphenated forms. Addresses #5182.

  • New Features
    • Added lmstudio to PROVIDER_TOOL_SUPPORT. Exclusions are checked via a helper against both raw and hyphen-stripped names, then we delegate to Ollama with the raw name and fall back to the normalized ID.
    • Added tests for hyphenated IDs (Meta-Llama-3.1-8B-Instruct-GGUF, Qwen2-7B-Instruct, Mixtral-8x7B-Instruct-v0.1), unsupported hyphenated names (Llama-Vision-Free, Math-Solver-7B, Guard-Model), mistral-openorca/mistral-lite variants, case insensitivity, and empty model names.

Written for commit cfff26f. Summary will update on new commits.

Add LM Studio to PROVIDER_TOOL_SUPPORT by referencing Ollama's
tool support implementation. LM Studio uses an OpenAI-compatible
API similar to Ollama, so the same model compatibility logic applies.

Fixes continuedev#5182
@veeceey veeceey requested a review from a team as a code owner February 7, 2026 23:17
@veeceey veeceey requested review from sestinj and removed request for a team February 7, 2026 23:17
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 7, 2026
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

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.

1 issue found across 2 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="core/llm/toolSupport.ts">

<violation number="1" location="core/llm/toolSupport.ts:192">
P2: LM Studio uses hyphenated model identifiers (e.g., “Meta-Llama-3.1-8B-Instruct-GGUF”), but lmstudio delegates to Ollama’s heuristic which only checks substrings like “llama3.1” without hyphens. This will fail to detect tool support for common LM Studio model IDs (e.g., “llama-3.1-8b-instruct”), disabling agent mode even when tool calling is supported.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@veeceey
Copy link
Author

veeceey commented Feb 8, 2026

I have read the CLA Document and I hereby sign the CLA

LM Studio uses hyphenated model identifiers (e.g., "Meta-Llama-3.1-8B-Instruct-GGUF"),
but the Ollama heuristic checks for non-hyphenated patterns like "llama3.1".

This fix normalizes hyphenated model names by removing hyphens before delegating to
Ollama's tool support logic, enabling agent mode for LM Studio models with hyphenated IDs.

Added comprehensive tests for hyphenated model names including:
- Meta-Llama-3.1-8B-Instruct-GGUF
- Qwen2-7B-Instruct
- Mixtral-8x7B-Instruct-v0.1
- Case insensitivity checks
- Negative tests for unsupported models like "Llama-Vision-Free"

Addresses feedback from Cubic AI bot review.
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 8, 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.

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="core/llm/toolSupport.ts">

<violation number="1" location="core/llm/toolSupport.ts:195">
P2: LM Studio’s hyphen-stripping normalization bypasses Ollama’s explicit exclusion for "mistral-openorca" (and other hyphen-sensitive exclusions), potentially marking unsupported models as tool-capable.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Improve the LM Studio tool support check to first verify exclusions on the
original model ID before normalizing hyphens. This ensures that models like
'Mistral-Openorca-GGUF' are correctly excluded from tool support, while
allowing hyphenated variants of supported models like 'Meta-Llama-3.1-8B-Instruct-GGUF'.

The previous implementation would remove all hyphens before checking Ollama's
heuristics, which could bypass exclusion rules for models like mistral-openorca.
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.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="core/llm/toolSupport.ts">

<violation number="1" location="core/llm/toolSupport.ts:196">
P2: LM Studio hyphenated model IDs are rejected before normalization due to the new early return on the raw Ollama check, contradicting existing tests expecting these IDs to be supported.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

The LM Studio handler was checking Ollama's full heuristic (which
doesn't match hyphenated names) before trying the normalized version.
This caused hyphenated LM Studio model IDs like
"Meta-Llama-3.1-8B-Instruct-GGUF" to be incorrectly rejected.

Now checks exclusions separately first, then falls back to the
normalized (hyphen-removed) name for Ollama's support check.
Check exclusions on both raw and normalized (hyphen-stripped) model
names before delegating to Ollama's heuristic. This ensures:

1. Hyphenated exclusions like "mistral-openorca" are caught on the raw name
2. Non-hyphenated variants like "MistralOpenOrca" are caught on the
   normalized name before the "mistral" support pattern matches
3. Hyphenated LM Studio IDs like "Meta-Llama-3.1-8B" still get detected
   via the normalized fallback to Ollama
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.

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="core/llm/toolSupport.ts">

<violation number="1" location="core/llm/toolSupport.ts:206">
P2: LM Studio exclusion check no longer tests normalized model IDs, so hyphenated models like `mistral-lite` bypass the `mistrallite` exclusion and get marked tool-capable via the Ollama heuristic.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

…tudio

The exclusion check only tested the lowercased model name, missing cases
where hyphenated names like "Mistral-Lite" normalize to "mistrallite"
which should match the exclusion pattern.
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 8, 2026
…M Studio

Extract isExcluded helper that tests a given name against each exclusion
pattern in both its original and hyphen-stripped forms.  Call it with
both the raw lowercased model name and the normalized (hyphen-stripped)
form so that e.g. "mistral-lite" is correctly caught by the
"mistrallite" exclusion regardless of which path is evaluated.
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Feb 8, 2026
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.

Agent doesn't support LM Studio

1 participant