Skip to content

fix: NVIDIA NIM thinking models (kimi-k2.5, deepseek-r1) crash with 400 when tools are present#3

Merged
codomium merged 3 commits intomainfrom
copilot/fix-vscode-extension-installation-issue
Apr 17, 2026
Merged

fix: NVIDIA NIM thinking models (kimi-k2.5, deepseek-r1) crash with 400 when tools are present#3
codomium merged 3 commits intomainfrom
copilot/fix-vscode-extension-installation-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 17, 2026

NVIDIA NIM returns HTTP 400 when chat_template_kwargs: {thinking: true} and tools are both present in the same request. The agent was unconditionally sending all registered tools to every NVIDIA model, breaking kimi-k2.5 and deepseek-r1 entirely.

Changes

  • NVIDIA_THINKING_MODELS constant — module-level Set of models that use thinking: true; replaces duplicate inline definitions
  • Tool suppression for thinking modelstools array is omitted from the request body when the model is in NVIDIA_THINKING_MODELS
  • Clean system prompt for thinking calls — stores systemPromptStatic (tool-description-free prefix) in agent state; thinking-model calls use this instead of the full prompt, so the model isn't told about tools it can't call
  • Missing systemPromptStatic warning — logs to stderr if the static prefix is absent at call time, surfacing initialization issues early
// Before — tools always sent, causes 400 on thinking models
...(toolDefs.length > 0 && { tools: [...] })

// After — mutually exclusive based on thinking capability
const supportsThinking = NVIDIA_THINKING_MODELS.has(model);
...(supportsThinking  && { chat_template_kwargs: { thinking: true } }),
...(!supportsThinking && toolDefs.length > 0 && { tools: [...] }),

Copilot AI and others added 3 commits April 17, 2026 19:14
…ing + model switch + sse errors)

Agent-Logs-Url: https://github.com/codomium/CODE/sessions/9cfacfc2-d2db-44d8-aa57-1e9211270c08

Co-authored-by: codomium <255525663+codomium@users.noreply.github.com>
…G_MODELS constant

Agent-Logs-Url: https://github.com/codomium/CODE/sessions/9a9ed1dc-8da0-4e2a-b460-3bee96c95209

Co-authored-by: codomium <255525663+codomium@users.noreply.github.com>
@codomium codomium marked this pull request as ready for review April 17, 2026 19:50
@codomium codomium merged commit ec1345c into main Apr 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants