Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: make the first-token waiting limit configurable (#13390)
Lee Jackson4e65841159f5
diff --git a/studio/backend/core/inference/chat_generation_runs.py b/studio/backend/core/inference/chat_generation_runs.pyindex 80fa84c4e18..9cf2493ccd7 100644--- a/studio/backend/core/inference/chat_generation_runs.py+++ b/studio/backend/core/inference/chat_generation_runs.py@@ -19,6 +19,7 @@ from starlette.requests import Requestfrom core.inference.llama_keepwarm import InferenceActivityReservationfrom core.training.account_jobs import sweepable_job_accountsfrom utils.account_context import current_account_id, run_as+from utils.first_token_timeout import FirstTokenWait, track_first_token_waitfrom loggers import get_loggerfrom models.inference import ChatCompletionRequestfrom state import active_generations@@ -694,6 +695,16 @@ class ChatGenerationSupervisor:run_id: str,cancel_event: threading.Event | None = None,activity: InferenceActivityReservation | None = None,+ ) -> None:+ with track_first_token_wait() as first_token_wait:+ await self._produce_run(run_id, cancel_event, activity, first_token_wait)++ async def _produce_run(+ self,+ run_id: str,+ cancel_event: threading.Event | None,+ activity: InferenceActivityReservation | None,+ first_token_wait: FirstTokenWait,) -> None:cancel_event = cancel_event or threading.Event()if activity is None:@@ -787,8 +798,19 @@ class ChatGenerationSupervisor:if pendingelse None)+ # Wake to renew the lease across a first-token wait the backend is still inside its own deadline for.+ renew_interval = _renew_interval_seconds()+ timeout = renew_interval if timeout is None else min(timeout, renew_interval)ready, _waiting = await asyncio.wait({next_raw_task}, timeout = timeout)+ if (+ first_token_wait.active()+ and time.monotonic() - last_keepalive >= renew_interval+ ):+ await self._try_touch_progress(run_id)+ last_keepalive = time.monotonic()if not ready:+ if not pending:+ continueawait asyncio.to_thread(db.append_events,run_id,diff --git a/studio/backend/core/inference/engine_transport.py b/studio/backend/core/inference/engine_transport.pyindex 7c735196122..7a67deb6961 100644--- a/studio/backend/core/inference/engine_transport.py+++ b/studio/backend/core/inference/engine_transport.py@@ -52,8 +52,17 @@ def engine_messages(messages):def engine_request_timeout():"""The llama-server first-token deadline: long prefill, queueing or a non-streamedreply routinely outlast a fixed short read timeout."""- from routes.inference import _first_token_timeout_s- return httpx.Timeout(_first_token_timeout_s(), connect = 5)+ from routes.inference import (+ _DEFAULT_FIRST_TOKEN_TIMEOUT_S,+ _OPENAI_COMPAT_FIRST_TOKEN_TIMEOUT_ENV,+ _finite_positive_float_env,+ )++ # Not the saved GGUF limit: this one read timeout also bounds mid-response stalls here.+ value = _finite_positive_float_env(+ _OPENAI_COMPAT_FIRST_TOKEN_TIMEOUT_ENV, _DEFAULT_FIRST_TOKEN_TIMEOUT_S+ )+ return httpx.Timeout(_DEFAULT_FIRST_TOKEN_TIMEOUT_S if value is None else value, connect = 5)def stream_chat_events(base_url, headers, payload, cancelled):diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.pyindex 83e91d43f72..29c25acc8e6 100644--- a/studio/backend/core/inference/llama_cpp.py+++ b/studio/backend/core/inference/llama_cpp.py@@ -510,6 +510,11 @@ from state.tool_approvals import ()from utils.paths.path_utils import _is_wsl, is_appledouble_metadatafrom utils.code_integrity import code_integrity_block_reason, code_integrity_user_message+from utils.first_token_timeout import (+ finish_first_token_wait,+ socket_timeout,+ start_first_token_wait,+)# The leaf module, not utils.models: importing anything from that package runs its __init__,# which pulls in model_config and therefore PyYAML. This is the chat backend, imported wherever@@ -37644,7 +37649,7 @@ class LlamaCppBackend:trust_env = False,verify = _local_ssl_context(),) as client:- first_token_deadline = time.monotonic() + _DEFAULT_FIRST_TOKEN_TIMEOUT_S+ first_token_deadline = start_first_token_wait()with self._stream_with_retry(client,url,@@ -37707,7 +37712,7 @@ class LlamaCppBackend:"""Iterate a stream while polling cancel and stall timeouts."""text_iter = response.iter_text()if first_token_deadline is None:- first_token_deadline = time.monotonic() + _DEFAULT_FIRST_TOKEN_TIMEOUT_S+ first_token_deadline = start_first_token_wait()last_chunk_at: Optional[float] = Nonelast_prefill_progress: Optional[float] = Noneprefill_sse_buffer = ""@@ -37720,7 +37725,7 @@ class LlamaCppBackend:remaining_s = first_token_deadline - time.monotonic()if remaining_s <= 0:raise httpx.ReadTimeout("The model did not produce a first token in time.")- LlamaCppBackend._set_stream_read_timeout(response, remaining_s)+ LlamaCppBackend._set_stream_read_timeout(response, socket_timeout(remaining_s))chunk = next(text_iter)starts_output = last_chunk_at is not Noneif chunk and last_chunk_at is None:@@ -37738,8 +37743,9 @@ class LlamaCppBackend:last_prefill_progress is None or processed > last_prefill_progress):last_prefill_progress = processed- first_token_deadline = time.monotonic() + _DEFAULT_FIRST_TOKEN_TIMEOUT_S+ first_token_deadline = start_first_token_wait()if chunk and starts_output:+ finish_first_token_wait()if last_chunk_at is None and post_first_chunk_read_timeout_s is not None:LlamaCppBackend._set_stream_read_timeout(response,@@ -37759,7 +37765,9 @@ class LlamaCppBackend:continue@staticmethod- def _set_stream_read_timeout(response: "httpx.Response", read_timeout_s: float) -> None:+ def _set_stream_read_timeout(+ response: "httpx.Response", read_timeout_s: Optional[float]+ ) -> None:"""Lower only post-header stream reads; keep prefill timeout long."""try:timeout_ext = response.request.extensions.get("timeout")@@ -37813,18 +37821,19 @@ class LlamaCppBackend:stall timeout instead of the long prefill timeout."""import httpcore- def _live_read_timeout() -> Optional[float]:+ def _live_read_timeout(snapshot: Optional[float]) -> Optional[float]:if response is None:- return None+ return snapshottry:ext = response.request.extensions.get("timeout")- if isinstance(ext, dict):- value = ext.get("read")- if isinstance(value, (int, float)):- return float(value)+ if isinstance(ext, dict) and "read" in ext:+ value = ext["read"]+ # None is a live value too: an unlimited first-token wait has no read bound.+ if value is None or isinstance(value, (int, float)):+ return valueexcept Exception:pass- return None+ return snapshottry:pool = getattr(getattr(client, "_transport", None), "_pool", None)@@ -37840,8 +37849,7 @@ class LlamaCppBackend:timeout = None,_orig = orig_read,):- live = _live_read_timeout()- effective = live if live is not None else timeout+ effective = _live_read_timeout(timeout)deadline = None if effective is None else time.monotonic() + effectivewhile True:if cancel_event.is_set():@@ -37906,11 +37914,14 @@ class LlamaCppBackend:try:if first_token_deadline is None:- first_token_deadline = time.monotonic() + _DEFAULT_FIRST_TOKEN_TIMEOUT_S+ first_token_deadline = start_first_token_wait()prefill_read_timeout = max(0.1, first_token_deadline - time.monotonic())+ if sys.platform == "win32":+ # Stop cannot wake a Winsock recv parked before headers, so that wait keeps the default bound.+ prefill_read_timeout = min(prefill_read_timeout, _DEFAULT_FIRST_TOKEN_TIMEOUT_S)prefill_timeout = httpx.Timeout(connect = 30,- read = prefill_read_timeout,+ read = socket_timeout(prefill_read_timeout),write = 10,pool = 10,)@@ -37922,11 +37933,13 @@ class LlamaCppBackend:headers = headers,) as response:_response_ref[0] = response- if cancel_event is not None:- # Portable mid-stream cancel: the reader polls cancel itself, so- # Stop interrupts a stalled read where the watcher's Windows socket- # shutdown does not. Pass response to honor the live stall timeout.- LlamaCppBackend._install_cancel_aware_read(client, cancel_event, response)+ # Portable mid-stream cancel: the reader polls cancel itself, so Stop+ # interrupts a stalled read where the watcher's Windows socket shutdown+ # does not. Installed without a cancel event too: only this wrapper+ # honors the live stall timeout over the one latched for the header wait.+ LlamaCppBackend._install_cancel_aware_read(+ client, cancel_event or threading.Event(), response+ )if cancel_event is not None and cancel_event.is_set():raise _LlamaStreamCancelledyield responsediff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.pyindex ed47c0a7fef..1303a5f1483 100644--- a/studio/backend/routes/inference.py+++ b/studio/backend/routes/inference.py@@ -81,6 +81,12 @@ from utils.models.checkpoints import is_full_finetune_outputfrom utils.api_errors import openai_error_body, anthropic_error_body, error_body_for_pathfrom utils.audio_tokens import GGUF_TTS_AUDIO_TYPES as _GGUF_TTS_AUDIO_TYPES+from utils.first_token_timeout import (+ finish_first_token_wait,+ socket_timeout,+ start_first_token_wait,+ timeout_seconds as configured_first_token_timeout_s,+)from utils.upload_limits import STT_AUDIO_B64_MAX_CHARS, STT_AUDIO_RAW_MAX_BYTESfrom hub.dependencies import get_hf_token, get_request_hf_tokenfrom hub.utils.hf_errors import modelscope_missing@@ -329,10 +335,14 @@ def _friendly_error(exc: Exception) -> str:"The model stopped producing tokens before the response ""completed. Try stopping and retrying, or reduce max tokens.")+ raise_limit = (+ "For a local GGUF model, increase the first-token waiting limit in Settings > Chat"+ )+ if _finite_positive_float_env(_OPENAI_COMPAT_FIRST_TOKEN_TIMEOUT_ENV, None) is not None:+ raise_limit += f" (API requests use {_OPENAI_COMPAT_FIRST_TOKEN_TIMEOUT_ENV} instead while it is set)"return (- "The model is still processing the prompt but did not produce a "- "first token within 20 minutes. Try reducing context length, "- "using more GPU offload, or loading a smaller model."+ "The model did not produce a first token within the waiting limit. "+ f"{raise_limit}. Otherwise reduce context length, use more GPU offload, or load a smaller model.")if isinstance(exc, httpx.TimeoutException):return "Timed out communicating with the model server. Try again shortly."@@ -1864,11 +1874,16 @@ except ImportError:def _llama_non_streaming_generation_timeout() -> httpx.Timeout:- return httpx.Timeout(_first_token_timeout_s())+ return httpx.Timeout(+ _DEFAULT_FIRST_TOKEN_TIMEOUT_S,+ read = socket_timeout(_first_token_timeout_s(whole_reply = True)),+ )def _llama_streaming_generation_timeout() -> httpx.Timeout:- return httpx.Timeout(_first_token_timeout_s())+ return httpx.Timeout(+ _DEFAULT_FIRST_TOKEN_TIMEOUT_S, read = socket_timeout(_first_token_timeout_s())+ )def _set_stream_response_read_timeout(@@ -3082,19 +3097,17 @@ def _finite_positive_float_env(env_name: str, default):return value-def _first_token_timeout_s() -> float:- """How long a passthrough waits for llama-server's first token.+def _first_token_timeout_s(*, whole_reply: bool = False) -> float:+ """The saved wait limit; a positive UNSLOTH_OPENAI_COMPAT_FIRST_TOKEN_TIMEOUT wins.- Unlike the stall guard, 0 does NOT disable it: the deadline is unconditional- downstream, so a non-positive value keeps the default. Raise it, do not lower- it: the same value builds the non-streaming timeout, where httpx.Timeout's- positional form also covers connect/read/write/pool.+ ``whole_reply`` is for a read that spans an entire non-streamed generation, which a+ limit shortened below the default must not cut."""- value = _finite_positive_float_env(- _OPENAI_COMPAT_FIRST_TOKEN_TIMEOUT_ENV,- _DEFAULT_FIRST_TOKEN_TIMEOUT_S,- )- return _DEFAULT_FIRST_TOKEN_TIMEOUT_S if value is None else value+ default = configured_first_token_timeout_s()+ if whole_reply:+ default = max(default, _DEFAULT_FIRST_TOKEN_TIMEOUT_S)+ value = _finite_positive_float_env(_OPENAI_COMPAT_FIRST_TOKEN_TIMEOUT_ENV, default)+ return default if value is None else valuedef _openai_passthrough_stream_keepalive_interval():@@ -3511,7 +3524,9 @@ def _ceiling_for_first_read("""if post_first_item_read_timeout_s is None:return None- return max(first_token_deadline - time.monotonic(), post_first_item_read_timeout_s)+ return socket_timeout(+ max(first_token_deadline - time.monotonic(), post_first_item_read_timeout_s)+ )async def _aiter_llama_stream_items(@@ -3536,7 +3551,7 @@ async def _aiter_llama_stream_items(stream on any streaming exception, so a ReadTimeout here is terminal."""if first_token_deadline is None:- first_token_deadline = time.monotonic() + _first_token_timeout_s()+ first_token_deadline = start_first_token_wait(_first_token_timeout_s())last_item_at: Optional[float] = Nonelast_prefill_progress: Optional[float] = Noneprefill_buffer = b""@@ -3592,7 +3607,9 @@ async def _aiter_llama_stream_items()remaining_s = (- None if hard_deadline is None else max(hard_deadline - time.monotonic(), 0.0)+ None+ if hard_deadline is None+ else socket_timeout(max(hard_deadline - time.monotonic(), 0.0)))if keepalive_interval_s:wait_s = (@@ -3653,7 +3670,7 @@ async def _aiter_llama_stream_items(last_prefill_progress is None or processed > last_prefill_progress):last_prefill_progress = processed- first_token_deadline = time.monotonic() + _first_token_timeout_s()+ first_token_deadline = start_first_token_wait(_first_token_timeout_s())if not starts_output:if time.monotonic() >= first_token_deadline:raise httpx.ReadTimeout("The model did not produce a first token in time.")@@ -3664,6 +3681,7 @@ async def _aiter_llama_stream_items(# Before yielding, not before the next read: the consumer may sit# on this item while the first-token deadline is still armed._set_stream_response_read_timeout(response, _post_first_timeout_s())+ finish_first_token_wait()last_item_at = time.monotonic()yield itemfinally:@@ -37141,7 +37159,7 @@ async def openai_completions(request: Request, current_subject: str = Depends(gejson = upstream_body,headers = _openai_passthrough_upstream_headers(llama_backend = llama_backend),)- first_token_deadline = time.monotonic() + _first_token_timeout_s()+ first_token_deadline = start_first_token_wait(_first_token_timeout_s())# Same event the relay loop polls, so a forced swap ends the request during prefill# instead of only once headers arrive.resp = await _send_stream_with_preheader_cancel(@@ -39614,7 +39632,7 @@ async def _responses_stream(json = body,headers = _openai_passthrough_upstream_headers(llama_backend = llama_backend),)- first_token_deadline = time.monotonic() + _first_token_timeout_s()+ first_token_deadline = start_first_token_wait(_first_token_timeout_s())try:# Same event the loop below polls: prefill can run for the whole first-token window,# and only the send watcher can end it early.@@ -43953,7 +43971,7 @@ async def _anthropic_passthrough_stream(json = body,headers = _openai_passthrough_upstream_headers(llama_backend = llama_backend),)- first_token_deadline = time.monotonic() + _first_token_timeout_s()+ first_token_deadline = start_first_token_wait(_first_token_timeout_s())resp = await _send_stream_with_preheader_cancel(client, req, cancel_event, request = request)@@ -43969,7 +43987,7 @@ async def _anthropic_passthrough_stream(json = body,headers = _openai_passthrough_upstream_headers(llama_backend = llama_backend),)- first_token_deadline = time.monotonic() + _first_token_timeout_s()+ first_token_deadline = start_first_token_wait(_first_token_timeout_s())resp = await _send_stream_with_preheader_cancel(client, req, cancel_event, request = request)@@ -45255,7 +45273,7 @@ async def _openai_passthrough_stream_admitted(while True:try:req = client.build_request("POST", target_url, json = body, headers = upstream_headers)- first_token_deadline = time.monotonic() + _first_token_timeout_s()+ first_token_deadline = start_first_token_wait(_first_token_timeout_s())send_task = asyncio.create_task(_send_stream_with_preheader_cancel(client,@@ -45636,8 +45654,8 @@ async def _openai_passthrough_stream_admitted(mark_cancel_on_cancel = False,))- first_token_deadline = (- time.monotonic() + _first_token_timeout_s()+ first_token_deadline = start_first_token_wait(+ _first_token_timeout_s())continuelogger.error(@@ -45676,7 +45694,7 @@ async def _openai_passthrough_stream_admitted(req = client.build_request("POST", target_url, json = body, headers = upstream_headers)- first_token_deadline = time.monotonic() + _first_token_timeout_s()+ first_token_deadline = start_first_token_wait(_first_token_timeout_s())send_task = asyncio.create_task(_send_stream_with_preheader_cancel(client,diff --git a/studio/backend/routes/settings.py b/studio/backend/routes/settings.pyindex bf32623e7e6..69a9723319e 100644--- a/studio/backend/routes/settings.py+++ b/studio/backend/routes/settings.py@@ -90,7 +90,7 @@ from utils.helper_precache_settings import (helper_model_disabled_by_env,set_helper_precache_enabled,)-from utils import sandbox_memory_limit, systemone_settings, tool_result_limit+from utils import first_token_timeout, sandbox_memory_limit, systemone_settings, tool_result_limitfrom utils.download_transport_settings import (get_download_transport_mode,set_download_transport_mode,@@ -1509,6 +1509,28 @@ def update_upload_limit(return _upload_limit_response(limit_mb)+class FirstTokenTimeoutPayload(BaseModel):+ minutes: StrictInt = Field(ge = 0, le = first_token_timeout.MAX_MINUTES)+++class FirstTokenTimeoutResponse(FirstTokenTimeoutPayload):+ default_minutes: int = first_token_timeout.DEFAULT_MINUTES+ max_minutes: int = first_token_timeout.MAX_MINUTES+++@_shared_settings_router.get("/first-token-timeout", response_model = FirstTokenTimeoutResponse)+def get_first_token_timeout(current_subject: str = Depends(get_current_subject)):+ return FirstTokenTimeoutResponse(minutes = first_token_timeout.get_minutes())+++@_owner_settings_router.put("/first-token-timeout", response_model = FirstTokenTimeoutResponse)+def update_first_token_timeout(+ payload: FirstTokenTimeoutPayload, current_subject: str = Depends(get_current_subject)+):+ first_token_timeout.set_minutes(payload.minutes)+ return FirstTokenTimeoutResponse(minutes = payload.minutes)++def _tool_result_limit_response() -> ToolResultLimitResponse:return ToolResultLimitResponse(max_chars = tool_result_limit.effective_max_chars(),diff --git a/studio/backend/tests/test_chat_generation_lease_compat.py b/studio/backend/tests/test_chat_generation_lease_compat.pyindex bd5b6f2e1a2..2f2d61db230 100644--- a/studio/backend/tests/test_chat_generation_lease_compat.py+++ b/studio/backend/tests/test_chat_generation_lease_compat.py@@ -729,7 +729,7 @@ def test_only_admission_comments_renew_the_lease_from_the_stream():signal, so both renew, and nothing else may."""import inspect- source = inspect.getsource(runs_mod.ChatGenerationSupervisor._produce)+ source = inspect.getsource(runs_mod.ChatGenerationSupervisor._produce_run)for marker in ("_ADMISSION_DONE_MARKER in text", "_ADMISSION_WAIT_MARKER in text"):guard = source.index(marker)renew = source.index("_try_touch_progress", guard)@@ -743,7 +743,7 @@ def test_leaving_the_queue_renews_without_waiting_for_the_rate_limit():the default first-token timeout, so that difference is negative margin."""import inspect- source = inspect.getsource(runs_mod.ChatGenerationSupervisor._produce)+ source = inspect.getsource(runs_mod.ChatGenerationSupervisor._produce_run)guard = source.index("_ADMISSION_DONE_MARKER in text")renew = source.index("_try_touch_progress", guard)between = source[guard:renew]diff --git a/studio/backend/tests/test_chat_generation_supervisor.py b/studio/backend/tests/test_chat_generation_supervisor.pyindex 30e32d42476..c8bffef5699 100644--- a/studio/backend/tests/test_chat_generation_supervisor.py+++ b/studio/backend/tests/test_chat_generation_supervisor.py@@ -1068,3 +1068,35 @@ def test_the_producers_cancel_event_carries_the_durable_marker_and_its_run_id():activity = supervisor._activities.pop("run-durable", None)if activity is not None:activity.finish()+++async def test_permitted_prefill_renews_lease_but_decode_silence_does_not(durable_run, monkeypatch):+ from utils.first_token_timeout import start_first_token_wait, finish_first_token_wait++ monkeypatch.setattr(chat_generation_runs, "_renew_interval_seconds", lambda: 0.01)+ supervisor = ChatGenerationSupervisor(SimpleNamespace(state = SimpleNamespace()))+ touch = AsyncMock(wraps = supervisor._try_touch_progress)+ monkeypatch.setattr(supervisor, "_try_touch_progress", touch)+ observations = []++ async def body():+ # The sync GGUF reader runs in a copied thread context, while the supervisor+ # polls the shared wait object from the producer's original context.+ await asyncio.to_thread(start_first_token_wait, float("inf"))+ before = touch.await_count+ await asyncio.sleep(0.08)+ observations.append(touch.await_count > before)+ await asyncio.to_thread(finish_first_token_wait)+ yield 'data: {"choices":[{"delta":{"content":"hello"}}]}\n\n'+ before = touch.await_count+ await asyncio.sleep(0.08)+ observations.append(touch.await_count == before)+ yield "data: [DONE]\n\n"++ async def fake(*_args, **_kwargs):+ return SimpleNamespace(status_code = 200, body_iterator = body())++ monkeypatch.setattr(inference, "produce_openai_chat_completions", fake)+ await supervisor._produce("run-1")+ assert observations == [True, True]diff --git a/studio/backend/tests/test_first_token_timeout_setting.py b/studio/backend/tests/test_first_token_timeout_setting.pynew file mode 100644index 00000000000..308c016f625--- /dev/null+++ b/studio/backend/tests/test_first_token_timeout_setting.py@@ -0,0 +1,205 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import asyncio+import math+import threading+import time+from types import SimpleNamespace++import httpx+import pytest+from fastapi import FastAPI+from fastapi.testclient import TestClient++from core.inference.llama_cpp import LlamaCppBackend+from routes import inference, settings+from storage import studio_db+from utils import first_token_timeout as limit+from utils.account_context import OWNER, AccountContext, bind_account, reset_account++[email protected](autouse = True)+def isolated(monkeypatch, tmp_path):+ monkeypatch.setenv("UNSLOTH_STUDIO_HOME", str(tmp_path))+ monkeypatch.setattr(studio_db, "_schema_ready", set())+ monkeypatch.delenv(inference._OPENAI_COMPAT_FIRST_TOKEN_TIMEOUT_ENV, raising = False)+++def client(account = OWNER):+ app = FastAPI()+ app.include_router(settings.router)++ async def subject():+ token = bind_account(account)+ try:+ yield account.username+ finally:+ reset_account(token)++ app.dependency_overrides[settings.get_current_subject] = subject+ return TestClient(app)+++def test_settings_persist_and_both_inference_paths_use_them():+ with client() as api:+ assert api.get("/first-token-timeout").json()["minutes"] == 20+ for minutes, seconds in [(75, 4500.0), (0, math.inf), (20, 1200.0)]:+ assert api.put("/first-token-timeout", json = {"minutes": minutes}).status_code == 200+ assert limit.timeout_seconds() == seconds+ assert inference._first_token_timeout_s() == seconds+ assert inference._llama_streaming_generation_timeout().read == limit.socket_timeout(+ seconds+ )+ assert api.get("/first-token-timeout").json()["minutes"] == 20++[email protected]("value", [-1, 10081, True, "60", 1.5, None])+def test_invalid_settings_are_rejected(value):+ with client() as api:+ assert api.put("/first-token-timeout", json = {"minutes": value}).status_code == 422+ assert limit.get_minutes() == 20+++def test_managed_account_reads_owner_setting_but_cannot_change_it():+ limit.set_minutes(90)+ with client(AccountContext("a" * 32, "alice")) as api:+ assert api.get("/first-token-timeout").json()["minutes"] == 90+ assert api.put("/first-token-timeout", json = {"minutes": 0}).status_code == 403+ assert limit.get_minutes() == 90++[email protected]("stored", [-1, 10081, True, "60", 1.5, None, {"minutes": 60}])+def test_unusable_stored_value_falls_back_to_default(stored):+ studio_db.upsert_app_settings({limit.SETTING_KEY: stored})+ assert limit.get_minutes() == limit.DEFAULT_MINUTES+++def test_explicit_api_env_override_is_preserved(monkeypatch):+ limit.set_minutes(0)+ monkeypatch.setenv(inference._OPENAI_COMPAT_FIRST_TOKEN_TIMEOUT_ENV, "42")+ assert inference._first_token_timeout_s() == 42+ assert limit.timeout_seconds() == math.inf+ assert "UNSLOTH_OPENAI_COMPAT" in inference._friendly_error(httpx.ReadTimeout("x"))++[email protected]("minutes,read", [(1, 1200.0), (90, 5400.0), (0, None)])+def test_shortened_limit_does_not_cut_non_streamed_replies(minutes, read):+ from core.inference.engine_transport import engine_request_timeout++ limit.set_minutes(minutes)+ assert inference._llama_non_streaming_generation_timeout().read == read+ assert engine_request_timeout().read == 1200.0 # Managed engines ignore the GGUF limit.+ assert inference._llama_streaming_generation_timeout().read == (minutes * 60 or None)+++def test_sync_custom_wait_survives_original_limit_and_then_expires(monkeypatch):+ limit.set_minutes(60)+ clock = [0.0]+ monkeypatch.setattr(limit.time, "monotonic", lambda: clock[0])++ class Response:+ request = SimpleNamespace(extensions = {"timeout": {"read": 1200}})++ def iter_text(self):+ for moment in (1300, 3601):+ clock[0] = moment+ yield 'data: {"choices":[{"delta":{"role":"assistant"}}]}\n\n'++ iterator = LlamaCppBackend._iter_text_cancellable(Response())+ with limit.track_first_token_wait() as wait:+ next(iterator)+ assert wait.active() # Past the original 20-minute limit.+ next(iterator)+ with pytest.raises(httpx.ReadTimeout):+ next(iterator)+ assert not wait.active()+++def test_sync_unlimited_prefill_still_switches_to_decode_stall(monkeypatch):+ limit.set_minutes(0)+ clock = [0.0]+ monkeypatch.setattr(limit.time, "monotonic", lambda: clock[0])++ class Response:+ request = SimpleNamespace(extensions = {"timeout": {"read": 1200}})++ def iter_text(self):+ clock[0] = 86400.0 # A day of simulated prefill.+ yield 'data: {"choices":[{"delta":{"content":"hello"}}]}\n\n'+ clock[0] += 121+ raise httpx.ReadTimeout("silent decode")++ response = Response()+ with limit.track_first_token_wait() as wait:+ iterator = LlamaCppBackend._iter_text_cancellable(response)+ assert "hello" in next(iterator)+ assert not wait.active()+ assert response.request.extensions["timeout"]["read"] == 120+ with pytest.raises(httpx.ReadTimeout, match = "stopped producing tokens"):+ next(iterator)+++def test_windows_bounds_the_header_wait_while_unlimited_body_reads_stay_unbounded(monkeypatch):+ import httpcore+ from contextlib import contextmanager++ limit.set_minutes(0)+ attempts = iter([httpcore.ReadTimeout("slice"), httpcore.ReadTimeout("slice"), b"x"])++ def read(_max_bytes, timeout = None):+ time.sleep(0.002)+ if isinstance(item := next(attempts), Exception):+ raise item+ return item++ network = SimpleNamespace(read = read)+ pool = SimpleNamespace(+ _connections = [SimpleNamespace(_connection = SimpleNamespace(_network_stream = network))]+ )+ response = SimpleNamespace(request = SimpleNamespace(extensions = {"timeout": {"read": None}}))+ seen = {}++ @contextmanager+ def stream(*_args, timeout, **_kwargs):+ seen["read"] = timeout.read+ yield response++ client = SimpleNamespace(stream = stream, _transport = SimpleNamespace(_pool = pool))+ monkeypatch.setattr("core.inference.llama_cpp.sys.platform", "win32")+ with LlamaCppBackend._stream_with_retry(+ client, "url", {}+ ): # No cancel event, as the CLI calls it.+ assert seen["read"] == 1200.0+ assert network.read(1, timeout = 0.001) == b"x"+++async def test_async_pump_arms_saved_limit_until_output_and_stays_cancellable():+ limit.set_minutes(60)+ cancelled = threading.Event()++ async def upstream():+ yield b'data: {"choices":[{"delta":{"role":"assistant"}}]}\n\n'+ yield b'data: {"prompt_progress":{"processed":8}}\n\n'+ yield b'data: {"choices":[{"delta":{"content":"hello"}}]}\n\n'+ await asyncio.Future()++ with limit.track_first_token_wait() as wait:+ pump = inference._aiter_llama_stream_items(+ upstream(),+ cancel_event = cancelled,+ track_prefill_progress = True,+ keepalive_interval_s = 0.01,+ )+ await anext(pump)+ assert 3500 < wait.deadline - time.monotonic() <= 3600+ limit.set_minutes(90) # Advancing prefill re-arms with the limit then saved.+ await anext(pump)+ assert 5300 < wait.deadline - time.monotonic() <= 5400+ assert b"hello" in await anext(pump)+ assert not wait.active()+ assert await anext(pump) is inference._LLAMA_STREAM_KEEPALIVE+ cancelled.set()+ with pytest.raises(StopAsyncIteration):+ await asyncio.wait_for(anext(pump), 1)diff --git a/studio/backend/tests/test_openai_tool_passthrough.py b/studio/backend/tests/test_openai_tool_passthrough.pyindex 31d2f8f1fe7..02493c11a46 100644--- a/studio/backend/tests/test_openai_tool_passthrough.py+++ b/studio/backend/tests/test_openai_tool_passthrough.py@@ -3808,7 +3808,7 @@ class TestFriendlyErrorHttpx:def test_read_timeout_mapped(self):exc = httpx.ReadTimeout("timed out", request = self._req())- assert "first token within 20 minutes" in _friendly_error(exc)+ assert "first token within the waiting limit" in _friendly_error(exc)def test_non_httpx_unchanged(self):# Non-httpx exceptions still fall through to the substring heuristics@@ -9848,11 +9848,11 @@ class TestApiMonitorProviderAndCompletionStreams:assert 'data: {"choices":[{"delta":{"content":"hello"}}]}\n\n' in bodyassert '"finish_reason"' not in body.replace(" ", "")assert '"type":"api_error"' in body.replace(" ", "")- assert "still processing the prompt" in body+ assert "first token within the waiting limit" in bodyassert body.endswith("data: [DONE]\n\n")[entry] = monitor.snapshot()assert entry["status"] == "error"- assert "still processing the prompt" in entry["error"]+ assert "first token within the waiting limit" in entry["error"]assert entry["reply"] == "hello"assert monitor.active_count() == 0diff --git a/studio/backend/utils/first_token_timeout.py b/studio/backend/utils/first_token_timeout.pynew file mode 100644index 00000000000..888cec8844e--- /dev/null+++ b/studio/backend/utils/first_token_timeout.py@@ -0,0 +1,90 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++"""Installation-wide local inference wait limit and request-scoped prefill lease.++Infinity represents Unlimited in deadline arithmetic only; socket APIs receive None.+The mutable wait state crosses asyncio.to_thread's copied context so durable runs can+renew their lease during an explicitly permitted wait, without disabling orphan cleanup.+"""++from __future__ import annotations++import math+import time+from contextlib import contextmanager+from contextvars import ContextVar+from dataclasses import dataclass++DEFAULT_MINUTES = 20+MAX_MINUTES = 10080 # One week; 0 explicitly means Unlimited.+SETTING_KEY = "first_token_timeout_minutes"+++def get_minutes() -> int:+ try:+ from storage.studio_db import get_app_setting+ from utils.account_context import OWNER, run_as++ value = run_as(OWNER, get_app_setting, SETTING_KEY, DEFAULT_MINUTES)+ if type(value) is int and 0 <= value <= MAX_MINUTES:+ return value+ except Exception:+ pass # An unavailable settings store must not break inference.+ return DEFAULT_MINUTES+++def set_minutes(value: int) -> None:+ if type(value) is not int or not 0 <= value <= MAX_MINUTES:+ raise ValueError(f"Use 0 for Unlimited or 1–{MAX_MINUTES} whole minutes.")+ from storage.studio_db import upsert_app_settings+ from utils.account_context import OWNER, run_as++ run_as(OWNER, upsert_app_settings, {SETTING_KEY: value})+++def timeout_seconds() -> float:+ minutes = get_minutes()+ return minutes * 60.0 if minutes else math.inf+++def socket_timeout(seconds: float) -> float | None:+ return seconds if math.isfinite(seconds) else None+++@dataclass+class FirstTokenWait:+ deadline: float | None = None++ def active(self) -> bool:+ # The worker thread can finish prefill while the supervisor checks it.+ deadline = self.deadline+ return deadline is not None and time.monotonic() < deadline+++_current_wait: ContextVar[FirstTokenWait | None] = ContextVar("first_token_wait", default = None)+++@contextmanager+def track_first_token_wait():+ state = FirstTokenWait()+ token = _current_wait.set(state)+ try:+ yield state+ finally:+ state.deadline = None+ _current_wait.reset(token)+++def start_first_token_wait(seconds: float | None = None) -> float:+ deadline = time.monotonic() + (timeout_seconds() if seconds is None else seconds)+ state = _current_wait.get()+ if state is not None:+ state.deadline = deadline+ return deadline+++def finish_first_token_wait() -> None:+ state = _current_wait.get()+ if state is not None:+ state.deadline = Nonediff --git a/studio/frontend/src/features/settings/api/first-token-timeout.ts b/studio/frontend/src/features/settings/api/first-token-timeout.tsnew file mode 100644index 00000000000..9b67b87c96d--- /dev/null+++ b/studio/frontend/src/features/settings/api/first-token-timeout.ts@@ -0,0 +1,32 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import { authFetch } from "@/features/auth";+import { readFastApiError } from "@/lib/format-fastapi-error";++export type FirstTokenTimeoutSettings = {+ minutes: number;+ // biome-ignore lint/style/useNamingConvention: API schema+ default_minutes: number;+ // biome-ignore lint/style/useNamingConvention: API schema+ max_minutes: number;+};++export async function firstTokenTimeoutSettings(+ fallbackMessage: string,+ minutes?: number,+): Promise<FirstTokenTimeoutSettings> {+ const response = await authFetch("/api/settings/first-token-timeout", {+ method: minutes === undefined ? "GET" : "PUT",+ ...(minutes === undefined+ ? {}+ : {+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ minutes }),+ }),+ });+ if (!response.ok) {+ throw new Error(await readFastApiError(response, fallbackMessage));+ }+ return response.json();+}diff --git a/studio/frontend/src/features/settings/components/first-token-timeout-row.tsx b/studio/frontend/src/features/settings/components/first-token-timeout-row.tsxnew file mode 100644index 00000000000..3d264dac98f--- /dev/null+++ b/studio/frontend/src/features/settings/components/first-token-timeout-row.tsx@@ -0,0 +1,157 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { useT } from "@/i18n";+import { useEffect, useState } from "react";+import {+ type FirstTokenTimeoutSettings,+ firstTokenTimeoutSettings,+} from "../api/first-token-timeout";+import { SettingsRow } from "./settings-row";++type Mode = "default" | "custom" | "unlimited";+const modeFor = (minutes: number, defaultMinutes: number): Mode =>+ minutes === 0+ ? "unlimited"+ : minutes === defaultMinutes+ ? "default"+ : "custom";++export function FirstTokenTimeoutRow() {+ const t = useT();+ const [settings, setSettings] = useState<FirstTokenTimeoutSettings | null>(+ null,+ );+ const [mode, setMode] = useState<Mode>("default");+ const [customMinutes, setCustomMinutes] = useState("60");+ const [saving, setSaving] = useState(false);+ const [error, setError] = useState<string | null>(null);++ useEffect(() => {+ let cancelled = false;+ void firstTokenTimeoutSettings(t("settings.chat.firstTokenLoadError"))+ .then((value) => {+ if (cancelled) return;+ setSettings(value);+ setMode(modeFor(value.minutes, value.default_minutes));+ if (value.minutes > 0) setCustomMinutes(String(value.minutes));+ })+ .catch((reason) => {+ if (!cancelled)+ setError(String(reason instanceof Error ? reason.message : reason));+ });+ return () => {+ cancelled = true;+ };+ }, [t]);++ const minutes =+ mode === "unlimited"+ ? 0+ : mode === "default"+ ? (settings?.default_minutes ?? 20)+ : Number(customMinutes);+ const valid =+ mode !== "custom" ||+ (customMinutes.trim() !== "" &&+ Number.isInteger(minutes) &&+ minutes >= 1 &&+ minutes <= (settings?.max_minutes ?? 10080));+ const save = async () => {+ if (!valid || !settings) return;+ setSaving(true);+ setError(null);+ try {+ setSettings(+ await firstTokenTimeoutSettings(+ t("settings.chat.firstTokenSaveError"),+ minutes,+ ),+ );+ } catch (reason) {+ setError(String(reason instanceof Error ? reason.message : reason));+ } finally {+ setSaving(false);+ }+ };++ return (+ <SettingsRow+ label={t("settings.chat.firstTokenLabel")}+ description={t("settings.chat.firstTokenDescription")}+ >+ <div className="flex flex-col items-end gap-2">+ <div className="flex flex-wrap items-center justify-end gap-2">+ <Select+ value={mode}+ onValueChange={(value) => setMode(value as Mode)}+ disabled={!settings || saving}+ >+ <SelectTrigger+ aria-label={t("settings.chat.firstTokenLabel")}+ className="w-40"+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="default">+ {t("settings.chat.firstTokenDefault")}+ </SelectItem>+ <SelectItem value="custom">+ {t("settings.chat.firstTokenCustom")}+ </SelectItem>+ <SelectItem value="unlimited">+ {t("settings.chat.firstTokenUnlimited")}+ </SelectItem>+ </SelectContent>+ </Select>+ {mode === "custom" ? (+ <Input+ type="number"+ min={1}+ max={settings?.max_minutes ?? 10080}+ step={1}+ value={customMinutes}+ onChange={(event) => setCustomMinutes(event.target.value)}+ aria-label={t("settings.chat.firstTokenMinutes")}+ aria-invalid={!valid}+ disabled={saving}+ className="w-24"+ />+ ) : null}+ <Button+ variant="outline"+ size="sm"+ onClick={() => void save()}+ disabled={+ !settings || saving || !valid || minutes === settings.minutes+ }+ >+ {saving+ ? t("settings.chat.firstTokenSaving")+ : t("settings.chat.firstTokenSave")}+ </Button>+ </div>+ {mode === "custom" ? (+ <p className="text-xs text-muted-foreground">+ {t("settings.chat.firstTokenRange")}+ </p>+ ) : null}+ {error ? (+ <p role="alert" className="text-xs text-destructive">+ {error}+ </p>+ ) : null}+ </div>+ </SettingsRow>+ );+}diff --git a/studio/frontend/src/features/settings/settings-search.ts b/studio/frontend/src/features/settings/settings-search.tsindex 2c4e4d6da4a..f85458f0841 100644--- a/studio/frontend/src/features/settings/settings-search.ts+++ b/studio/frontend/src/features/settings/settings-search.ts@@ -128,6 +128,7 @@ export const SETTINGS_SEARCH_INDEX: Record<SettingsTab, TranslationKey[]> = {"settings.chat.rememberParamsPerModel","settings.chat.autoCompact","settings.chat.toolResultLimit",+ "settings.chat.firstTokenLabel","settings.chat.autoScroll","settings.chat.scrollToBottomButton","settings.chat.replyNotification",@@ -393,6 +394,7 @@ const OWNER_ONLY_ENTRIES: ReadonlySet<TranslationKey> = new Set(["settings.sandbox.terminal","settings.apiKeys.mcp.title","settings.chat.toolResultLimit",+ "settings.chat.firstTokenLabel",]);export function renderedSearchEntries(@@ -431,6 +433,7 @@ export const SETTINGS_SEARCH_KEYWORDS: Partial<"settings.resources.modelMemory.noRamReserve":"settings.resources.modelMemory.modelMemoryKeywords","settings.chat.autoCompact": "settings.chat.autoCompactKeywords",+ "settings.chat.firstTokenLabel": "settings.chat.firstTokenKeywords","settings.chat.toolResultLimit": "settings.chat.toolResultLimitKeywords",// match action verbs omitted from these descriptive labels."settings.chat.thinking.visibility": "settings.chat.visibilityKeywords",diff --git a/studio/frontend/src/features/settings/tabs/chat-tab.tsx b/studio/frontend/src/features/settings/tabs/chat-tab.tsxindex f41afb3fded..9fab7499a88 100644--- a/studio/frontend/src/features/settings/tabs/chat-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/chat-tab.tsx@@ -55,6 +55,7 @@ import {toolResultLimitChoices,updateToolResultLimit,} from "../api/tool-result-limit";+import { FirstTokenTimeoutRow } from "../components/first-token-timeout-row";import { SettingsRow } from "../components/settings-row";import { ComposerSettings } from "../components/composer-settings";import { SettingsSection } from "../components/settings-section";@@ -500,6 +501,7 @@ export function ChatTab() {/></SettingsRow>{isOwner ? <ToolResultLimitRow /> : null}+ {isOwner ? <FirstTokenTimeoutRow /> : null}<SettingsRowlabel={t("settings.chat.autoScroll")}description={t("settings.chat.autoScrollDescription")}diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex 55848f246ae..2a0dca5b8f6 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -2622,6 +2622,18 @@ export const ar = {"تنتقل الأدوار الأقدم إلى أرشيف قابل للبحث عندما تمتلئ نافذة سياق المحادثة.",autoCompactKeywords:"ضغط تلقائي سياق نافذة اقتطاع منزلقة نقطة تحقق هامش أرشيف استرجاع بحث compaction rolling checkpoint headroom archive retrieval rag",+ firstTokenLabel: "حد انتظار أول رمز",+ firstTokenDescription: "المدة التي يمكن لنماذج GGUF المحلية انتظارها دون تقدم في معالجة الطلب قبل أول رمز. يسري على فترات الانتظار الجديدة لجميع الحسابات. مع «غير محدود» يستمر الانتظار حتى توقفه بنفسك.",+ firstTokenDefault: "20 دقيقة (افتراضي)",+ firstTokenCustom: "مخصص",+ firstTokenUnlimited: "غير محدود",+ firstTokenMinutes: "انتظار أول رمز بالدقائق",+ firstTokenRange: "الدقائق (1–10,080)",+ firstTokenSave: "حفظ",+ firstTokenSaving: "جارٍ الحفظ...",+ firstTokenLoadError: "تعذر تحميل حد انتظار أول رمز.",+ firstTokenSaveError: "تعذر حفظ حد انتظار أول رمز.",+ firstTokenKeywords: "مهلة أول رمز معالجة الطلب بطيء معالج طوال الليل غير محدود حد الانتظار timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "طول مخرجات الأدوات",toolResultLimitDescription: "عدد أحرف نتيجة Python أو Terminal أو أداة MCP الواحدة التي يقرأها النموذج. القيمة الافتراضية {count}.",toolResultLimitHint: "تُحفظ مخرجات Python وTerminal الأطول في ملف يمكن للنموذج قراءته على أجزاء. ينطبق الحد الأعلى على النماذج التي تعمل في Unsloth، وتظل نوافذ السياق الصغيرة تحصل على أقل. تحتفظ نماذج API بالقيمة الافتراضية ما لم تخفضها.",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex e9eb2324e11..1411137bb5d 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -2661,6 +2661,18 @@ export const de = {"Ältere Runden wandern in ein durchsuchbares Archiv, wenn ein Chat voll läuft.",autoCompactKeywords:"Komprimierung automatisch Kontext Fenster kürzen gleitend Prüfpunkt Reserve Archiv Abruf Suche compaction rolling checkpoint headroom archive retrieval rag",+ firstTokenLabel: "Wartelimit für das erste Token",+ firstTokenDescription: "Wie lange lokale GGUF-Modelle ohne Fortschritt bei der Prompt-Verarbeitung auf das erste Token warten dürfen. Gilt für neue Wartezeiten aller Konten. Bei „Unbegrenzt“ wird gewartet, bis du stoppst.",+ firstTokenDefault: "20 Min. (Standard)",+ firstTokenCustom: "Benutzerdefiniert",+ firstTokenUnlimited: "Unbegrenzt",+ firstTokenMinutes: "Wartezeit auf das erste Token in Minuten",+ firstTokenRange: "Minuten (1–10.080)",+ firstTokenSave: "Speichern",+ firstTokenSaving: "Wird gespeichert…",+ firstTokenLoadError: "Das Wartelimit für das erste Token konnte nicht geladen werden.",+ firstTokenSaveError: "Das Wartelimit für das erste Token konnte nicht gespeichert werden.",+ firstTokenKeywords: "Zeitüberschreitung erstes Token Prompt-Verarbeitung langsam CPU über Nacht unbegrenzt Wartelimit timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "Länge der Tool-Ausgabe",toolResultLimitDescription: "Zeichen eines Python-, Terminal- oder MCP-Ergebnisses, die das Modell liest. Standard ist {count}.",toolResultLimitHint: "Längere Python- und Terminal-Ausgaben werden in einer Datei gespeichert, die das Modell in Teilen lesen kann. Ein höheres Limit gilt für Modelle, die in Unsloth laufen, und kleine Kontextfenster erhalten weiterhin weniger. API-Modelle behalten den Standard, außer du senkst ihn.",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex fb3bd8e5588..47644d917e1 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -2672,6 +2672,18 @@ export const en = {"Older turns move to a searchable archive when a chat fills its context.",autoCompactKeywords:"compaction compact auto-compact context window truncate rolling checkpoint headroom archive retrieval recall rag search",+ firstTokenLabel: "First-token waiting limit",+ firstTokenDescription: "How long local GGUF models may wait without prompt-processing progress before the first token. Applies to new waits for all accounts. Unlimited keeps waiting until you stop.",+ firstTokenDefault: "20 min (default)",+ firstTokenCustom: "Custom",+ firstTokenUnlimited: "Unlimited",+ firstTokenMinutes: "First-token wait in minutes",+ firstTokenRange: "Minutes (1–10,080)",+ firstTokenSave: "Save",+ firstTokenSaving: "Saving…",+ firstTokenLoadError: "Could not load the first-token waiting limit.",+ firstTokenSaveError: "Could not save the first-token waiting limit.",+ firstTokenKeywords: "timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "Tool output length",toolResultLimitDescription: "Characters of one Python, Terminal or MCP tool result the model reads. Default is {count}.",toolResultLimitHint: "Longer Python and Terminal output is saved to a file the model can read in parts. A higher limit applies to models running in Unsloth, and small context windows still get less. API models keep the default unless you lower it.",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex 57379ba4822..663084f8f6a 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -2652,6 +2652,18 @@ export const es = {"Los turnos antiguos pasan a un archivo consultable al llenarse el contexto de un chat.",autoCompactKeywords:"compactación compactar automáticamente contexto ventana truncar deslizante checkpoint margen archivo recuperación búsqueda compaction rolling headroom archive retrieval rag",+ firstTokenLabel: "Límite de espera del primer token",+ firstTokenDescription: "Cuánto pueden esperar los modelos GGUF locales sin avance en el procesamiento del prompt antes del primer token. Se aplica a las nuevas esperas de todas las cuentas. Con «Sin límite» se espera hasta que lo detengas.",+ firstTokenDefault: "20 min (predeterminado)",+ firstTokenCustom: "Personalizado",+ firstTokenUnlimited: "Sin límite",+ firstTokenMinutes: "Espera del primer token en minutos",+ firstTokenRange: "Minutos (1–10.080)",+ firstTokenSave: "Guardar",+ firstTokenSaving: "Guardando...",+ firstTokenLoadError: "No se pudo cargar el límite de espera del primer token.",+ firstTokenSaveError: "No se pudo guardar el límite de espera del primer token.",+ firstTokenKeywords: "tiempo de espera primer token procesamiento del prompt lento CPU toda la noche sin límite límite de espera timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "Longitud de la salida de herramientas",toolResultLimitDescription: "Caracteres de un resultado de Python, Terminal o herramienta MCP que lee el modelo. El valor predeterminado es {count}.",toolResultLimitHint: "La salida más larga de Python y Terminal se guarda en un archivo que el modelo puede leer por partes. Un límite mayor se aplica a los modelos que se ejecutan en Unsloth, y las ventanas de contexto pequeñas siguen recibiendo menos. Los modelos de API mantienen el valor predeterminado salvo que lo bajes.",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex c749803a058..49beaed6cd8 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -2658,6 +2658,18 @@ export const fr = {"Les anciens échanges vont dans une archive consultable quand un chat sature son contexte.",autoCompactKeywords:"compaction automatique contexte fenêtre tronquer glissante point de contrôle marge archive récupération recherche rolling checkpoint headroom retrieval rag",+ firstTokenLabel: "Limite d’attente du premier jeton",+ firstTokenDescription: "Durée pendant laquelle les modèles GGUF locaux peuvent attendre le premier jeton sans progression du traitement du prompt. S’applique aux nouvelles attentes de tous les comptes. Avec « Illimité », l’attente continue jusqu’à ce que vous arrêtiez.",+ firstTokenDefault: "20 min (par défaut)",+ firstTokenCustom: "Personnalisé",+ firstTokenUnlimited: "Illimité",+ firstTokenMinutes: "Attente du premier jeton en minutes",+ firstTokenRange: "Minutes (1–10 080)",+ firstTokenSave: "Enregistrer",+ firstTokenSaving: "Enregistrement...",+ firstTokenLoadError: "Impossible de charger la limite d’attente du premier jeton.",+ firstTokenSaveError: "Impossible d’enregistrer la limite d’attente du premier jeton.",+ firstTokenKeywords: "délai d’attente premier jeton traitement du prompt lent CPU toute la nuit illimité limite d’attente timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "Longueur de la sortie des outils",toolResultLimitDescription: "Caractères d'un résultat Python, Terminal ou d'outil MCP que le modèle lit. Par défaut : {count}.",toolResultLimitHint: "Une sortie Python ou Terminal plus longue est enregistrée dans un fichier que le modèle peut lire par parties. Une limite plus élevée s'applique aux modèles exécutés dans Unsloth, et les petites fenêtres de contexte reçoivent toujours moins. Les modèles d'API gardent la valeur par défaut sauf si vous la baissez.",diff --git a/studio/frontend/src/i18n/locales/he.ts b/studio/frontend/src/i18n/locales/he.tsindex cb598773c38..06e13a236cf 100644--- a/studio/frontend/src/i18n/locales/he.ts+++ b/studio/frontend/src/i18n/locales/he.ts@@ -2736,6 +2736,18 @@ export const he = {"סבבים ישנים יותר עוברים לארכיון הניתן לחיפוש כאשר צ'אט ממלא את ההקשר שלו.",autoCompactKeywords:"compaction compact auto-compact context window truncate rolling checkpoint headroom archive retrieval recall rag search כיווץ קיצוץ הקשר חלון ארכיון אחזור חיפוש",+ firstTokenLabel: "מגבלת המתנה לטוקן הראשון",+ firstTokenDescription: "כמה זמן מודלי GGUF מקומיים רשאים להמתין ללא התקדמות בעיבוד הפרומפט לפני הטוקן הראשון. חל על המתנות חדשות בכל החשבונות. במצב ״ללא הגבלה״ ההמתנה נמשכת עד שתעצרו.",+ firstTokenDefault: "20 דק׳ (ברירת מחדל)",+ firstTokenCustom: "מותאם אישית",+ firstTokenUnlimited: "ללא הגבלה",+ firstTokenMinutes: "המתנה לטוקן הראשון בדקות",+ firstTokenRange: "דקות (1–10,080)",+ firstTokenSave: "שמירה",+ firstTokenSaving: "שומר...",+ firstTokenLoadError: "לא ניתן היה לטעון את מגבלת ההמתנה לטוקן הראשון.",+ firstTokenSaveError: "לא ניתן היה לשמור את מגבלת ההמתנה לטוקן הראשון.",+ firstTokenKeywords: "פסק זמן טוקן ראשון עיבוד פרומפט איטי מעבד כל הלילה ללא הגבלה מגבלת המתנה timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "אורך פלט הכלים",toolResultLimitDescription: "מספר התווים מתוצאה אחת של Python, Terminal או כלי MCP שהמודל קורא. ברירת המחדל היא {count}.",toolResultLimitHint: "פלט ארוך יותר של Python ו-Terminal נשמר בקובץ שהמודל יכול לקרוא בחלקים. מגבלה גבוהה יותר חלה על מודלים שרצים ב-Unsloth, וחלונות הקשר קטנים עדיין מקבלים פחות. מודלי API נשארים בברירת המחדל אלא אם תוריד אותה.",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex fbd24b87856..f2bf2cd86da 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -2629,6 +2629,18 @@ export const hi = {"चैट का कॉन्टेक्स्ट भरने पर पुराने टर्न खोजे जा सकने वाले आर्काइव में चले जाते हैं।",autoCompactKeywords:"कॉम्पैक्शन कॉम्पैक्ट कॉन्टेक्स्ट विंडो ट्रंकेट स्लाइडिंग चेकपॉइंट हेडरूम आर्काइव पुनर्प्राप्ति खोज compaction rolling checkpoint headroom archive retrieval rag",+ firstTokenLabel: "पहले टोकन की प्रतीक्षा सीमा",+ firstTokenDescription: "पहले टोकन से पहले, प्रॉम्प्ट प्रोसेसिंग में कोई प्रगति न होने पर स्थानीय GGUF मॉडल कितनी देर प्रतीक्षा कर सकते हैं। सभी खातों की नई प्रतीक्षाओं पर लागू होता है। असीमित चुनने पर प्रतीक्षा तब तक चलती है जब तक आप रोक न दें।",+ firstTokenDefault: "20 मिनट (डिफ़ॉल्ट)",+ firstTokenCustom: "कस्टम",+ firstTokenUnlimited: "असीमित",+ firstTokenMinutes: "पहले टोकन की प्रतीक्षा, मिनटों में",+ firstTokenRange: "मिनट (1–10,080)",+ firstTokenSave: "सहेजें",+ firstTokenSaving: "सहेजा जा रहा है...",+ firstTokenLoadError: "पहले टोकन की प्रतीक्षा सीमा लोड नहीं हो सकी।",+ firstTokenSaveError: "पहले टोकन की प्रतीक्षा सीमा सहेजी नहीं जा सकी।",+ firstTokenKeywords: "टाइमआउट पहला टोकन प्रॉम्प्ट प्रोसेसिंग धीमा सीपीयू रात भर असीमित प्रतीक्षा सीमा timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "टूल आउटपुट की लंबाई",toolResultLimitDescription: "Python, Terminal या MCP टूल के एक परिणाम के कितने अक्षर मॉडल पढ़ता है। डिफ़ॉल्ट {count} है।",toolResultLimitHint: "Python और Terminal का लंबा आउटपुट एक फ़ाइल में सहेजा जाता है जिसे मॉडल हिस्सों में पढ़ सकता है। ऊँची सीमा Unsloth में चल रहे मॉडल पर लागू होती है, और छोटी कॉन्टेक्स्ट विंडो को अब भी कम मिलता है। API मॉडल डिफ़ॉल्ट पर रहते हैं, जब तक आप इसे कम न करें।",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex fa9ea9d8caf..eca8608e848 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -2570,6 +2570,18 @@ export const it = {"I turni più vecchi passano in un archivio consultabile quando una chat riempie il contesto.",autoCompactKeywords:"compattazione automatica contesto finestra troncare scorrevole checkpoint margine archivio recupero ricerca compaction rolling headroom archive retrieval rag",+ firstTokenLabel: "Limite di attesa del primo token",+ firstTokenDescription: "Per quanto tempo i modelli GGUF locali possono attendere il primo token senza progressi nell’elaborazione del prompt. Si applica alle nuove attese di tutti gli account. Con «Illimitato» l’attesa continua finché non interrompi.",+ firstTokenDefault: "20 min (predefinito)",+ firstTokenCustom: "Personalizzato",+ firstTokenUnlimited: "Illimitato",+ firstTokenMinutes: "Attesa del primo token in minuti",+ firstTokenRange: "Minuti (1–10.080)",+ firstTokenSave: "Salva",+ firstTokenSaving: "Salvataggio...",+ firstTokenLoadError: "Impossibile caricare il limite di attesa del primo token.",+ firstTokenSaveError: "Impossibile salvare il limite di attesa del primo token.",+ firstTokenKeywords: "timeout primo token elaborazione del prompt lento CPU tutta la notte illimitato limite di attesa timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "Lunghezza dell'output degli strumenti",toolResultLimitDescription: "Caratteri di un risultato Python, Terminale o di uno strumento MCP che il modello legge. Il valore predefinito è {count}.",toolResultLimitHint: "L'output più lungo di Python e Terminale viene salvato in un file che il modello può leggere a parti. Un limite più alto si applica ai modelli eseguiti in Unsloth, e le finestre di contesto piccole ricevono comunque meno. I modelli API mantengono il valore predefinito a meno che tu non lo abbassi.",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex d96463cf2f9..ff75c7ea6de 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -2605,6 +2605,18 @@ export const ja = {"チャットの文脈が満杯になると、古いターンは検索可能なアーカイブに移ります。",autoCompactKeywords:"圧縮 自動圧縮 コンテキスト ウィンドウ 切り詰め スライディング チェックポイント 余裕 アーカイブ 検索 取得 compaction rolling headroom archive retrieval rag",+ firstTokenLabel: "最初のトークンの待機上限",+ firstTokenDescription: "ローカル GGUF モデルが、プロンプト処理の進捗がないまま最初のトークンを待てる時間です。すべてのアカウントの新しい待機に適用されます。「無制限」では停止するまで待ち続けます。",+ firstTokenDefault: "20 分(既定)",+ firstTokenCustom: "カスタム",+ firstTokenUnlimited: "無制限",+ firstTokenMinutes: "最初のトークンの待機時間(分)",+ firstTokenRange: "分(1~10,080)",+ firstTokenSave: "保存",+ firstTokenSaving: "保存中...",+ firstTokenLoadError: "最初のトークンの待機上限を読み込めませんでした。",+ firstTokenSaveError: "最初のトークンの待機上限を保存できませんでした。",+ firstTokenKeywords: "タイムアウト 最初のトークン プロンプト処理 遅い CPU 一晩 無制限 待機上限 timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "ツール出力の長さ",toolResultLimitDescription: "Python、ターミナル、または MCP ツールの結果 1 件のうち、モデルが読む文字数です。既定値は {count} です。",toolResultLimitHint: "これより長い Python とターミナルの出力はファイルに保存され、モデルは分割して読めます。上限を上げると Unsloth で動作するモデルに適用され、コンテキストウィンドウが小さい場合は引き続き少なくなります。API モデルは、下げない限り既定値のままです。",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex 24eeb83d76a..e1145b1a500 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -2615,6 +2615,18 @@ export const ko = {"채팅이 컨텍스트를 모두 채우면 오래된 턴은 검색 가능한 보관소로 옮겨집니다.",autoCompactKeywords:"압축 자동 컨텍스트 윈도우 자르기 슬라이딩 체크포인트 여유 보관 검색 회수 compaction rolling checkpoint headroom archive retrieval rag",+ firstTokenLabel: "첫 토큰 대기 한도",+ firstTokenDescription: "로컬 GGUF 모델이 프롬프트 처리 진행 없이 첫 토큰을 기다릴 수 있는 시간입니다. 모든 계정의 새 대기에 적용됩니다. 무제한은 중지할 때까지 계속 기다립니다.",+ firstTokenDefault: "20분 (기본값)",+ firstTokenCustom: "사용자 지정",+ firstTokenUnlimited: "무제한",+ firstTokenMinutes: "첫 토큰 대기 시간(분)",+ firstTokenRange: "분 (1–10,080)",+ firstTokenSave: "저장",+ firstTokenSaving: "저장 중...",+ firstTokenLoadError: "첫 토큰 대기 한도를 불러올 수 없습니다.",+ firstTokenSaveError: "첫 토큰 대기 한도를 저장할 수 없습니다.",+ firstTokenKeywords: "타임아웃 첫 토큰 프롬프트 처리 느림 CPU 밤새 무제한 대기 한도 timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "도구 출력 길이",toolResultLimitDescription: "모델이 읽는 Python, 터미널 또는 MCP 도구 결과 하나의 문자 수입니다. 기본값은 {count}입니다.",toolResultLimitHint: "더 긴 Python 및 터미널 출력은 모델이 나눠서 읽을 수 있는 파일에 저장됩니다. 더 높은 제한은 Unsloth에서 실행되는 모델에 적용되며, 컨텍스트 창이 작으면 여전히 더 적게 받습니다. API 모델은 낮추지 않는 한 기본값을 유지합니다.",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex 7cf06278a2b..5df0c9c1e78 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -2639,6 +2639,18 @@ export const ptBR = {"Os turnos antigos vão para um arquivo pesquisável quando um chat enche o contexto.",autoCompactKeywords:"compactação compactar automaticamente contexto janela truncar deslizante checkpoint margem arquivo recuperação busca compaction rolling headroom archive retrieval rag",+ firstTokenLabel: "Limite de espera do primeiro token",+ firstTokenDescription: "Por quanto tempo os modelos GGUF locais podem esperar o primeiro token sem progresso no processamento do prompt. Vale para as novas esperas de todas as contas. Com “Ilimitado”, a espera continua até você parar.",+ firstTokenDefault: "20 min (padrão)",+ firstTokenCustom: "Personalizado",+ firstTokenUnlimited: "Ilimitado",+ firstTokenMinutes: "Espera do primeiro token em minutos",+ firstTokenRange: "Minutos (1–10.080)",+ firstTokenSave: "Salvar",+ firstTokenSaving: "Salvando...",+ firstTokenLoadError: "Não foi possível carregar o limite de espera do primeiro token.",+ firstTokenSaveError: "Não foi possível salvar o limite de espera do primeiro token.",+ firstTokenKeywords: "tempo limite primeiro token processamento do prompt lento CPU a noite toda ilimitado limite de espera timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "Tamanho da saída das ferramentas",toolResultLimitDescription: "Caracteres de um resultado de Python, Terminal ou ferramenta MCP que o modelo lê. O padrão é {count}.",toolResultLimitHint: "Saídas mais longas de Python e Terminal são salvas em um arquivo que o modelo pode ler em partes. Um limite maior vale para modelos executados no Unsloth, e janelas de contexto pequenas continuam recebendo menos. Modelos de API mantêm o padrão, a menos que você o reduza.",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex fa92bfdfe2d..7624e08c350 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -2635,6 +2635,18 @@ export const ru = {"Старые ходы уходят в доступный для поиска архив, когда чат заполняет контекст.",autoCompactKeywords:"сжатие автоматически контекст окно обрезка скользящее контрольная точка запас архив поиск извлечение compaction rolling checkpoint headroom archive retrieval rag",+ firstTokenLabel: "Лимит ожидания первого токена",+ firstTokenDescription: "Сколько локальные модели GGUF могут ждать первый токен без прогресса обработки промпта. Применяется к новым ожиданиям для всех учётных записей. В режиме «Без ограничений» ожидание длится, пока вы не остановите его.",+ firstTokenDefault: "20 мин (по умолчанию)",+ firstTokenCustom: "Своё значение",+ firstTokenUnlimited: "Без ограничений",+ firstTokenMinutes: "Ожидание первого токена в минутах",+ firstTokenRange: "Минуты (1–10 080)",+ firstTokenSave: "Сохранить",+ firstTokenSaving: "Сохранение…",+ firstTokenLoadError: "Не удалось загрузить лимит ожидания первого токена.",+ firstTokenSaveError: "Не удалось сохранить лимит ожидания первого токена.",+ firstTokenKeywords: "тайм-аут первый токен обработка промпта медленно процессор всю ночь без ограничений лимит ожидания timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "Длина вывода инструментов",toolResultLimitDescription: "Сколько символов одного результата Python, Терминала или инструмента MCP читает модель. По умолчанию {count}.",toolResultLimitHint: "Более длинный вывод Python и Терминала сохраняется в файл, который модель может читать по частям. Более высокий лимит действует для моделей, запущенных в Unsloth, а маленькие окна контекста по-прежнему получают меньше. API-модели сохраняют значение по умолчанию, если вы его не уменьшите.",diff --git a/studio/frontend/src/i18n/locales/sv.ts b/studio/frontend/src/i18n/locales/sv.tsindex cd4d74b7ff3..fc023cbeded 100644--- a/studio/frontend/src/i18n/locales/sv.ts+++ b/studio/frontend/src/i18n/locales/sv.ts@@ -2819,6 +2819,18 @@ export const sv = {"Äldre turer flyttas till ett sökbart arkiv när en chatt fyller sin kontext.",autoCompactKeywords:"komprimering komprimera autokomprimering kontextfönster trunkera rullande kontrollpunkt marginal arkiv hämtning återkallning rag sök compaction compact auto-compact context window truncate rolling checkpoint headroom archive retrieval recall search",+ firstTokenLabel: "Väntegräns för första token",+ firstTokenDescription: "Hur länge lokala GGUF-modeller får vänta på första token utan framsteg i promptbearbetningen. Gäller nya väntetider för alla konton. Med Obegränsad fortsätter väntan tills du stoppar.",+ firstTokenDefault: "20 min (standard)",+ firstTokenCustom: "Anpassad",+ firstTokenUnlimited: "Obegränsad",+ firstTokenMinutes: "Väntan på första token i minuter",+ firstTokenRange: "Minuter (1–10 080)",+ firstTokenSave: "Spara",+ firstTokenSaving: "Sparar …",+ firstTokenLoadError: "Det gick inte att läsa in väntegränsen för första token.",+ firstTokenSaveError: "Det gick inte att spara väntegränsen för första token.",+ firstTokenKeywords: "tidsgräns första token promptbearbetning långsam CPU över natten obegränsad väntegräns timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "Längd på verktygsutdata",toolResultLimitDescription: "Tecken i ett Python-, Terminal- eller MCP-resultat som modellen läser. Standard är {count}.",toolResultLimitHint: "Längre utdata från Python och Terminal sparas i en fil som modellen kan läsa i delar. En högre gräns gäller modeller som körs i Unsloth, och små kontextfönster får fortfarande mindre. API-modeller behåller standardvärdet om du inte sänker det.",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex 2ae2fca1d06..43132f36eab 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -2582,6 +2582,18 @@ export const zhCN = {"聊天填满上下文时,较早的轮次会转入可检索的归档。",autoCompactKeywords:"压缩 自动压缩 上下文 窗口 截断 滑动 检查点 余量 归档 检索 搜索 compaction rolling checkpoint headroom archive retrieval rag",+ firstTokenLabel: "首个 token 等待上限",+ firstTokenDescription: "本地 GGUF 模型在提示词处理没有进展时,最多可等待首个 token 多久。适用于所有账户的新等待。选择“无限制”会一直等待,直到你手动停止。",+ firstTokenDefault: "20 分钟(默认)",+ firstTokenCustom: "自定义",+ firstTokenUnlimited: "无限制",+ firstTokenMinutes: "首个 token 等待时间(分钟)",+ firstTokenRange: "分钟(1–10,080)",+ firstTokenSave: "保存",+ firstTokenSaving: "保存中...",+ firstTokenLoadError: "无法加载首个 token 等待上限。",+ firstTokenSaveError: "无法保存首个 token 等待上限。",+ firstTokenKeywords: "超时 首个 token 提示词处理 慢 CPU 整夜 无限制 等待上限 timeout first token prefill slow CPU overnight unlimited waiting limit",toolResultLimit: "工具输出长度",toolResultLimitDescription: "模型读取的单个 Python、终端或 MCP 工具结果的字符数。默认值为 {count}。",toolResultLimitHint: "更长的 Python 和终端输出会保存到文件中,模型可以分段读取。更高的上限适用于在 Unsloth 中运行的模型,上下文窗口较小时仍会获得更少的内容。API 模型保持默认值,除非你将其调低。",diff --git a/tests/studio/test_passthrough_prefill_keepalive.py b/tests/studio/test_passthrough_prefill_keepalive.pyindex 6286a14495e..79a6b67813b 100644--- a/tests/studio/test_passthrough_prefill_keepalive.py+++ b/tests/studio/test_passthrough_prefill_keepalive.py@@ -60,6 +60,9 @@ def _load_pump():"_DEFAULT_STREAM_STALL_TIMEOUT_S": 120.0,"_DEFAULT_FIRST_TOKEN_TIMEOUT_S": 1200.0,"_first_token_timeout_s": lambda: 1200.0,+ "start_first_token_wait": lambda seconds: time.monotonic() + seconds,+ "finish_first_token_wait": lambda: None,+ "socket_timeout": lambda seconds: seconds if math.isfinite(seconds) else None,"_TEARDOWN_TASK_STOP_TIMEOUT_S": 5.0,"_set_stream_response_read_timeout": lambda response, read_timeout_s = None: None,"_discard_task_outcome": lambda task: None,@@ -313,6 +316,7 @@ def _load_env_accessors():"os": __import__("os"),"math": math,"_DEFAULT_FIRST_TOKEN_TIMEOUT_S": 1200.0,+ "configured_first_token_timeout_s": lambda: 1200.0,}exec("\n\n".join(chunks), ns)return ns