Skip to content

fix: resolve 5 bugs preventing provider icons from appearing in Open WebUI#4

Merged
sena-labs merged 1 commit into
mainfrom
claude/magical-mccarthy-9fed0e
May 7, 2026
Merged

fix: resolve 5 bugs preventing provider icons from appearing in Open WebUI#4
sena-labs merged 1 commit into
mainfrom
claude/magical-mccarthy-9fed0e

Conversation

@sena-labs
Copy link
Copy Markdown
Owner

Summary

  • Bug 1 (Critical): if existing_icon: continue in _sync_model_icons() treated OWUI's default data: SVG icon (assigned to all manifold models on load) as a user-set custom icon, preventing provider icons from ever being applied after the first pipe load. Fixed via new _is_owui_managed_icon() helper that correctly distinguishes OWUI-managed URLs (data: and openrouter.ai/images/models/) from genuine user customisations.

  • Bug 2 (Critical): _sync_model_icons() ran before pipes() returned, meaning OWUI had not yet inserted the models into its DB. OWUI then inserted them with its own default icon, overwriting any early record. Fixed by also calling _sync_model_icons() on cache-hit paths until all models are confirmed synced — the second call arrives after OWUI has registered the models.

  • Bug 3: DB exceptions added the model to _icons_synced anyway, permanently blocking retry. Removed the erroneous add from the except block.

  • Bug 4: After insert_new_model the model was marked as synced even though OWUI could overwrite it immediately after pipes() returned. Icon confirmation now requires a successful update_model_by_id.

  • Bug 5: update_model_by_id passed an empty ModelParams(), erasing user-configured temperature/system-prompt/etc. The update now preserves existing.params.

  • Optimisation: function_id is cached in __init__ (self._function_id) instead of re-evaluating type(self).__module__ on every _sync_model_icons() call.

Test plan

  • Updated tests 25e/25f/25g to match new semantics (_function_id set directly, _icons_synced not updated after insert)
  • Added test 25h: model in DB with OWUI default data: icon → update_model_by_id is called and model added to _icons_synced
  • Added test 25i: unit tests for _is_owui_managed_icon() helper
  • All 262 tests pass (python test_pipe.py)
  • End-to-end: after deploying to Open WebUI, models from OpenAI/Anthropic/Google/Meta/etc. should show their provider icons in the model selector from the second pipes() call onwards (i.e. within seconds of page load)

🤖 Generated with Claude Code

…WebUI

_sync_model_icons() was silently failing to set provider icons due to a
chain of five bugs:

1. Wrong skip condition: `if existing_icon: continue` treated OWUI's
   default data: SVG icon (assigned to all manifold models on load) as a
   user-set custom icon, so provider icons were never applied after the
   first pipe load.  Fixed via new _is_owui_managed_icon() helper that
   distinguishes OWUI/our URLs from genuine user customisations.

2. Race condition: _sync_model_icons() ran before pipes() returned,
   meaning OWUI had not yet inserted the models into its DB.  OWUI then
   inserted them with its default icon, overwriting any early record.
   Fixed by also calling _sync_model_icons() on cache-hit paths until all
   models are confirmed synced (second call arrives after OWUI registration).

3. Exception handler blocked retry: DB errors added the model_id to
   _icons_synced anyway, permanently preventing retry.  Removed the
   erroneous add.

4. Insert prematurely marked synced: after insert_new_model the model was
   added to _icons_synced even though OWUI could overwrite it immediately
   after.  Icon confirmation now requires a successful update_model_by_id.

5. User params clobbered: update_model_by_id passed an empty ModelParams(),
   erasing user-configured temperature/system-prompt/etc.  The update now
   preserves existing.params.

Also caches function_id in __init__ (was re-evaluated on every call).

Tests: updated 25e/25f/25g for new semantics; added 25h (update path when
OWUI default icon present) and 25i (_is_owui_managed_icon unit tests).
All 262 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 7, 2026 07:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes multiple issues that prevented Open WebUI from displaying provider icons for models exposed by this OpenRouter manifold pipe by making icon-sync behavior correctly handle OWUI defaults, race timing, and parameter preservation.

Changes:

  • Add _is_owui_managed_icon() to distinguish OWUI/default and pipe-managed icon URLs from user-custom icons.
  • Adjust _sync_model_icons() to preserve existing model params on updates, avoid marking models synced after inserts/errors, and cache function_id at init.
  • Update unit tests and changelog to reflect the corrected sync semantics and new helper behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
openrouter_pipe.py Implements improved provider icon sync logic, adds OWUI-managed-icon detection, and sync-on-cache-hit behavior to address OWUI timing.
test_pipe.py Updates and extends unit tests for the new icon sync semantics and helper.
CHANGELOG.md Documents the icon-sync fixes and the new helper/behavior changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread openrouter_pipe.py
Comment thread openrouter_pipe.py
@sena-labs sena-labs merged commit a63a796 into main May 7, 2026
8 checks passed
@sena-labs sena-labs deleted the claude/magical-mccarthy-9fed0e branch May 7, 2026 08:24
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.

2 participants