fix: resolve 5 bugs preventing provider icons from appearing in Open WebUI#4
Merged
Merged
Conversation
…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>
There was a problem hiding this comment.
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 cachefunction_idat 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bug 1 (Critical):
if existing_icon: continuein_sync_model_icons()treated OWUI's defaultdata: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:andopenrouter.ai/images/models/) from genuine user customisations.Bug 2 (Critical):
_sync_model_icons()ran beforepipes()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_syncedanyway, permanently blocking retry. Removed the erroneous add from theexceptblock.Bug 4: After
insert_new_modelthe model was marked as synced even though OWUI could overwrite it immediately afterpipes()returned. Icon confirmation now requires a successfulupdate_model_by_id.Bug 5:
update_model_by_idpassed an emptyModelParams(), erasing user-configured temperature/system-prompt/etc. The update now preservesexisting.params.Optimisation:
function_idis cached in__init__(self._function_id) instead of re-evaluatingtype(self).__module__on every_sync_model_icons()call.Test plan
_function_idset directly,_icons_syncednot updated after insert)data:icon →update_model_by_idis called and model added to_icons_synced_is_owui_managed_icon()helperpython test_pipe.py)pipes()call onwards (i.e. within seconds of page load)🤖 Generated with Claude Code