Skip to content

fix: watch providers.jsonc for external edits so UI refreshes without restart#3233

Open
Neppkun wants to merge 1 commit intocoder:mainfrom
Neppkun:claude/gracious-vaughan-6da90f
Open

fix: watch providers.jsonc for external edits so UI refreshes without restart#3233
Neppkun wants to merge 1 commit intocoder:mainfrom
Neppkun:claude/gracious-vaughan-6da90f

Conversation

@Neppkun
Copy link
Copy Markdown

@Neppkun Neppkun commented May 5, 2026

Summary

  • Custom providers added manually to ~/.mux/providers.jsonc never appeared in the UI because notifyConfigChanged() was only called after API mutations, not on external file changes
  • Added Config.watchProvidersFile() — watches the mux home directory with fs.watch, debounced 300 ms, returns a cleanup fn
  • Wired it into ProviderService constructor so any external edit to providers.jsonc immediately propagates to all onConfigChanged frontend subscribers

Root cause

ProviderService.list() and getConfig() already read providers.jsonc fresh 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

  • Add a custom provider entry to ~/.mux/providers.jsonc while the app is running — it should appear in Settings → Providers within ~300 ms, no restart needed
  • Remove the entry from the file — it should disappear from the UI within ~300 ms
  • Verify built-in provider changes via the UI still work as before
  • Confirm no MaxListenersExceededWarning noise in dev logs

🤖 Generated with Claude Code

…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>
@Neppkun
Copy link
Copy Markdown
Author

Neppkun commented May 5, 2026

I apologize in advance for using Claude Code to write this instead of Mux. (I ran out of credits)
Tested the changes on web UI, works as intended.
image
image
image

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.

1 participant