Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

The onConfigChanged subscription handler was dropping notifications when no listener was actively waiting for them. This caused provider settings updates to not propagate reliably until window reload.

Root Cause

The async generator pattern in the subscription was:

  1. Registering a callback with providerService
  2. Entering a wait state (promise pending)
  3. Callback fires and resolves the promise
  4. Yield to subscriber

Bug: If the callback fired before step 2 (before entering wait state), the notification was silently dropped because resolveNext was null.

Fix

Added a pendingNotification flag that queues notifications arriving before the listener enters its waiting state. When the iterator loops, it checks this flag first and yields immediately if a notification is pending.

Generated with mux

@ammar-agent ammar-agent force-pushed the provider-settings-g2vh branch from 9dae7f4 to 324aa9c Compare December 10, 2025 16:02
The onConfigChanged subscription handler was dropping notifications
when no listener was actively waiting for them. This caused provider
settings updates to not propagate reliably until window reload.

The fix adds a pendingNotification flag to queue notifications that
arrive before the iterator enters its waiting state, ensuring all
config changes are delivered to subscribers.

_Generated with mux_
Verifies that provider settings updates propagate to the UI
without requiring a window reload. The test:
1. Opens settings and sets an OpenAI API key
2. Verifies the masked value appears
3. Closes and reopens settings
4. Confirms the key is still shown as set

_Generated with mux_
@ammar-agent ammar-agent force-pushed the provider-settings-g2vh branch from 324aa9c to 4e43cb5 Compare December 10, 2025 16:09
@ammario ammario merged commit f3a5890 into main Dec 10, 2025
20 checks passed
@ammario ammario deleted the provider-settings-g2vh branch December 10, 2025 16: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.

2 participants