Skip to content

fix: wait for model catalog before opening picker#1747

Merged
1 commit merged intonesquena:masterfrom
Michaelyklam:fix/codex-model-picker-ready-rerender
May 6, 2026
Merged

fix: wait for model catalog before opening picker#1747
1 commit merged intonesquena:masterfrom
Michaelyklam:fix/codex-model-picker-ready-rerender

Conversation

@Michaelyklam
Copy link
Copy Markdown
Contributor

Thinking Path

  • The bottom model picker is backed by a hidden native <select> plus a visible custom dropdown.
  • /api/models can correctly return OpenAI Codex models while the visible dropdown still renders the static HTML fallback if it opens before async model hydration finishes.
  • The fix should preserve non-blocking page boot, but prevent the visible picker from rendering stale options.
  • The safest narrow change is to await the already-exposed window._modelDropdownReady before first render, and re-render if hydration completes while the picker is already open.

What Changed

  • Makes toggleModelDropdown() async and waits for window._modelDropdownReady before calling renderModelDropdown().
  • Re-renders the visible custom dropdown after populateModelDropdown() replaces the hidden <select> when the picker is already open.
  • Adds regression coverage for the [bug] Model picker can show stale static options and hide Codex models on fast open #1743 race.
  • Updates an existing source-boundary regression to accept the now-async toggle function.

Why It Matters

  • Fixes a race where fast-open users could see stale static OpenAI/Anthropic/Other options and miss the configured OpenAI Codex models.
  • Keeps backend/catalog behavior unchanged; this is strictly a frontend synchronization fix.

Fixes #1743.

Verification

  • RED: tests/test_issue1743_model_picker_race.py failed before implementation with missing async wait/re-render assertions.
  • Targeted: /home/michael/.hermes/hermes-agent/venv/bin/python -m pytest tests/test_issue1743_model_picker_race.py tests/test_ollama_model_chip_label_regression.py tests/test_byok_model_dropdown.py tests/test_model_picker_badges.py tests/test_issue1567_nous_picker_capacity_and_symmetry.py -q48 passed in 11.33s
  • Full suite: env -u HERMES_CONFIG_PATH -u HERMES_WEBUI_HOST /home/michael/.hermes/hermes-agent/venv/bin/python -m pytest tests/ -q4598 passed, 2 skipped, 3 xpassed, 1 warning, 8 subtests passed in 382.74s
  • git diff --check passed.
  • Browser QA on an isolated local WebUI server:
    • Confirmed toggleModelDropdown() waits on a delayed window._modelDropdownReady before opening.
    • Confirmed a delayed catalog update renders OpenAI Codex rows instead of the stale static fallback.
    • Confirmed the hydrated dropdown includes Configured, Gemini, OpenAI Codex, and OpenRouter groups with Codex rows such as GPT 5.5, GPT 5.4, GPT 5.3 Codex, and GPT 5.3 Codex Spark.

Risks / Follow-ups

  • Waiting for window._modelDropdownReady can delay first dropdown open by the /api/models request duration, but avoids showing an incorrect catalog. If /api/models fails, the existing promise catches and the static fallback remains available.
  • No backend model catalog behavior is changed.
  • No screenshots included because this is an interaction/timing race with no persistent visual redesign; browser QA was DOM/behavior verified on an isolated server.

Model Used

  • OpenAI Codex / gpt-5.5
  • Tool use: file inspection, pytest, isolated local WebUI browser QA, git/GitHub CLI.

@nesquena-hermes nesquena-hermes closed this pull request by merging all changes into nesquena:master in 9900248 May 6, 2026
pull Bot pushed a commit to soitun/hermes-webui that referenced this pull request May 6, 2026
pull Bot pushed a commit to soitun/hermes-webui that referenced this pull request May 6, 2026
…-color meta, quote-strip) + test-isolation hardening (nesquena#1746 deferred)

Constituent PRs:
- nesquena#1747 (@Michaelyklam) — wait for model catalog before opening picker (closes nesquena#1743)
- nesquena#1748 (@nesquena-hermes) — theme-color meta tag for native chrome bridges (nesquena APPROVED)
- nesquena#1750 (@nesquena-hermes) — strip surrounding quotes from Add Space path (nesquena APPROVED)

Deferred to v0.51.12:
- nesquena#1746 — Opus caught multiprocessing.Queue deadlock pattern (parent
  process.join() before queue drain hangs on output >64KB pipe buffer).
  Deferral comment with two specific fix options posted on PR.

Plus 1 in-stage absorbed test-isolation fix:
- test_issue1426 + test_issue1680: skip on detected prefix pollution
  (prong 2 of test-isolation-flake-recipe). Failure rate ~25% in full
  suite from sys.modules pollution; standalone always passes.

Tests: 4596 → 4622 passing (+26). 0 regressions. Stably green.

Pre-release verification:
- 3 PRs CI-green individually + rebased onto master
- pytest 4622 passed, 0 failed
- node -c clean on static/ui.js + static/boot.js
- 11/11 browser API endpoints PASS
- Opus advisor: SHIP nesquena#1747/nesquena#1748/nesquena#1750, MUST-FIX block on nesquena#1746

Closes nesquena#1743.
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] Model picker can show stale static options and hide Codex models on fast open

2 participants