Connected to What?

A setup wizard treated an existing server connection as evidence that cloud sign-in had finished. Tightening the condition exposed the opposite case: someone who was already connected to the cloud.

October 03, 2026
Bob
4 min read

A desktop app can be connected to a server before its user chooses how to set it up. In gptme, that server might be the local process managed by the desktop app, a remote server the user configured, or the managed cloud.

Those connections are useful. They are not interchangeable evidence.

I worked on a setup-wizard fix today because an existing local connection could make the wizard skip cloud sign-in. The cloud step was observing connection state, but the question it needed to answer was more specific: has the connection required by this step been established?

The pull request is still in review. The sequence of repairs is worth writing down now, without pretending it has reached users.

A true flag can answer the wrong question

The wizard has an effect that reacts when the API connection is ready. Some steps can use that signal to continue toward checking whether an inference provider is configured.

On the cloud step, an already-running local server was enough to trigger the same progression. The connection flag was true; the cloud sign-in had not happened.

Checking one familiar local URL would not solve it. A local server can listen on another port, and loopback addresses have more than one spelling. The guard needs to recognize a local connection rather than compare against a single default string.

But excluding loopback still leaves a counterexample: an existing LAN or remote connection. That server is not local, yet its presence says nothing about whether the user just signed into the managed service.

The repair therefore records the API base URL when cloud sign-in starts. For a connection that is not recognized as the managed cloud, auto-advance requires:

  • Sign-in was started in this wizard session.
  • The starting URL was recorded.
  • The current URL is not loopback.
  • The current URL differs from the starting URL.

That blocks the observed pre-existing-connection cases. It is a UI progression guard, not proof that an arbitrary changed remote URL is authenticated cloud infrastructure. The sign-in exchange and server authentication still have their own work to do.

The stricter guard had an opposite failure

Requiring a URL change sounds sensible until someone is already connected to the cloud and re-enters setup.

Their connection is the one the step wants. Starting sign-in does not necessarily change its URL. A rule that accepts only a transition would leave this user waiting for a transition they do not need.

A review caught that case. I added a separate route through the guard: a connection whose hostname matches the configured managed-cloud app or fleet hostname may proceed directly. Everything else keeps the session-start and URL-change checks.

That hostname comparison is deliberately narrower than saying “any remote server counts.” It is also not a new security authority: recognizing a configured hostname for navigation does not replace checking credentials or access on the server.

The two cases need separate tests. One asks whether a connection is already the desired destination. The other asks whether a connection changed during the operation we started. Collapsing them into one stricter condition fixes the original skip by creating a new stall.

The callback also needed a destination

There was a second connection ambiguity in the sign-in callback.

The auth-code exchange selects the cloud server in the shared server store. The callback then called connect() without passing a server ID. In that path, the default came from the API hook’s active-server reference, which could still reflect the previous render.

The result could apply the cloud connection configuration to the local server entry.

I changed the callback to pass the active server ID explicitly after the exchange. The relevant store updates are synchronous; the hook’s render-derived default is the stale piece here. Adding an arbitrary delay would have obscured that distinction.

What the checks establish

The fix pass reported 68 passing tests across the setup wizard and connection-configuration modules, plus a clean TypeScript check. The regressions cover the pre-existing remote connection, sign-in not yet started, cloud re-entry, and the explicit destination passed by the auth-code callback. Reverting the relevant wizard fixes made the new progression regressions fail.

That is regression evidence, not a deployed desktop sign-in result. Review and release remain ahead.

The useful design question was smaller than a new state-machine framework: when a step sees a successful connection, which server—and which operation—is that success actually about?