Send the fallback message and transfer when the ai cannot reply

When the AI/LLM Service times out, errors, or returns an empty result, the customer receives the configured fallback message and the conversation transfers to an operator — never a silent failure.

When this happens: The provider call fails: request timeout (default 15 s), an HTTP/provider error, or an empty completion.

How it works

  • EasyCRM sends a message while the connected AI/LLM Service is degraded.
  • Calls IAiCompletionClient.CompleteAsync; the call exceeds the configured timeout.
  • Treats the timeout as a provider failure — same handling as an explicit error response or an empty result.
  • EasyCRM sends the fallback message for the detected/profile/default language, Ai, with disclosure applied per setting (it is still an AI-originated message).
  • Sets Unassigned, creates AssignmentHistory (AiHandover, ProviderUnavailable), routes per FR-24.
  • EasyCRM records AiInteractionLog (ProviderErrorCode set, ProviderUnavailable).
  • If provider failures repeat for the company beyond a configured threshold, notifies Admins (reuses the existing degraded-integration notification pattern — FR-10).

Other paths

Empty result instead of an error

If the provider returns HTTP 200 with no usable text. Treated identically to a timeout or error — never sent to the customer as a blank or malformed message.

If something goes wrong

Fallback send itself fails

The channel send of the fallback message fails (e.g. Window closed). The conversation still transfers to Unassigned (step 5 proceeds regardless); the failed fallback Message is visible and resendable like any failed send (FR-25).

Good to know

  • Never silent — a customer message that reaches an unreachable AI always produces either a reply or the fallback message plus transfer (BRD §3.9 decision 3; ADR-011 risk R-10).
  • A provider timeout, an explicit error and an empty result are all "cannot reply" — none of them retries indefinitely or leaves the customer waiting.