Skip to content

Pin the auto-load success toast by its branch, not by one spelling - #8183

Merged
danielhanchen merged 1 commit into
unslothai:mainfrom
danielhanchen:fix/autoload-success-toast-contract
Aug 8, 2026
Merged

danielhanchen merged 1 commit into
unslothai:mainfrom
danielhanchen:fix/autoload-success-toast-contract

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What breaks

main at b0ea23bbf, which already has #8182:

FAILED tests/studio/test_model_picker_contracts.py::test_chat_autoload_toast_is_persistent_and_dismissible
    assert "description: undefined" in auto_load
1 failed, 161 passed

Why

#8050, 738413ab0, gave the auto-load success toast a CPU-fallback description:

-  const showAutoLoadSuccess = (message: string): void => {
+  const showAutoLoadSuccess = (
+    message: string,
+    cpuFallbackReason?: CpuFallbackReason | null,
+  ): void => {
     const options = {
-      description: undefined,
+      description: cpuFallbackReason
+        ? "The auto-selected Vulkan backend crashed during startup, so GPU acceleration is disabled for this model session."
+        : undefined,

The behaviour this contract guards did not change. An ordinary auto-load still shows a success toast with no description. What changed is that the value stopped being written as the literal description: undefined, and the assertion was a substring search for exactly that spelling.

So this is a stale test, not a regression, and the guarded property is still true.

The fix

Slice out showAutoLoadSuccess and assert the branch instead of one spelling of one arm:

assert "description: cpuFallbackReason" in success_toast
assert ": undefined," in success_toast

That keeps both halves pinned: an ordinary auto-load carries no description, and a Vulkan-crash fallback explains itself. It survives the next rewording of the fallback copy, which the old form would not have.

I checked it still discriminates rather than passing on anything: replacing the ternary with an unconditional description: "always something" turns it red and leaves the other 161 green.

Result

262 passed, 1 skipped

for this file plus tests/studio/install/test_install_llama_prebuilt_logic.py. Test-only change; no production file is touched, so nothing moves at runtime on any platform or in any browser.

Worth noting alongside #8182: both reds were a source-grep contract test left behind by a legitimate refactor in another PR. That is now three in a row, so the pattern is worth watching.

unslothai#8050 gave showAutoLoadSuccess a CPU-fallback description, so the literal
`description: undefined` this asserted became a ternary and the contract went red
on main while the behaviour it guards was unchanged.

Assert the branch and its undefined arm instead: an ordinary auto-load still
carries no description, and a Vulkan-crash fallback still explains itself.

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

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

success_toast = auto_load.split("const showAutoLoadSuccess", 1)[1]
success_toast = success_toast.split("};", 1)[0]
assert "description: cpuFallbackReason" in success_toast
assert ": undefined," in success_toast

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 Tie the undefined assertion to the description branch

This substring already matches icon: undefined, later in the sliced options object, so changing the description's false arm to a non-undefined value would leave both new assertions passing. The test therefore does not enforce its stated ordinary-path invariant; match the complete description ternary or otherwise scope undefined to that property.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit 502ec25 into unslothai:main Aug 8, 2026
7 of 24 checks passed
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 502ec259fe

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

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