Skip to content

Studio: put llama-server warnings and errors in the default session log - #10848

Merged
danielhanchen merged 11 commits into
unslothai:mainfrom
Souravrajvi0:feat/studio-troubleshooting-logs-505b
Oct 2, 2026
Merged

danielhanchen merged 11 commits into
unslothai:mainfrom
Souravrajvi0:feat/studio-troubleshooting-logs-505b

Conversation

@Souravrajvi0

@Souravrajvi0 Souravrajvi0 commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #10793 (partly: the log-level and log-capture gaps).

Problem

After a normal Studio run the session log, which is what users send, holds no llama-server output at all: every forwarded line is DEBUG and only lands in the separate llama-*.log. Failing to open or write that log is reported at DEBUG or not at all, and unsloth studio --verbose does not turn on backend DEBUG.

Changes

  • llama-server records that llama.cpp tags W or E (default, --log-colors and --no-log-timestamps prefixes; error / fail / warn keywords for builds without level letters), plus the I-level readiness line, are logged at INFO in the session log. Everything else stays DEBUG and in the per-attempt file. Unprefixed continuation lines (chat template or request dumps) keep their record's level, so prompt text never reaches INFO on its wording. The same predicate drives the 64 MiB log trim.
  • Session-log writes from the stdout drain are guarded, so a closed stdout cannot stop the drain and stall llama-server.
  • Failing to open the attempt log warns on both spawn paths; a failing tee write warns once per attempt.
  • Each attempt log ends with [studio] attempt end reason=killed|exited exit_code=... (exited when the server had already died), and the close is logged at INFO with the path after the handle is released.
  • The startup line records log level, Studio home, Python version and pid.
  • unsloth studio --verbose also sets LOG_LEVEL=DEBUG.

Collecting the session and llama logs together is already covered by Download all logs (#10719).

Evidence

Real llama.cpp b11317 output through the new predicate: a normal Qwen3-0.6B load at --verbosity 4 is 247 lines, of which 3 reach INFO (two W lines and model loaded). A load of a missing GGUF is 15 lines, of which 11 reach INFO (every E line plus the W line). A --log-verbose run is 4484 lines, of which 4 reach INFO; a prompt containing "model loaded" did not. On a GPU, Studio built from main put 0 llama-server lines in the session log (including a failed first attempt), and Studio built from this branch put the two warnings and model loaded there, with [studio] attempt end reason=killed exit_code=0 closing the attempt log.

Tests

studio/backend/tests/test_llama_server_log_lines.py and a case in test_llama_cpp_atexit_quiet.py; they fail on main and pass here.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Souravrajvi0 and others added 3 commits September 17, 2026 04:25
Promote actionable llama-server lines to INFO, surface log capture failures,
stamp attempt footers with exit codes, bundle recent llama logs in the debug
log API, log startup troubleshooting context, and map --verbose to LOG_LEVEL=DEBUG.
…g bundle

Drop blanket cuda/ggml and llama_/main: prefix promotion so routine
llama_model_loader metadata stays DEBUG; only readiness, build/system_info,
and genuine failure/warning lines reach INFO. Settings > Logs reads
troubleshooting_source_ids and surfaces the support bundle in the picker.
@Souravrajvi0

Copy link
Copy Markdown
Contributor Author

@danielhanchen Addressed the classifier + API wiring feedback:

Stdout classifier (llama_server_log_lines.py) — Removed blanket cuda/ggml and main:/llama_ prefix promotion. On a normal load, routine llama_model_loader: metadata lines (e.g. loaded meta data, n_layers = 32) stay DEBUG — tests assert 0 of three representative loader lines promote to INFO. INFO is now: readiness (server is listening / model loaded), build: / system_info:, and genuine failure/warning text (including loader lines with not found / not loaded). Plain ggml: using CUDA backend-style lines stay DEBUG unless paired with failure markers.

troubleshooting_source_ids — Settings > Logs frontend now reads the field, sorts those sources first in the picker (†), and marks recent llama attempts (+) via is_recent_attempt.

Rebased on current main; pytest tests/test_llama_server_log_lines.py tests/test_debug_log_sources.py — 41 passed.

Resolve conflicts with main and rescope to the logging changes:
- llama-server lines reach the INFO session log when llama.cpp tags them W or E
  (keyword fallback for builds without level letters) or on readiness, sharing
  the predicate the 64 MiB tee trim already used, instead of a keyword list.
- Open failures warn on the primary spawn path too; a failing tee warns once per
  attempt and a closed file no longer warns.
- Drop troubleshooting_source_ids and the picker markers: Download all logs
  (unslothai#10719) already collects the session and llama logs together.
- Fold the startup context into the existing startup line.
@danielhanchen danielhanchen changed the title fix(studio): improve default Studio and llama-server logs for troubleshooting Studio: put llama-server warnings and errors in the default session log Oct 1, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 1, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 1, 2026
An unprefixed line from a levelled build continues a multi-line record (a
chat template or request dump), so readiness or error words inside it no
longer lift user text into the INFO session log.
The close record is written after the handle is released and never raises
out of teardown, and an attempt whose server had already exited is recorded
as reason=exited rather than killed.
…velled warnings

A logger write failing on a closed stdout no longer ends the drain thread,
which would leave llama-server blocked on a full pipe. Builds without level
letters now count warning lines too.
@danielhanchen

Copy link
Copy Markdown
Member

pre-commit.ci run

@danielhanchen
danielhanchen merged commit 8947133 into unslothai:main Oct 2, 2026
10 of 78 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.

Improve default Studio and llama-server logs for troubleshooting

2 participants