Skip to content

Bug: Chat composer stays editable when no API key is configured #2576

Closed

Description

@yannickmonney

Problem

The main chat composer remains fully editable when the selected model's provider has no API key. The user can type a message, but sending is blocked — which reads as a broken input rather than a deliberate gate.

Current behaviour

  1. ChatInterface detects a missing key and passes sendBlocked={true} with reason modelSelector.noApiKey ("No API key configured for this model's provider — add one in Settings → AI providers.") — chat-interface.tsx lines ~431–460, ~1499–1514.
  2. ChatInput treats sendBlocked as send-only: the textarea stays editable so the user can "revise their message" — chat-input.tsx lines ~171–176, ~363 (inputDisabled = disabled || (isLoading && !queueModeActive) — sendBlocked is excluded).
  3. The inline error appears as a destructive status line once text is entered (sendBlockedVisible && value.length > 0, line ~1188), or as a placeholder overlay when empty (lines ~1244–1253). Send is disabled and Enter shows a toast, but typing, pasting, and attachments (except where separately gated) still work.

Repro:

  1. Open an org with no API key configured for the active model's provider.
  2. Go to main chat.
  3. Click the composer and type — input accepts text despite the missing-key state.

Expected behaviour

When no API key is configured (model-level or org-wide noProviderHasApiKey), the chat composer should be non-interactive — same as other hard blocks (disabled / archived thread):

  • Textarea disabled (no typing, paste, or focus editing).
  • Send button disabled (already the case).
  • Missing-key reason visible before the user interacts (banner or disabled placeholder), with the existing Settings → AI providers deep link for admins.

The send-only sendBlocked pattern may remain appropriate for recoverable in-session blocks (e.g. image-edit model mismatch) where the user can fix state without leaving chat — but missing API key is a setup blocker, not a draft-revision case.

Code pointers

  • services/platform/app/features/chat/components/chat-interface.tsx — activeModelMissingApiKey, noProviderHasApiKey, sendBlocked wiring
  • services/platform/app/features/chat/components/chat-input.tsx — inputDisabled vs sendBlocked split; inline reason rendering
  • services/platform/messages/en.json — modelSelector.noApiKey
  • services/platform/app/features/chat/components/chat-input.test.tsx — tests cover send-blocked send button, not input disable

Acceptance criteria

  • With no API key for the active model's provider, the chat textarea cannot receive input (typing, paste, dictation).
  • The missing-key message is visible on an empty composer without requiring the user to type first.
  • Send remains disabled; Enter does not silently no-op.
  • Admins still see the actionable link to Settings → AI providers.
  • Other sendBlocked cases (budget exceeded, image-edit mismatch) behave as before unless explicitly scoped into this change.
  • Regression test covers the disabled composer state for missing API key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions