Repository navigation
Studio: harden OpenAI-compatible GGUF streaming - #6950
Conversation
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
f3b63e5 to
929df3b
Compare
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 929df3b862
ℹ️ 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".
929df3b to
c35d223
Compare
|
Addressed the review comments in
Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c35d2233c0
ℹ️ 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".
bffbbf1 to
cf37939
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf379391dc
ℹ️ 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".
18c5554 to
ef13d1c
Compare
b81ebe9 to
e600a69
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@oobabooga @danielhanchen |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22d7d9d428
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Verified your streaming hardening live against a local Qwen3.6-27B GGUF, diffing main against your branch across an edge-case matrix and live spec-compliance checks on the OpenAI and Anthropic surfaces. The broken-on-main behavior checks out: killing llama-server mid-stream left the connection hanging with no terminator, and reasoning-only deltas carried a non-spec field alone. Your branch fixes both. Real spec-compliance gains, no regressions. The streaming path is your work; the follow-ups are behavior fixes and cleanup on top:
@Apoze could you check if you agree with the changes and with the codex review above before I merge? |
|
Hi, |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Codex is clean on the latest commit and CI is green on the branch merged with current main. Thanks @Apoze! Merging. |
Summary
This PR tightens Studio's OpenAI-compatible local GGUF chat serving path so streamed responses are easier for strict OpenAI-compatible clients to consume.
Main changes:
reasoning_contentwhile also addingcontent: ""to reasoning-only stream deltas;data:payloads and[DONE];data: [DONE]sentinel;max_tokensandmax_completion_tokens;Motivation
Some OpenAI-compatible clients are strict about streamed chat delta shape and terminal SSE markers. Studio could forward chunks that were valid for llama.cpp but awkward for those clients, especially reasoning-only deltas and error/final chunks.
Local serving also needs a practical default when a client omits token limits. Without one, small auxiliary requests can unexpectedly become long generations. This PR keeps explicit client values intact and only applies a local default when no OpenAI token-limit field is present.
This does not disable reasoning and does not change model quality settings.
Configuration
UNSLOTH_OPENAI_COMPAT_IMPLICIT_MAX_TOKENS1024max_tokensandmax_completion_tokens.UNSLOTH_OPENAI_COMPAT_MAX_TOKENS_CEILINGUNSLOTH_OPENAI_COMPAT_STREAM_STALL_TIMEOUT30UNSLOTH_OPENAI_COMPAT_STREAM_PREHEADER_FALLBACK_TIMEOUTThese are backend-only environment hooks. They can be surfaced in Studio settings later without changing the API behavior added here.
Validation
Automated:
Targeted local result:
Source-clone LAN API checks:
studio/backend/run.py;http://192.168.20.80:8899;--host 0.0.0.0 --port 8899 --parallel 1 --api-only --no-cloudflare --disable-tools --silent;unsloth/Qwen3.6-27B-MTP-GGUF;UD-Q4_K_XL;129536;[DONE], no malformed JSON chunks;[DONE], no malformed JSON chunks;reasoning_contentis preserved.Real external-client checks:
OpenCode CLI
1.17.14with an@ai-sdk/openai-compatibleprovider:simple run:
RC=0, expected marker received;three consecutive continued turns:
RC=0;large attached-file prompt:
RC=0, expected marker received;short log excerpt:
Codex CLI
0.142.5withwire_api = "responses"and a local model catalog entry:simple run:
RC=0, expected marker received;file/tool run:
RC=0, expected marker received;large prompt:
RC=0, expected marker received;short log excerpt:
Compatibility Notes
max_tokens/max_completion_tokensvalues are preserved unless the optional local ceiling is configured.