Skip to content

feat(model): make DashScope thinking_enable tri-state - #3192

Merged
qbc2016 merged 2 commits into
agentscope-ai:mainfrom
konlue:fix/dashscope-thinking-enable-tristate
Oct 29, 2026
Merged

qbc2016 merged 2 commits into
agentscope-ai:mainfrom
konlue:fix/dashscope-thinking-enable-tristate

Conversation

@konlue

@konlue konlue commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

AgentScope Version

2.0.10dev (main @ 72f3f6f)

Description

DashScopeChatModel.Parameters.thinking_enable is declared as a non-optional bool with default=False (src/agentscope/model/_dashscope/_model.py:53), while the injection guard in _call_api is is not None (:258) — which is always true for a plain bool. As a result, every request carries extra_body["enable_thinking"] = False even when the caller never configured anything, silently disabling thinking mode on Qwen3+ hybrid-reasoning models whose server-side default is thinking enabled.

Changes — the field becomes tri-state, matching the volcengine model in this repo (model/_volcengine/_model.py:40 already declares thinking_enable: bool \| None = Field(default=None, ...) with the identical is not None guard, which needs no change):

caller configuration before after
unset (None) force-injects enable_thinking=False not sent — server default applies, same as calling DashScope directly
explicit False sends enable_thinking=False unchanged (explicit disable still works)
explicit True sends enable_thinking=True unchanged

On prior art: #2346 previously tried a similar direction but chose "only send when enabled", which — as @qbc2016 pointed out — removes the ability to explicitly disable thinking on models where the server default is thinking enabled. Tri-state keeps every explicit configuration working and only stops misinterpreting "caller said nothing" as "disable". Callers who relied on the old implicit default (nothing configured → thinking disabled) must now pass thinking_enable=False explicitly; this restores parity with a bare DashScope API call, the semantics the volcengine model already follows.

How to test

Regression tests in tests/model_dashscope_thinking_enable_test.py:

  • test_dashscope_thinking_enable_not_sent_when_unset — fails on main (AssertionError: enable_thinking was force-injected ... : {'enable_thinking': False}), passes with this fix;
  • test_dashscope_thinking_enable_explicit_false_is_sent — pins the explicit-disable behavior so the fix cannot regress it.
python -m pytest tests/model_dashscope_thinking_enable_test.py tests/model_dashscope_test.py
# 2 + 16 passed.

Fixes #3191

Checklist

  • An issue has been created for this PR
  • I have read the CONTRIBUTING.md
  • Docstrings are in Google style
  • Related documentation has been updated (e.g. links, examples, etc.) in documentation repository
  • Code is ready for review

…er force-disables thinking

Parameters.thinking_enable was a non-optional bool defaulting to False, so
the is not None guard in _call_api was always true and every request
carried extra_body[enable_thinking]=False even when the caller never
configured it — silently disabling thinking on Qwen3+ hybrid-reasoning
models. Declare the field bool | None = None, matching the volcengine
model, so unset omits the flag while explicit True/False still take effect.

Fixes agentscope-ai#3191
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the pull request. One thing worth sorting out before it is reviewed:

If you think it belongs here anyway, say so and a maintainer will take a look.

@konlue

konlue commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the pull request. One thing worth sorting out before it is reviewed:

If you think it belongs here anyway, say so and a maintainer will take a look.

@qbc2016 PTAL.

Context for the guard above: I filed #3191 (Oct 9) and opened this PR the same day — five days before the claim.

The claimant @Winoren withdrew on Oct 14, noting this PR "already provides this exact tri-state fix with regression tests" (see their comment on the issue).

The assignment also looks like a claim-bot mix-up (the grant was addressed to a different username), and it auto-releases on 2026-10-28 anyway.

Given the issue carries triage/confirmed and this is a 1-line type fix plus regression tests, could you (or another maintainer) take a look whenever convenient? Happy to adjust anything.

@qbc2016 qbc2016 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions Bot removed the pr/awaiting-review Waiting for maintainers to review this PR label Oct 29, 2026
@qbc2016 qbc2016 changed the title fix(model): make DashScope thinking_enable tri-state so unset no longer force-disables thinking feat(model): make DashScope thinking_enable tri-state Oct 29, 2026
@qbc2016
qbc2016 merged commit 867ad83 into agentscope-ai:main Oct 29, 2026
14 of 15 checks 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.

[Bug]: DashScopeChatModel force-injects enable_thinking=False into every request even when the caller never configured it

2 participants