Conversation
Normalize reasoning from provider-specific fields (reasoning_content, reasoning) into <think> tags in content, and strip them on outbound requests to providers that use separate reasoning fields. - New verifiers/utils/reasoning_utils.py with pure utility functions - Inbound: extract reasoning from responses, prepend as <think> tags - Outbound: strip <think> tags from assistant messages for providers that use reasoning_content/reasoning fields - Auto-detect reasoning format from first response - Accept reasoning-only responses in validation (no EmptyModelResponseError) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| f"Model returned {len(response.choices)} choices, expected 1" | ||
| ) | ||
| if isinstance(response.choices[0], Choice): | ||
| if not ( |
There was a problem hiding this comment.
Think tags not stripped for interleaved rollout path
Medium Severity
prepare_messages_for_provider is called in get_model_response_with_messages to strip <think> tags from assistant messages before sending to providers that use separate reasoning fields, but get_model_response_with_tokens (used when interleaved_rollouts=True and trajectory is non-empty) sends prompt directly as messages without any such stripping. In multi-turn interleaved rollouts with providers using reasoning_content/reasoning, assistant messages will still contain <think> tags the provider doesn't expect.
Additional Locations (1)
|
should be supported first-class with #897 |


Description
Quick fix for missing reasoning content in GLM 4.7-Flash.
Normalize reasoning from provider-specific fields (reasoning_content, reasoning) into tags in content, and strip them on outbound requests to providers that use separate reasoning fields.
Type of Change
Testing
uv run pytestlocally.Checklist
Note
Medium Risk
Touches core request/response handling and validation for model calls; behavior changes depend on provider response shape and could affect prompts or error handling if detection/stripping misfires.
Overview
Normalizes provider-specific reasoning fields into a consistent
<think>...</think>prefix on inbound chat responses, so models that returnreasoning_content/reasoningno longer drop reasoning.Adds
reasoning_formathandling toEnvironment: strips<think>blocks from outbound assistant messages for providers that expect separate reasoning fields, auto-detects the format from the first response, and relaxes response validation to accept reasoning-only replies. Includes a newreasoning_utilsmodule and comprehensive unit/integration tests covering extraction, normalization, stripping, and provider message prep.Written by Cursor Bugbot for commit fcf95fa. This will update automatically on new commits. Configure here.