Skip to content

Add per-attempt logs for managed vLLM - #19167

Merged
danielhanchen merged 14 commits into
unslothai:mainfrom
Imagineer99:feat/managed-vllm-logs
Nov 24, 2026
Merged

danielhanchen merged 14 commits into
unslothai:mainfrom
Imagineer99:feat/managed-vllm-logs

Conversation

@Imagineer99

@Imagineer99 Imagineer99 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Depends on #19166. Review the five-file vLLM diff. Both PRs target upstream main, so GitHub also shows the shared SGLang changes here until the dependency lands. If #19166 is squash-merged, this branch will need a rebase.

Enable per-attempt logging for managed vLLM using the shared capture and Settings viewer. Each process launch gets its own redacted log, including automatic retries for Mamba limits and drafter compatibility. A failure's View logs action keeps pointing to the corresponding attempt after a retry.

Verification

29 backend checks passed and two were skipped. All 74 frontend checks and frontend type checking passed. Real vLLM runs exercised startup failure, successful retry, exact failed-log lookup, and unload on Windows using the private WSL guest and with Unsloth running inside WSL. macOS and AMD checks were simulated. Bare-metal Linux was not exercised.

Screenshots

Settings > Logs, with two SGLang and two vLLM attempt logs placed in the Studio home. Before (merge base), the picker lists only the server log. After, it groups the SGLang and vLLM attempts under their own headings.

Settings Logs picker before and after

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T14:19:07.662730Z
We couldn’t complete this review. Comment @codex review to try again.
e3129f6 Draft marked ready
ℹ️ 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 7776e83f1a

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

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 24, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: bde65da583

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

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: e3129f6232

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

@danielhanchen
danielhanchen marked this pull request as ready for review November 24, 2026 14:18
@danielhanchen
danielhanchen self-requested a review as a code owner November 24, 2026 14:18
@danielhanchen
danielhanchen merged commit 494da19 into unslothai:main Nov 24, 2026
1 check passed
danielhanchen added a commit that referenced this pull request Nov 24, 2026
…9278)

## Problem


`studio/backend/tests/test_log_bounds.py::TestFamiliesAreBounded::test_a_new_family_cannot_be_added_unnoticed`
fails on main in the backend `(Python 3.13, g-l)` shard:

```
AssertionError: new log families:
    vllm
```

## Cause

#19167 (per-attempt logs for managed vLLM) added `"vllm": ("logs/vllm",
"vllm-*.log")` to `MANAGED_ENGINE_LOG_FAMILIES` while #19276 was adding
the review gate for those families. Both merged, so the gate reports the
new family as unreviewed. That is what the gate is for: a new log family
is a decision about disk growth.

## Review

The family is bounded. #19167 writes vLLM attempt logs through
`ManagedEngineLog.open`, which prunes the family's glob after opening
each file. `test_a_managed_engine_log_prunes_its_family_on_open[vllm]`
(added in #19276, parametrised over `MANAGED_ENGINE_LOG_FAMILIES`) runs
that path:

- it fills a temp studio home with `DEFAULT_KEEP + 5` old `vllm-*.log`
files and opens a new one;
- it checks that exactly `DEFAULT_KEEP` remain, that the new one is
kept, and that the oldest is gone.

It passes.

## Fix

Add `vllm` to the reviewed list in
`test_a_new_family_cannot_be_added_unnoticed`.

## Verification

- `test_log_bounds.py`: 7 passed. The cases include
`test_a_managed_engine_log_prunes_its_family_on_open[sglang]` and
`[vllm]`.
- On main, `test_a_new_family_cannot_be_added_unnoticed` fails with the
error above.
danielhanchen added a commit that referenced this pull request Nov 24, 2026
#19296)

## Problem

`studio/backend/tests/test_managed_engine_readiness_poll.py` fails on
main (6 of 9 tests) and on every PR based on it, for example #19284 and
#19285, which do not touch Studio:

```
>   child_env["WSL_UTF8"] = "1"
E   TypeError: 'NoneType' object does not support item assignment
```

## Cause

Two PRs merged within an hour of each other, each green on its own base:

- #19167 added `vllm` to `MANAGED_ENGINE_LOG_FAMILIES`, so a vLLM start
now captures logs and, on the WSL path, sets `child_env["WSL_UTF8"] =
"1"` on the environment `_wsl_command` returns (the SGLang half of this
came in #19166).
- #19242 added this test file. Its `_wsl_command` stub returned
`(command, None)`, and its base predated #19167, so vLLM did not capture
logs there and the `None` was never touched.

The code is right: the real `_wsl_command` always returns
`wsl_host.guest_command(...)`, whose second element is the `wsl.exe`
environment dict, and `test_managed_engine_logs.py` already stubs it
with `dict(os.environ)`. The stub was the part that did not match the
contract.

## Fix

- The stub returns `dict(os.environ)`, the same shape the real launcher
hands back.
- The fixture sets `UNSLOTH_STUDIO_HOME` to `tmp_path`, since the vLLM
start now opens a per-attempt log under the Studio home and the tests
should not write into the real one.

No product code changes.

## Verification

- `tests/test_managed_engine_readiness_poll.py`: 9 passed (6 failed on
main before the change).
- Reverting only the stub's return value back to `None` brings back the
same 6 failures.
- `test_managed_engine_logs.py`, `test_engine_ports.py` and this file
together: 50 passed; this file under `-n 4`, 3 repeats: 27 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.

2 participants