Fix custom server URL being overwritten on startup by maxazure · Pull Request #1204 · jamiepine/voicebox · GitHub
Skip to content

Fix custom server URL being overwritten on startup - #1204

Open
maxazure wants to merge 1 commit into
jamiepine:mainfrom
maxazure:fix/preserve-custom-server-url
Open

maxazure wants to merge 1 commit into
jamiepine:mainfrom
maxazure:fix/preserve-custom-server-url

Conversation

@maxazure

Copy link
Copy Markdown

Fixes #1185.
The server URL was already persisted, but desktop startup replaced it with the bundled server address. This change distinguishes user-selected URLs from automatically discovered ones, so startup preserves saved choices, including changes made while startup is pending.
Existing settings are migrated conservatively: only exact known defaults remain automatic. Other URLs, including custom loopback addresses, are preserved. Web same-origin defaults continue to work.
Validation:

  • 14 Bun store tests, 36 assertions
  • App and web TypeScript checks
  • Biome lint on changed files
  • Production web build
  • git diff --check
    The tests cover persistence, migration, startup races, and cache invalidation using in-memory storage. A real Tauri startup and backend end-to-end test were not run.

Copilot AI balanced review requested due to automatic review settings October 15, 2026 16:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It introduces a one-way persistence migration and reworks server-startup logic affecting every existing install, and the author noted real Tauri/backend end-to-end runs were not performed, so human verification is warranted.

1 open finding
What changed in this PR

This PR fixes issue #1185, where a user's custom "Server URL" was discarded on startup/refresh. The root cause was that desktop (and web) startup unconditionally wrote the bundled/discovered server address into the store via setServerUrl, clobbering any saved custom value. The fix introduces a serverUrlSource ('auto' | 'custom') flag and a dedicated setDiscoveredServerUrl action that only applies an auto-discovered URL when the current source isn't 'custom', so user selections persist across restarts and even survive a save that happens while async startup is still pending.

Changes:

  • Added serverUrlSource state plus setDiscoveredServerUrl, and a persist version bump (v1) with a conservative migrate that only treats exact known defaults as 'auto' and preserves everything else as 'custom'.
  • Updated App.tsx startup paths (web and Tauri) to call setDiscoveredServerUrl instead of setServerUrl, removing the now-unused isLoopbackVoiceboxServerUrl helper.
  • Added a new Bun test suite covering persistence, migration, startup races, and cache invalidation.
File Description
app/​src/​stores/​serverStore.ts Adds source tracking, setDiscoveredServerUrl, and a versioned migration; removes isLoopbackVoiceboxServerUrl.
app/​src/​App.tsx Switches startup URL updates to setDiscoveredServerUrl so saved custom URLs are preserved.
app/​tests/​serverStore.test.ts New tests for URL selection, migration, startup races, and cache invalidation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
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.

Server URL won't get saved properly

2 participants