Skip to content

Studio: extend llama.cpp first-token timeout - #5841

Merged
wasimysaid merged 35 commits into
unslothai:mainfrom
Imagineer99:fix/extend-llama-timeouts
Jun 12, 2026
Merged

wasimysaid merged 35 commits into
unslothai:mainfrom
Imagineer99:fix/extend-llama-timeouts

Conversation

@Imagineer99

Copy link
Copy Markdown
Member

Summary

Addresses #5756

Improves Studio behavior for slow local GGUF inference:

  • Extend first-token / prefill timeout from 120s to 10 minutes.
  • Remove Studio’s fixed t_max_predict_ms generation cutoff.
  • Show a clearer first-token timeout message instead of generic lost connection.
  • Add tests for the updated timeout policy.

Large prompts and partial CPU offload can spend minutes in prefill before streaming starts. Once generation is actively streaming, Studio should rely on max_tokens, context length, Stop, and server lifecycle controls rather than a fixed wall-clock cutoff.

Validated with a long-prompt GGUF run in Studio.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request removes the wall-clock generation cap (t_max_predict_ms) for local llama-server generations, relying instead on max_tokens and user-initiated stops. It introduces a configurable first-token/prefill timeout (_DEFAULT_FIRST_TOKEN_TIMEOUT_S) set to 10 minutes, replacing various hardcoded 120-second and 600-second timeouts. It also adds a user-friendly error message when a read timeout occurs during prompt processing. Feedback suggests improving the dynamic formatting of the timeout label in the user-friendly error message to correctly handle singular and plural forms of minutes and seconds.

Comment thread studio/backend/routes/inference.py Resolved
@Imagineer99
Imagineer99 marked this pull request as ready for review May 31, 2026 10:21
Comment thread studio/backend/routes/inference.py Resolved

@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: cfc932e059

ℹ️ 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".

Imagineer99 and others added 2 commits June 10, 2026 19:43
…outs

# Conflicts:
#	studio/backend/core/inference/llama_cpp.py
#	studio/backend/routes/inference.py
#	studio/backend/tests/test_openai_tool_passthrough.py

@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: a6057958e5

ℹ️ 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".

Comment thread studio/backend/routes/inference.py Resolved
@wasimysaid wasimysaid self-assigned this Jun 12, 2026
wasimysaid added a commit to Imagineer99/unsloth that referenced this pull request Jun 12, 2026
wasimysaid added a commit to Imagineer99/unsloth that referenced this pull request Jun 12, 2026

@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: afcaad547f

ℹ️ 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".

Comment thread studio/backend/routes/inference.py Resolved
Comment thread studio/backend/routes/inference.py Resolved
@wasimysaid
wasimysaid force-pushed the fix/extend-llama-timeouts branch from afcaad5 to e3b6a47 Compare June 12, 2026 14:27

@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: 93e67c0144

ℹ️ 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".

Comment thread studio/backend/routes/inference.py Resolved

@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: eabaf70dc1

ℹ️ 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".

Comment thread studio/backend/routes/inference.py Resolved
Comment thread studio/backend/routes/inference.py Resolved
Comment thread studio/backend/routes/inference.py Resolved

@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: 6764179514

ℹ️ 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".

Comment thread studio/backend/routes/inference.py Resolved

@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: d67e77714f

ℹ️ 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".

Comment thread studio/backend/routes/inference.py Resolved
Comment thread studio/backend/routes/inference.py Resolved
wasimysaid added a commit to wasimysaid/unsloth that referenced this pull request Jun 12, 2026
@wasimysaid

Copy link
Copy Markdown
Collaborator
Screenshot_20260612_183821

@wasimysaid
wasimysaid merged commit 31439d9 into unslothai:main Jun 12, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants