Skip to content

Fix confusing fleet-provider setup: self-host TUI path and repoint-in-place - #6357

Merged
atomantic merged 4 commits into
mainfrom
cos/task-mtpa5koa/agent-cd7b5bad
Sep 6, 2026
Merged

Fix confusing fleet-provider setup: self-host TUI path and repoint-in-place#6357
atomantic merged 4 commits into
mainfrom
cos/task-mtpa5koa/agent-cd7b5bad

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • Host setup only ever created a Direct API provider on the host itself (never an OpenCode TUI one), and the peer-discovery cards on AI Providers only ever surfaced other PortOS instances — so a machine running its own fleet host had no discoverable way to add itself as a provider.
  • The Connect Client wizard could only create brand-new providers, so pointing an existing OpenCode TUI or Direct API provider at a fleet host meant creating a duplicate and manually deleting the old one.
  • Added a one-click "Set up as provider" / "Set up OpenCode TUI on this machine" path (?selfHost=1) that prefills this machine's own loopback endpoint and API key.
  • The Connect Client tab can now repoint an existing OpenCode TUI or Direct API provider in place, merging (not clobbering) its other env vars, models, and secret markers. Repoint candidates are restricted to already-OpenCode TUI providers (or command-less ones) so a Claude/Codex/Grok TUI provider can't be silently converted.
  • Fixed the "add a provider" self-host nudge comparing against the tailnet endpoint instead of the loopback address self-host providers actually use (it would never clear once configured).

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 lint clean on all touched files.

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.
@atomantic
atomantic merged commit f1ab162 into main Sep 6, 2026
7 checks passed
@atomantic
atomantic deleted the cos/task-mtpa5koa/agent-cd7b5bad branch September 6, 2026 04:27
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