feat(provider): interleaved reasoning replay#294
Merged
Conversation
Support provider-specific reasoning field replay (interleaved/thinking) in Anthropic and OpenAI SDK paths, with catalog metadata and runner integration for multi-turn reasoning preservation. Co-authored-by: Cursor <cursoragent@cursor.com>
Validate YAML mapping shape and wrap AgentInfo construction in try/except so malformed model configs are skipped without breaking agent scans. Co-authored-by: Cursor <cursoragent@cursor.com>
Add runner-level guards for repeated exact tool calls and long same-tool streaks, apply a default max tool step limit when agents omit steps, and resolve message replay against the session's current model pin. Co-authored-by: Cursor <cursoragent@cursor.com>
Agents without an explicit steps limit now get a 1000-step budget instead of 100 for longer coding and research tasks. Co-authored-by: Cursor <cursoragent@cursor.com>
duguwanglong
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves multi-turn reliability for reasoning / interleaved-thinking models and hardens the session runner against runaway tool loops.
Provider: interleaved reasoning replay
reasoning_replay.pyandinterleaved.pyto normalize how assistant reasoning is echoed back to providers on follow-up turns.reasoning_content/reasoning_detailsacross tool-call turns, with provider-specific echo policies (when_present,tool_calls,all_assistant) and cross-provider promotion/placeholder handling.catalog.jsonwith interleaved-capability metadata for known reasoning model families.Session: tool-loop guards and step budget
SessionRunner:DEFAULT_MAX_TOOL_STEPS = 1000when an agent does not declare an explicitstepslimit (replaces unboundedinf).Agent: safer plugin loading
agent.yamlloading: validates mapping shape and skips malformed entries without breaking agent discovery.