Skip to content

Tests: stub servedSelection in the chat eject harness and fail on a body that throws - #19343

Merged
danielhanchen merged 1 commit into
mainfrom
ci/eject-harness-served-selection
Nov 24, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/eject-harness-served-selection

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

tests/studio/test_chat_eject_in_flight.py::test_eject_toasts_before_the_check_and_refuses_a_second_click_as_unloading fails on main since #19169 (load a second quant of a loaded GGUF repo beside it):

AssertionError: assert ['info', 'Wait for the model to finish unloading.'] in [['loading', 'Unloading model'], ['loading', 'Unloading model']]

It passes on the commit before it (5db9913658).

Cause

The test slices the body of ejectModel out of use-chat-model-runtime.ts and runs it in a small harness that stubs the hook's dependencies. #19169 made the eject resolve its target once per click with the module-level servedSelection(), since a second loaded model can now be beside the first. The harness had no servedSelection, so the first click threw a ReferenceError inside the body's try, the catch swallowed it into setModelsError (a no-op stub), and finally released the unload lease. The second click then found nothing unloading and started a second unload, which is what the assertion saw.

The product code is right; the harness lost track of a new dependency, and the swallowed error made it look like a behaviour change.

Fix

Test only:

  • add servedSelection() to the harness, returning the checkpoint the eject targets;
  • have the setModelsError stub record what it is given, and assert it recorded nothing, so the next missing stub fails as the eject body threw inside the harness with the ReferenceError text instead of as a toast mismatch.

Verification

  • The test passes on main with the change (failed on 4739f8c3cc before it).
  • Removing the new servedSelection stub makes it fail with assert ['servedSelection is not defined'] == [].
  • tests/studio in full: 17,148 passed before this change with only this test failing.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T19:44:09.994160Z 028f4e0 Manual request
ℹ️ 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. 👍

Reviewed commit: 028f4e05f2

ℹ️ 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 merged commit bd1ddf2 into main Nov 24, 2026
1 of 17 checks passed
@danielhanchen
danielhanchen deleted the ci/eject-harness-served-selection branch November 24, 2026 19:46
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