Skip to content

fix(llm): preserve explicit Anthropic thinking disablement - #16608

Merged
rmccorm4 merged 3 commits into
ai-dynamo:mainfrom
reedyalouh2:fix/16600-anthropic-thinking-disabled
Oct 16, 2026
Merged

rmccorm4 merged 3 commits into
ai-dynamo:mainfrom
reedyalouh2:fix/16600-anthropic-thinking-disabled

Conversation

@reedyalouh2

@reedyalouh2 reedyalouh2 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An explicit thinking: {"type":"disabled"} on /v1/messages loses its false value during Anthropic-to-chat conversion. The handler then skips auto-enabling thinking, but a model such as Qwen3 still uses its thinking-enabled template default. This change carries enable_thinking: false through the existing mapping.

Details

Dynamo owns this translation; the selected model template consumes the control. Enabled, omitted, null, adaptive and unknown values keep their existing conversion behavior. History, tools, thinking budgets and response formatting are unchanged.

Six converter tests cover explicit controls, defaults and preserving the other request fields. An HTTP regression sends omitted, enabled and disabled controls through streaming and non-streaming /v1/messages and checks the canonical requests delivered to the scripted chat engine.

The October 7 Qwen3-8B experiment used an earlier frontend with this converter change: all 24 stock disabled requests generated reasoning; patched requests generated none. Those GPU results are separate from the current-source tests below. Disabling thinking can change answer quality.

Where should the reviewer start?

lib/llm/src/protocols/anthropic/types.rs, then lib/llm/tests/anthropic_http_replay.rs. The HTTP regression checks request delivery; it does not run a model template.

Validation

Base: c2c3338874cd170d80e5d5e9922c5f8f753e0fce, macOS arm64, Rust 1.96.1, --no-default-features.

  • Stock plus the regressions: the two disabled-conversion checks fail; the HTTP check fails for disabled in both streaming and non-streaming requests.
  • With the fix: all 114 Anthropic protocol tests and all 14 HTTP replay tests pass.
  • cargo fmt --all --check and git diff --check pass.
cargo test --locked --offline -p dynamo-llm --no-default-features --lib protocols::anthropic:: -- --nocapture
cargo test --locked --offline -p dynamo-llm --no-default-features --test anthropic_http_replay -- --nocapture

Related Issues

Closes #16600.

#8782 previously addressed this toggle in a broader, unmerged change. #8485 covers response representation.

Summary by CodeRabbit

  • New Features
    • Anthropic Messages requests now honor explicit thinking settings: enabled turns thinking on, and disabled turns it off.
    • When the setting is omitted, null, or unrecognized, no explicit thinking override is applied. The behavior is consistent for streaming and non-streaming requests.

Signed-off-by: Reed Yalouh <yalouh@berkeley.com>
@reedyalouh2
reedyalouh2 requested review from a team as code owners October 16, 2026 00:22
@copy-pr-bot

copy-pr-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@reedyalouh2
reedyalouh2 temporarily deployed to external_collaborator October 16, 2026 00:22 — with GitHub Actions Inactive
@reedyalouh2
reedyalouh2 temporarily deployed to external_collaborator October 16, 2026 00:22 — with GitHub Actions Inactive
@github-actions github-actions Bot added the fix label Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi reedyalouh2! Thank you for contributing to ai-dynamo/dynamo.

Just a reminder: The NVIDIA Test Github Validation CI runs an essential subset of the testing framework to quickly catch errors.Your PR reviewers may elect to test the changes comprehensively before approving your changes.

🚀

@github-actions github-actions Bot added external-contribution Pull request is from an external contributor frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` labels Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ai-dynamo/dynamo/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 288656d1-81c6-4317-ad01-54e257866351
📥 Commits

Reviewing files that changed from the base of the PR and between cdec3bd and f9be3c3.

📒 Files selected for processing: 2
  • lib/llm/src/protocols/anthropic/types.rs
  • lib/llm/tests/anthropic_http_replay.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

The Anthropic request converter now maps thinking.type values enabled and disabled to enable_thinking values true and false. New unit and HTTP replay tests cover these values and omitted or other configurations.

Changes

Anthropic thinking controls

Layer / File(s) Summary
Convert thinking configuration
lib/llm/src/protocols/anthropic/types.rs
The converter sets enable_thinking for enabled and disabled. Unit tests cover absent, null, and other values, and verify that disabling thinking does not change other converted request fields.
Verify HTTP request delivery
lib/llm/tests/anthropic_http_replay.rs
A replay test checks omitted, enabled, and disabled thinking values in streaming and non-streaming requests. It also verifies that all six request scripts are consumed.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to f9be3

No actionable merge-blocking issue is identified; the change is ready for normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: preserving explicit Anthropic thinking disablement.
Description check Passed The description explains the issue, implementation, scope, reviewer entry points, validation, and related issue. It uses “Summary” instead of the template’s “Overview” heading, but the required inform…
Linked Issues check Passed The PR satisfies the coding requirements in directly linked issue #16600. lib/llm/src/protocols/anthropic/types.rs preserves enable_thinking: false for thinking.type == "disabled" and retains th…
Out of Scope Changes check Passed The reported changes are limited to the Anthropic converter and its converter and HTTP regression tests. The tests directly verify issue #16600 behavior and preservation of unrelated request fields. N…
Docstring Coverage Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Comment thread lib/llm/tests/anthropic_http_replay.rs Resolved
Signed-off-by: Reed Yalouh <yalouh@berkeley.com>
@reedyalouh2
reedyalouh2 temporarily deployed to external_collaborator October 16, 2026 01:22 — with GitHub Actions Inactive
@rmccorm4
rmccorm4 temporarily deployed to external_collaborator October 16, 2026 06:21 — with GitHub Actions Inactive
@rmccorm4

Copy link
Copy Markdown
Contributor

/ok to test 62406c0

@rmccorm4
rmccorm4 enabled auto-merge (squash) October 16, 2026 06:21
@rmccorm4

Copy link
Copy Markdown
Contributor

Thanks for the contribution @reedyalouh2 !

@rmccorm4
rmccorm4 merged commit f95c85b into ai-dynamo:main Oct 16, 2026
116 checks passed

This branch was previously deployed

1 inactive deployment
external_collaborator — 62406c03 Deployed Oct 16, 2026 by rmccorm4 via ok-to-test #34025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contribution Pull request is from an external contributor fix frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Anthropic thinking disabled is lost before prompt rendering

2 participants