Fix confusing fleet-provider setup: self-host TUI path and repoint-in-place - #6357
Merged
Conversation
Connecting a client to a known federated fleet host required an easy-to-miss manual "Fetch API key from host" click before Create would succeed — clicking Create with the field still blank just set a small error banner, which read as "nothing happened, no provider was created." Selecting a peer (from the URL or the dropdown) now fetches its key immediately, so the common path of prefilled-endpoint + Create works in one step.
…-place Host setup silently only ever created a Direct API provider on the host itself (never an OpenCode TUI one), and the peer-discovery cards on the AI Providers page only ever surfaced OTHER PortOS instances — so a machine running its own fleet host had no discoverable way to add itself as a provider, and any existing provider could only be pointed at a fleet host by creating a duplicate and manually deleting the old one. Add a "Set up as provider" / "Set up OpenCode TUI on this machine" one-click path (?selfHost=1) that prefills the loopback endpoint and this machine's own API key, and let the Connect Client tab repoint an existing OpenCode TUI or Direct API provider in place instead of always creating a new one, merging rather than clobbering its other env vars, models, and secret markers.
buildFleetProvider() unconditionally overwrites command/args/envVars with OpenCode's wiring, so offering every TUI provider as a repoint target would silently convert a Claude/Codex/Grok TUI provider into an OpenCode one. Restrict candidates to already-OpenCode (or command-less) TUI providers, and reset name/model/harness when switching back to "create a new provider" so stale values from a previously selected target don't linger.
…ailnet one Self-host providers (both the auto-created Direct API one and the new ?selfHost=1 OpenCode one) are always wired to 127.0.0.1:18022 — the "add a provider for this host" card was comparing against status.endpoint (the tailnet address published for OTHER machines), so it never matched and the nudge would keep reappearing after the user already created the provider it asked for. Also tighten the self-host endpoint-validation bypass to only skip the private-network check for the actual prefilled loopback value, not for whatever the user edits the field to afterward.
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
?selfHost=1) that prefills this machine's own loopback endpoint and API key.Test plan
npm test(client workspace): 867 files / 10572 tests passing, including new coverage for the self-host prefill, repoint-in-place merge behavior, the OpenCode-only repoint filter, and the self-host dedupe fix.npx biome lintclean on all touched files.