Skip to content

fix(desktop): honor real harness readiness in provider UI#8

Merged
OmGuptaIND merged 1 commit intomainfrom
OmGuptaIND/new-computer-providers-bug
Apr 22, 2026
Merged

fix(desktop): honor real harness readiness in provider UI#8
OmGuptaIND merged 1 commit intomainfrom
OmGuptaIND/new-computer-providers-bug

Conversation

@OmGuptaIND
Copy link
Copy Markdown
Contributor

Summary

  • On a fresh install, Settings showed codex as Connected (green dot) and the default-model card displayed a leftover model, even though no CLI was installed or logged in. Root cause: providerHasKey() returns true for any harness-type provider (so the CLI never needs an API key), and the desktop UI was treating that as a generic is this provider ready signal.
  • Introduces isProviderReady / anyProviderReady in packages/desktop/src/lib/providers.ts as the single source of truth — consults harnessStatuses[name].installed && auth.loggedIn for harness providers, hasApiKey for API providers — and routes every relevant surface through it.
  • Also fixes a pre-existing latent bug in ModelPopover.groupFor: the grouping memo didn't include harnessStatuses in its deps, so a harness login completed while the popover was open wouldn't move the provider out of "Not configured".

Surfaces fixed

  • Settings > AI Models ProviderRow — "Connected" badge now reflects real CLI install + login state.
  • Settings > Default model card — shows an empty state (No model selected + Select model CTA) when nothing is ready, instead of a misleading default.
  • Composer ModelSelectoranyReady drives the "Select a model" empty state; the pill's old hasAnyKey predicate was always true whenever harness providers existed in the defaults list.
  • ModelPopovergroupFor is now pure; the popover subscribes to harnessStatuses and includes it in memo deps so groupings update live.
  • HarnessProviderSwitch — items are disabled based on real readiness; tooltip differentiates "not installed" vs "not logged in". Previously it checked p.installed, a field the backend never populates — so the switch was effectively always disabled.
  • ChatInput — send button disabled when no provider is ready (tooltip: "Connect a provider to send"); Enter-key path gated in handleSend to match.
  • CSS — new composer__model--empty modifier keeps the empty-state pill at the same 26px height (matching the avatar-populated pill with box-sizing: border-box) and balances horizontal padding so the label doesn't jam against the left border.

Not changed (deliberately)

  • providerHasKey() in packages/agent-config/src/config.ts still returns true for harness providers. That value is load-bearing for agent-runner.ts chat gating (lines 420, 929, 1062) and there are zero tests under packages/agent-config, packages/agent-server, or packages/desktop. A frontend-only fix is tightly scoped and mirrors the already-correct ModelSelector.groupFor pattern.
  • The "GLM5.1 · codex" combo that some users see as the "default" on a supposedly-fresh install can't be produced by pickDefaultProvider() (falls back to anthropic/claude-sonnet-4-6). It has to come from a leftover ~/.anton/config.yaml or a prior onboarding selection. With this change that no longer misleads the UI — a stale default is never shown as "Connected".

Test plan

No automated tests exist in this monorepo; manual QA on a clean profile:

  • Stash ~/.anton/config.yaml and ensure which codex is empty.
  • Launch desktop. Settings > AI Models: codex row shows Connect (not "Connected"); Default-model card shows "No model selected" + Select model button.
  • Composer pill shows "Select a model"; send button disabled with the correct tooltip; Enter-key does nothing.
  • Install codex but don't log in → both surfaces still show Connect; switch tooltip shows "not logged in".
  • Complete codex login → Settings row flips to green "Connected" without closing Settings; popover moves codex from "Not configured" to "Subscriptions" without reopen; composer pill shows the real model; send button re-enables.
  • Non-harness regression: connect an OpenAI API key → row shows "Connected" as before.

🤖 Generated with Claude Code

On a fresh install the Settings page showed the codex CLI as "Connected"
and the composer pill displayed a leftover default model even though no
provider was actually usable. Root cause: `providerHasKey()` returns
`true` for any harness-type provider (so the CLI never needs an API
key), but the desktop UI was treating that value as a generic "is this
provider ready" signal.

Introduce a single-source-of-truth `isProviderReady` / `anyProviderReady`
helper in `packages/desktop/src/lib/providers.ts` that consults the real
harness detection state (`harnessStatuses[name].installed && auth.loggedIn`)
for harness providers and `hasApiKey` for API providers. Route every
relevant surface through it:

- Settings > AI Models ProviderRow — "Connected" badge now reflects
  real CLI install + login state.
- Settings > Default model card — empty state ("No model selected" +
  "Select model" CTA) when nothing is ready, instead of a misleading
  default.
- Composer ModelSelector — `anyReady` drives the "Select a model"
  empty state (previously broken because `p.type === 'harness'` made
  `hasAnyKey` always true).
- ModelPopover `groupFor` — now pure and reactive to `harnessStatuses`
  changes while the popover is open (pre-existing latent bug: memo
  deps didn't include the status map).
- HarnessProviderSwitch — disabled state now based on real readiness;
  tooltip differentiates "not installed" vs "not logged in".
- ChatInput send button — disabled when no provider is ready; Enter-key
  path gated in `handleSend` to match.

Also adds a `composer__model--empty` CSS modifier so the empty-state
pill matches the populated pill's 26px height and balanced padding
(previously the missing avatar collapsed the pill vertically and the
label jammed against the border).

Backend `providerHasKey()` semantics intentionally left alone — they
are load-bearing for agent-runner chat gating and there are no tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@OmGuptaIND OmGuptaIND merged commit e0f2b1d into main Apr 22, 2026
@OmGuptaIND OmGuptaIND deleted the OmGuptaIND/new-computer-providers-bug branch April 22, 2026 12:44
OmGuptaIND added a commit that referenced this pull request Apr 24, 2026
### Features
- multi-format file attachments with @-mentions and preview renderers (#12)

### Fixes
- pnpm lock
- workspace safety net — no more /root EACCES, atomic writes, version handshake (#11)

### Chores
- clean up biome lint + format across repo

### Other
- feat(desktop): remove new-project attachments, add text-file creator in files view (#10)
- feat(desktop): reasoning effort pill + provider modal redesign + onboarding tour (#9)
- fix(desktop): honor real harness readiness in provider UI (#8)
- fix(harness): persist session title to meta.json across reloads (#7)
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