feat(llm): route reasoning models to reasoning-aware provider clients #106
No reviewers
Labels
No labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
#101 Route reasoning models to reasoning-aware provider clients so reasoning_content round-trips
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core!106
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/m2-reasoning-model-provider-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Routes reasoning / "thinking" models behind an OpenAI-compatible endpoint to a reasoning-aware provider client so
reasoning_contentround-trips correctly across a multi-turn tool-call loop, instead of being silently dropped by the barelangchain_openai.ChatOpenAI(base_url=...)client every non-native provider used previously.reasoning: boolfield to thetype: llmagent configuration (defaultfalse; native providers and the non-reasoning default path are byte-identical to before).cleveractors.agents.llm_reasoning.ReasoningChatModel, a thinlangchain_deepseek.ChatDeepSeeksubclass that re-injectsreasoning_contenton the request leg (the gap stockChatDeepSeekleaves open).build_chat_model/_build_from_credentialsselect the reasoning-aware client whenreasoning: trueon a non-native provider; validated fail-fast as a boolean before any client construction.LLMAgent._execute_tool_looprequired no change — it already appends the returnedAIMessageby reference, soadditional_kwargs["reasoning_content"]survives replay.docs/adr/ADR-2036-reasoning-aware-provider-routing.md(extends ADR-2028) records the full design and alternatives considered;docs/index.md§4.4/§4.4.1 documents the new field (spec version 1.1.0 → 1.2.0).langchain-deepseek>=1.1.0.Tests
features/reasoning_provider_routing.feature(client selection, config validation, request-leg round-trip, non-regression, and tool-loop replay via a fake reasoning model infeatures/mocks/reasoning_model.py) — 9 scenarios, all passing.robot/reasoning_provider_routing.robot+robot/ReasoningRoutingTestLib.py— drives the realExecutor -> LLMAgent -> ToolAgentpipeline with a realReasoningChatModel, stubbing only the OpenAI network boundary. Passing.nox(lint, format --check, typecheck, security_scan, dead_code, unit_tests, coverage_report, integration_tests, complexity, docs, build) all green.nox -s coverage_reportreports 96.6% (project's configured gate is 96.5% — pre-existing threshold, unrelated to this change; bothllm_reasoning.py(100%) and the modifiedllm_client.pylines (99%) are well covered).Closes #101
PR Review: !106 (Ticket #101)
Verdict: Approve
Reasoning-aware provider routing is implemented correctly. The design (ADR-2036) is sound, the acceptance criteria from #101 are covered by tests, and the production code is clean and type-safe. A couple of minor items need attention before merge.
Critical Issues
None
Major Issues
None
Minor Issues
Ruff format check fails.
features/steps/reasoning_provider_routing_steps.pyis not formatted according to the project's ruff rules, causing the requiredlintCI job to fail (andcoverageto be skipped as a result). Runnox -s formatorruff format features/steps/reasoning_provider_routing_steps.pyand commit the result.features/steps/reasoning_provider_routing_steps.pyIntegration test stubs the network boundary.
robot/ReasoningRoutingTestLib.pyreplacesmodel.async_clientwith aSimpleNamespacestub. This conflicts withCONTRIBUTING.md's rule that integration tests must exercise real services and that mocking of any kind is strictly prohibited in integration tests. Consider covering this scenario at the Behave/unit level (where mocks belong) or document an explicit exception for provider HTTP boundaries.robot/ReasoningRoutingTestLib.pyNits
benchmarkjob failure is informational (continue-on-error: truein.gitea/workflows/ci.yml) and the regressions it reports are in unrelated benchmarks (registry, cache, canonicalizer, token-budget), almost certainly noise from the--quickASV run. Not a PR blocker.Summary
The PR correctly routes reasoning models to a
ReasoningChatModelsubclass that re-emitsreasoning_contenton the request leg, fixing the non-retryable400 … reasoning_content … must be passed backerror in multi-turn tool loops. The ADR, spec update indocs/index.md, Behave scenarios, and Robot integration test are all present and well-structured. The implementation is minimal, preserves existing behavior for native and non-reasoning providers, and follows the project's lazy-import pattern. Fix the formatting issue and the PR is ready for merge.4ba6180d458364d844fc8364d844fca39344b9caa39344b9ca92dcbdde1e92dcbdde1e01ab2c8e9b