Skip to content

πŸ› Stop telling users to reinstall Pi when it's just a provider mismatch#50

Open
arach wants to merge 1 commit into
mainfrom
fix/pi-provider-setup-callout
Open

πŸ› Stop telling users to reinstall Pi when it's just a provider mismatch#50
arach wants to merge 1 commit into
mainfrom
fix/pi-provider-setup-callout

Conversation

@arach

@arach arach commented Jun 7, 2026

Copy link
Copy Markdown
Owner

The bug

If pi is installed but the selected provider has no stored credential (e.g. the default openai-codex while you've only signed into github-copilot/minimax), the Workspace Assistant rendered the "PI REQUIRED β†’ npm install -g --ignore-scripts @earendil-works/pi-coding-agent@latest" block β€” telling you to reinstall the agent from scratch over what is purely a provider-selection problem.

Root cause: PiWorkspaceView.setupPlaceholder (the needsProviderSetup state) was wired to PiInstallCallout β€” the component meant for a genuinely missing binary. The name said "setup," the body said "install from scratch."

The fix

  1. Right callout for the right state. setupPlaceholder now uses PiProviderSetupCallout (an amber "SET UP YOUR AI" component that already existed but was orphaned/never mounted). PiInstallCallout is now used only for !hasPiBinary. The dock and Settings mounts already gated correctly; this was the one wrong site.

  2. Auto-select a connected provider. In reloadAuthState(), if the selected provider has no stored credential but another provider is connected, switch to the first connected one (in PiProvider.supported order). This runs inside PiChatSession.init, so it fires before any setup state can render β€” the assistant just works on a provider you're already signed into instead of stranding you on a setup screen. Routed through the normal authProviderID setter (persists + refreshes like a manual switch); skipped while an auth flow is in progress.

Verification

  • swift build -c release β€” builds clean; app relaunches.
  • Logic verified by inspection. Live UI flip isn't auto-confirmable from outside the app (lazy .shared instantiation + lazy UserDefaults flush; and the readOnly popover hardening blanks screenshots), so this is best eyeballed in-app: open the assistant β†’ it should land on GitHub Copilot chat. Sign out of every provider and you'll get the amber "SET UP YOUR AI" callout β€” never the install-from-scratch block β€” as long as the binary is present.

Notes

This is purely the UX bug. Separately, the installed agent is 0.74.0 vs 0.78.1 latest β€” worth bumping, but unrelated to this fix.

…smatch

PiWorkspaceView.setupPlaceholder (the needsProviderSetup state) rendered
PiInstallCallout β€” the "PI REQUIRED β†’ npm install -g ..." block meant for a
genuinely missing binary. So a user with pi installed but pointed at an
unauthenticated provider (e.g. the default openai-codex while only
github-copilot is signed in) was told to reinstall the agent from scratch.

- setupPlaceholder now uses the existing (previously orphaned)
  PiProviderSetupCallout. PiInstallCallout stays for the real !hasPiBinary case
  (its other three mounts already gate on that correctly).
- Auto-select a connected provider in reloadAuthState(): if the selected
  provider has no stored credential but another is connected, switch to the
  first connected one in supported order. Keeps the assistant usable instead of
  stranding the user on a setup screen for a provider they never authenticated.
  Routed through the normal authProviderID setter so it persists and refreshes
  like a manual switch; skipped mid-auth-flow.
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