Skip to content

fix(research): preserve disabled reasoning during structured retries - #3134

Merged
ZQR1101 merged 1 commit into
HKUDS:devfrom
Golden007-prog:fix/3133-preserve-research-thinking
Dec 1, 2026
Merged

ZQR1101 merged 1 commit into
HKUDS:devfrom
Golden007-prog:fix/3133-preserve-research-thinking

Conversation

@Golden007-prog

Copy link
Copy Markdown

What changed

Keep the caller's explicit low or disabled reasoning setting when research decomposition or report-outline generation retries after a structured output failure. A retry still lowers high reasoning to low when the caller has not already set a lower level.

Refs #3133.

Verification

  • Six regression cases failed on the original revision and passed with the fix. They cover both outline paths and verify the DashScope request parameters using a synthetic provider. Two GPT-5 controls confirm the high-to-low retry.
  • 202 focused tests and all 15 repository pre-commit hooks passed.
  • Ruff, the repository architecture checks, and the import contracts passed.

@github-actions github-actions Bot added backend Python runtime, capabilities, tools, API & CLI bug Something isn't working labels Nov 30, 2026
@ZQR1101 ZQR1101 self-assigned this Dec 1, 2026

@ZQR1101 ZQR1101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at 2a174da against current dev (76dc7e2).

The rule is right: a structured retry may lower thinking, but it must not switch it back on. The easy thing to break here is the unset case, and you did not break it — normalize_reasoning_effort(None) returns None, which is not in THINKING_OFF_EFFORTS, so a turn that never chose a level still falls through to RETRY_REASONING_EFFORT and the retry keeps lowering from the provider default. Only an explicit none/minimal/minimum is preserved.

Evidence:

  • The new test on dev: 6 of the 8 parametrizations fail (the three DashScope off levels across both outline paths) and the 2 GPT-5 controls pass; merged, all 8 pass. With tests/services/llm/test_reasoning_params.py: 59 passed.
  • tests/agents/research, tests/services/llm, tests/agents/question: byte-identical FAILED list before and after this PR (32 pre-existing failures on this host), passed 1162 -> 1170, exactly the 8 new cases.
  • Both outline paths do go through _completion_kwargs, so #3133's research symptom is fully covered, and Refs rather than Closes is correct.
  • CI on this HEAD: all checks success, browser acceptance skipped.

Non-blocking, but worth a follow-up issue: deeptutor/agents/question/pipeline.py has the same reasoning_effort or self.reasoning_effort helper (still carrying the comment this PR replaces here) with the same retry sites, so a thinking-off question turn still gets thinking re-enabled on retry. deeptutor/services/llm/structured_retry.py describes itself as the project's single rule for this, so pushing the guard into build_completion_kwargs, or one shared helper, would fix all three pipelines at once and let the duplicate frozenset in provider_core/anthropic_provider.py collapse into THINKING_OFF_EFFORTS.

Merging.

@ZQR1101
ZQR1101 merged commit 9e5a4e6 into HKUDS:dev Dec 1, 2026
24 checks passed
@Golden007-prog

Copy link
Copy Markdown
Author

Thanks for reviewing this and verifying both outline paths against dev. I am reproducing the question-pipeline case separately.

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

Labels

backend Python runtime, capabilities, tools, API & CLI bug Something isn't working

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants