Skip to content

fix(generation): stabilize model picker teardown - #1618

Merged
wyuc merged 3 commits into
THU-MAIC:mainfrom
LeoParkerOu:codex/fix-1447-model-picker
Sep 20, 2026
Merged

wyuc merged 3 commits into
THU-MAIC:mainfrom
LeoParkerOu:codex/fix-1447-model-picker

Conversation

@LeoParkerOu

Copy link
Copy Markdown
Contributor

Summary

Make the generation toolbar model picker non-modal and close it before applying a model change, avoiding the focus-trap teardown race with nested controls.

Related Issues

Fixes #1447

Changes

  • Configure the toolbar model-picker Popover with modal={false}.
  • Close the model picker before updating the selected provider and model.
  • Add browser regression coverage for click, Enter, and Space selection.
  • Cover nested thinking controls, outside-click dismissal, Escape dismissal, and trigger focus restoration.
  • Repeat the affected interactions to exercise the intermittent teardown path.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Verification

Steps to reproduce / test

  1. Open the generation toolbar model picker.
  2. Select models using click, Enter, and Space, including after switching providers and opening the nested thinking selector.
  3. Verify the picker closes after selection, outside-click dismissal works, Escape restores focus to the trigger, and no page error is raised.

What you personally verified

  • Prettier, ESLint, and tsc --noEmit pass for the changed code.
  • The dedicated Playwright suite passes: 5 tests, including ten-cycle stress coverage of the affected interactions.
  • Click, keyboard selection, nested popup use, outside-click dismissal, and Escape focus restoration were tested locally.
  • The original intermittent Windows 11/WSL2 exception was not reproduced locally; the regression suite exercises the reported focus and teardown paths.

Evidence

  • CI passes (pnpm check && pnpm lint && npx tsc --noEmit)
  • Manually tested locally
  • Screenshots / recordings attached (if UI changes)

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have added/updated documentation as needed
  • My changes do not introduce new warnings

@wyuc wyuc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving — thanks @LeoParkerOu, and for picking this up so quickly. Two-line production change with the right mechanism: no modal focus trap to tear down, and the picker closes before the provider/model update so the nested control isn't unmounting mid-selection. The e2e coverage is what makes modal={false} safe here — outside-click dismissal, Escape, and focus restoration to the trigger are exactly the behaviours that change when the trap goes away, and repeating the interaction exercises the intermittent path.

@wyuc
wyuc merged commit 4488225 into THU-MAIC:main Sep 20, 2026
6 checks passed
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.

[Bug]: removeChild NotFoundError when picking a model from the toolbar model picker

2 participants