Skip to content

Studio: report a cut off /v1/responses turn as incomplete - #10225

Merged
Etherll merged 6 commits into
unslothai:mainfrom
NilayYadav:fix-responses-incomplete-status
Sep 3, 2026
Merged

Etherll merged 6 commits into
unslothai:mainfrom
NilayYadav:fix-responses-incomplete-status

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

A turn that runs out of output tokens still says status completed with no detail, and the stream ends on response.completed, so a client cannot tell half an answer from a finished one. Anyone driving a local model through /v1/responses hits this, including Codex behind unsloth start.

It now reports status incomplete with a reason of max_output_tokens, and the stream ends on response.incomplete. Tested against a running llama-server with a small output limit: the reply said completed with no detail before, and incomplete with max_output_tokens after.

@danielhanchen

Copy link
Copy Markdown
Member

Confirmed this hits studio/backend/routes/inference.py, where the non-streaming path hardcodes status completed and the stream always terminates on response.completed, so a cut off turn is indistinguishable from a finished one. Will get this reviewed.

@Etherll

Etherll commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-03T13:15:31.437768Z 4b451be Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ba71369b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread studio/backend/routes/inference.py Outdated
Comment on lines +26919 to +26920
if healer is not None and healer.healed:
stream_finish_reason = "tool_calls"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve length when healing streamed tool calls

When a model emits a healable text-form tool call and llama-server ends the same turn with finish_reason: "length", healer.healed is true and this assignment overwrites the truncation reason before truncated is computed. The adapter consequently emits response.completed and records tool_calls, hiding exactly the cutoff this change is intended to expose; only replace a natural stop reason here, while allowing length to remain authoritative.

Useful? React with 👍 / 👎.

Comment thread studio/backend/routes/inference.py Outdated
Comment on lines +25883 to +25884
status = "incomplete" if truncated else "completed",
incomplete_details = ({"reason": "max_output_tokens"} if truncated else None),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Mark truncated output messages incomplete

For a finish_reason: "length" response containing text, the new top-level status becomes incomplete, but the associated ResponsesOutputMessage is still constructed with status: "completed" (and its model cannot represent incomplete); the streaming path likewise closes the active message as completed before placing it in the terminal snapshot. Clients that inspect output-item status can therefore still treat the cut-off answer as finished, so propagate the truncation state to the affected output item as well.

Useful? React with 👍 / 👎.

@Etherll

Etherll commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: af7dda26dd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Etherll

Etherll commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 4b451be24a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Etherll

Etherll commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Validated exact head 4b451be24aa90fd90ac9245afd4e40d10011f2c4 after the remediation pushes.

Buffered and streaming Responses truncations now end incomplete. length maps to max_output_tokens, and content_filter stays content_filter. Active partial output items are incomplete, earlier closed items remain completed. Tool-call healing preserves the authoritative truncation reason.

The Responses adapter and adjacent monitor suites passed, 291 tests total. Independent review covered 27/27 obligations with zero surviving findings. Exact-head security scans were clean.

CI is terminal: 44 successful checks, 4 skipped checks, 0 pending checks, and 0 failed checks. GitHub exposes no required status-check configuration for main.

This is a backend-only JSON/SSE change, so browser screenshots and UI evidence are not applicable. The PR remains open with REVIEW_REQUIRED. No merge was performed.

@Etherll Etherll 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 !

@Etherll
Etherll merged commit 2c11a27 into unslothai:main Sep 3, 2026
48 checks passed
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