Skip to content

Let the AppImage E2E use the Retry the failed quant row offers - #10032

Merged
danielhanchen merged 2 commits into
mainfrom
fix/appimage-e2e-retry-variant-listing
Aug 31, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix/appimage-e2e-retry-variant-listing

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What is red

AppImage model download E2E, in Desktop app clean machine, has failed on roughly three runs in four since 2026-08-28, on unrelated branches, as a hard gate on every PR. Two adjacent runs on the same branch, one pass and one fail, so it is a race rather than a break.

AssertionError: Timed out waiting for the Q4_K_M quantization; last result: False

What it is not

From the failing run's own artifact, Studio is healthy:

  • app started, managed preflight reported ManagedReady, backend validated on port 8888, desktop auth exchanged
  • the fixture kept answering /api/health for another 49 seconds after the point of failure
  • the screenshot shows the Images page loaded and the model picker open and fully populated

So this is not a launch failure, not auth, and not the AppImage.

What actually fails

One row. The captured DOM has Unsloth isn't running -- please relaunch it. rendered inside the FLUX.2-klein-4B row, exactly where its quantizations belong, and no Q4_K_M anywhere.

That string comes from asTransportFailure in features/auth/api.ts, which tags a fetch TypeError -- the request never completed at the transport layer. The fixture records every GET before dispatch and no gguf-variants request appears, so it never left the webview. The fixture does implement /api/models/gguf-variants, so a missing route is not the cause either.

Waiting longer cannot help. The expander's effect is keyed on [repoId, localSource, refreshKey, hfToken], and its .catch() calls setError and stops. There is no automatic retry, by design; the row renders a Retry button instead. One blip when the row expands leaves that row showing an error for the rest of the run, and the 15s wait sits on a row where nothing is in flight.

The change

The test clicks the Retry the row is already offering, up to three times. That is what a user does, and it uses the product's own affordance rather than working around it. It stays honest in both directions:

  • it retries only when a listing error is actually on screen; a quantization that is simply absent still fails on the first wait, with the original message
  • if the retries run out it fails and quotes what the row reported, so a backend that really is unreachable is still a red run

Verification

Selectors were run over the real captured failure DOM from run 33338397183: they match exactly one element, the destructive row carrying both the message and the Retry button, with Q4_K_M genuinely absent.

The helper is covered offline in four scenarios, 5/5:

scenario expected result
listing error clears after Retry pass pass
listing error never clears fail, quoting the row fail, quoting the row
no listing error, quant absent fail on first wait, no Retry click fail, 0 clicks
quant present pass untouched pass

py_compile, verify_import_hoist, lint_exec_literals, lint_no_parallel_clamp clean; tests/studio -k appimage passes.

Not fixed here

A user who hits that blip sees a dead row until they press Retry themselves. That may well be the intended trade-off, but the sticky state is what makes this gate flaky. I could not reproduce the underlying transport failure on this machine, so I am not claiming to know why the fetch fails -- only where it fails, that it never reaches the socket, and that nothing retries it.

`AppImage model download E2E` has failed on roughly three runs in four since
2026-08-28, on unrelated branches, as a hard gate on every PR. Two adjacent runs
on the same branch, one pass and one fail, so it is a race rather than a break.

What the evidence from the failing run shows, and what it rules out. Studio is up:
the app started, the managed preflight reported ManagedReady, the backend was
validated on port 8888, desktop auth was exchanged, and the fixture kept answering
/api/health for another 49 seconds after the point of failure. The screenshot
shows the Images page loaded and the model picker open and populated. So this is
not a launch failure, not auth, and not the AppImage.

What actually fails is one row. The captured DOM has "Unsloth isn't running --
please relaunch it." rendered inside the FLUX.2-klein-4B row, exactly where its
quantizations belong, and no Q4_K_M anywhere. That string comes from
asTransportFailure in features/auth/api.ts, which tags a fetch TypeError, so the
request never completed at the transport layer. The fixture records every GET
before dispatch and no gguf-variants request appears, so it never left the webview
-- and the fixture does implement that endpoint, so a missing route is not it.

Waiting longer cannot help. The expander's effect is keyed on
[repoId, localSource, refreshKey, hfToken] and its .catch() calls setError and
stops. There is no automatic retry by design; the row renders a Retry button
instead. One blip at the moment the row expands therefore leaves that row showing
an error for the rest of the run, and the 15s wait sits on a row where nothing is
in flight.

So the test now clicks the Retry the row is offering, up to three times. That is
what a user does, and it uses the product's own affordance rather than working
around it. It stays honest in both directions:

  - it only retries when a listing error is actually on screen; a quantization
    that is simply absent still fails on the first wait, with the original message
  - if the retries run out, it fails and quotes what the row reported, so a
    backend that really is unreachable is still a red run

Verified against the real artifact: the selectors were run over the captured
failure DOM from run 33338397183 and match exactly one element, the destructive
row carrying both the message and the Retry button, with Q4_K_M genuinely absent.
The helper itself is covered offline in four scenarios, 5/5: recovers when Retry
clears it, fails naming the row's message when it never clears, does not click
Retry when there is no error, and passes untouched when the quant is there.

Not fixed here, and worth a look separately: a user who hits that blip sees a
dead row until they press Retry themselves. That may well be the intended
trade-off, but the sticky state is what makes this gate flaky, and I could not
reproduce the underlying transport failure on this machine to say more.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-31T01:31:49.916717Z fb3d298 New commits
ℹ️ 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.

The retry added in the previous commit did its job and disproved its own premise.
It fired three times, 33 seconds apart, and each attempt failed identically:

  [appimage-e2e] quant listing failed (attempt 1/3): "Unsloth isn't running..."
  [appimage-e2e] quant listing failed (attempt 2/3): "Unsloth isn't running..."
  [appimage-e2e] quant listing failed (attempt 3/3): "Unsloth isn't running..."

So this was never a transient blip. It is deterministic, and the cause is a CORS
preflight the fixture rejects.

#8879 (2026-08-28 12:01 UTC) started attaching X-Unsloth-Timezone and
X-Unsloth-Timezone-Offset-Minutes to every authFetch. The fixture answered
preflights with a hand-written "Authorization, Content-Type, X-HF-Token", so the
browser refuses to send those two, the request never reaches the socket, fetch
rejects with a TypeError, asTransportFailure turns that into "Unsloth isn't
running -- please relaunch it.", and the row renders it where its quantizations
belong. /api/health keeps answering throughout because it is not an authFetch and
needs no preflight, which is why the app looks perfectly healthy in the artifact.
The failures start the same day. Nothing else moved.

#8879 is right and the real backend already allows this: studio/backend/main.py
runs CORSMiddleware with allow_headers = ["*"]. The fixture's fixed list was never
the product's behaviour, only a second copy of it, and a second copy is the bug --
it can only drift, and it did.

So the preflight echoes Access-Control-Request-Headers, which is what ["*"] means
in practice and cannot drift again. Preflights are also recorded now: a rejected
one sends no request, so the log showed nothing at all and the failure read as
"the frontend never tried".

Reproduced before fixing. Driving a real OPTIONS through http.server with the
exact headers an authFetch sends, and reading the header names out of the frontend
source rather than restating them:

  main (hardcoded list)  Allow-Headers: authorization, content-type, x-hf-token
                         missing: x-unsloth-timezone,
                                  x-unsloth-timezone-offset-minutes
                         => browser blocks -> fetch TypeError
  this change (echo)     missing: none => allowed

tests/studio/test_appimage_fixture_cors.py keeps it that way, 6 tests: the echo
admits everything the frontend sends; the old list is still detected as broken;
the fixture must echo rather than name headers (mutation-checked -- restoring the
hardcoded list fails it); the backend still allows every header, since that
premise is what makes echoing faithful; and casing does not matter.

The Retry handling from the previous commit stays. It is what turned an opaque
15-second timeout into the three-line log above, and it still reports what the row
said when the retries run out.

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

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

Comment on lines +96 to +99
assert blocked_headers(allowed) == [
"X-Unsloth-Timezone",
"X-Unsloth-Timezone-Offset-Minutes",
], allowed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Let the historical check tolerate new request headers

When auth/api.ts adds another X-Unsloth-* request header—the exact evolution this test is meant to accommodate—frontend_request_headers() includes it and the historical three-header allowlist blocks it, so blocked_headers() returns that new name in addition to these two and this exact equality fails even though the echoing fixture remains correct. Assert that these historical headers are present in the blocked set rather than requiring them to be the exhaustive list.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit 5f82b87 into main Aug 31, 2026
37 checks passed
@danielhanchen
danielhanchen deleted the fix/appimage-e2e-retry-variant-listing branch August 31, 2026 02:37
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.

1 participant