Skip to content

Studio: Keep Codex reasoning between tool calls on /v1/responses - #11726

Merged
Lyxot merged 2 commits into
unslothai:mainfrom
NilayYadav:responses-reasoning-replay
Sep 24, 2026
Merged

Lyxot merged 2 commits into
unslothai:mainfrom
NilayYadav:responses-reasoning-replay

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

With unsloth start codex, Codex sends the model's earlier reasoning back with each request, but Studio threw it away. The model lost its plan after every tool call. One reply was also split into several messages whenever the model made more than one tool call.

Studio now keeps the reasoning and joins each reply back into a single message.

@Lyxot

Lyxot commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Pushed one small follow-up commit on top of this PR:

  • 428d7dd refactor(studio): clarify responses reasoning replay and cover content over summary. No behavior change. The _normalise_responses_input docstring now describes the reasoning replay and the turn folding once, for both function and custom tool calls. The fold accumulators are renamed to turn_reasoning / turn_text / turn_calls so they no longer read like the Responses content / summary fields. The ResponsesUnknownInputItem docstring was reworded, since it read as if dropped items stay in the union. The reasoning replay test now sends a non-empty summary next to content, so it proves content wins.

test_responses_tool_passthrough.py: 334 passed.

@Lyxot

Lyxot commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Codex review and CI on a staging copy with the same head (428d7ddc5d): Lyxot#83

@Lyxot Lyxot 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.

LGTM. Codex now gets its own reasoning back between tool calls, and each reply is folded into a single assistant turn, the same way llama.cpp's own /v1/responses handles it. Codex review and CI passed on the same head, and the change still passes its tests when merged with the latest main.

@Lyxot
Lyxot merged commit 346df2b into unslothai:main Sep 24, 2026
53 of 55 checks passed
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…lothai#11726)

* Studio: replay Responses reasoning and fold each turn into one assistant message

* refactor(studio): clarify responses reasoning replay and cover content over summary

---------

Co-authored-by: Lyxot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants