fix: watch providers.jsonc for external edits so UI refreshes without restart#3233
Open
Neppkun wants to merge 1 commit intocoder:mainfrom
Open
fix: watch providers.jsonc for external edits so UI refreshes without restart#3233Neppkun wants to merge 1 commit intocoder:mainfrom
Neppkun wants to merge 1 commit intocoder:mainfrom
Conversation
…ut restart Manual edits to ~/.mux/providers.jsonc were silently ignored by the frontend because notifyConfigChanged() was only called after API mutations. Added watchProvidersFile() to Config (fs.watch on the mux home directory, debounced 300ms) and wired it into ProviderService's constructor so external file changes propagate to all onConfigChanged subscribers automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
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
~/.mux/providers.jsoncnever appeared in the UI becausenotifyConfigChanged()was only called after API mutations, not on external file changesConfig.watchProvidersFile()— watches the mux home directory withfs.watch, debounced 300 ms, returns a cleanup fnProviderServiceconstructor so any external edit toproviders.jsoncimmediately propagates to allonConfigChangedfrontend subscribersRoot cause
ProviderService.list()andgetConfig()already readproviders.jsoncfresh on every call, so the backend always had the right data. The missing piece was a signal to the frontend to re-fetch.notifyConfigChanged()emits that signal — but it was only called after in-app edits, leaving manual file edits invisible until restart.Test plan
~/.mux/providers.jsoncwhile the app is running — it should appear in Settings → Providers within ~300 ms, no restart neededMaxListenersExceededWarningnoise in dev logs🤖 Generated with Claude Code