Repository navigation
Wait for the model load before reading the unsloth run banner - #11679
Conversation
unsloth run answers /api/health before it loads the model and prints its banner, API key included, only once the load finishes. serve-unsloth-run.sh gave the banner 30 one-second polls after health, which a 4.8 GB GGUF on a busy CPU runner outlasted, and the connection leg reported a banner-parse regression while the model was still loading. Poll until the key appears, the server exits, or --banner-timeout (300, like --health-timeout) runs out, and say which of the three it was.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 107cc0eb18
ℹ️ 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".
| # Counts a call and returns: the script's `sleep 1` becomes one poll. | ||
| STANDIN_SLEEP = '#!/bin/sh\nprintf x >> "$SLEEP_COUNTER"\nexec /bin/sleep 0.01\n' |
There was a problem hiding this comment.
Start counting banner polls only after health succeeds
When the Python stand-in takes at least ten mocked sleeps to bind on a busy runner, this shared counter has already advanced before /api/health succeeds, so banner_after = 40 leaves no more than the old 30 banner polls and the pre-change script can pass this regression test. The same coupling can make the -5 case exit before health and produce the wrong diagnostic. Reset or separately track the counter once health is observed so these tests measure the banner-wait phase they intend to exercise.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e851200: the stand-in records the poll count when it first answers /api/health and delays the banner (or its exit) from there, and the reported polls exclude startup. The slow-load case now also holds health back for 15 polls, which is the scenario described: main's script still fails it, and the branch passes.
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! 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". |
…hai#11679) * Wait for the model load before reading the unsloth run banner unsloth run answers /api/health before it loads the model and prints its banner, API key included, only once the load finishes. serve-unsloth-run.sh gave the banner 30 one-second polls after health, which a 4.8 GB GGUF on a busy CPU runner outlasted, and the connection leg reported a banner-parse regression while the model was still loading. Poll until the key appears, the server exits, or --banner-timeout (300, like --health-timeout) runs out, and say which of the three it was. * Count the stand-in's banner polls from its first health answer
connection (opencode, stable)failed on #11603 with:The banner had not changed. The server log shows it had not been printed yet:
Cause
unsloth runanswers/api/healthbefore it loads the model. It prints the banner, includingAPI Key:, only when the load finishes. After health,serve-unsloth-run.shgave the banner 30 one-second polls. That is usually enough: on the same base, #11666's opencode leg read the key 10s after health. Here the 4.8 GB GGUF took longer on a busy CPU runner, and the script reported a banner regression while the model was still loading.It is rare. I checked the last 40 failed runs of this workflow and found this one occurrence. Every leg on every PR goes through this script, though, and the error sends whoever reads it to
studio.pyfor a bug that is not there.The product is right and the script was wrong: a fixed 30s window was standing in for "until the load finishes".
Change
.github/scripts/serve-unsloth-run.shnow waits for the banner as long as the load is actually going:sk-unsloth-key appears, up to--banner-timeout. The default is 300, the same as--health-timeout.API Key:line without ansk-unsloth-token still goes to the existing fallback. If that finds nothing, it gives the original banner-parse message.The script is shellcheck clean.
Test
tests/studio/test_serve_unsloth_run_waits_for_the_load.pyruns the real script against stand-inunslothandsleepcommands on PATH:unslothstand-in is a small HTTP server that is healthy at once and holds its banner back for a set number of polls.sleepstand-in counts its calls, so one call is one of the script's one-second polls. That makes the test deterministic and under 2 seconds.It has two cases:
/v1/models.Sabotage: against main's script, both cases fail. The first fails with the same
could not parse an API key from the bannerthat CI showed.