# A regenerate response button is present

- **Pattern:** `ab-000148` (`ai-chat-visibility.error-handling.regenerate-response-button`)
- **Severity:** high
- **Lifecycle:** active
- **Last modified:** 2026-04-18
- **Canonical URL:** https://auditbuffet.com/patterns/ab-000148
- **License:** CC-BY-4.0 — attribute to AuditBuffet Pattern Catalog (https://auditbuffet.com/patterns/ab-000148)

## Why it matters

AI responses are non-deterministic and fail in soft ways all the time — hallucinations, cut-off streams, refusals on benign prompts, partial answers that drift off topic. Without a regenerate button the only recovery is to retype the prompt verbatim, which users will not do; they will instead give up on the answer or, worse, act on the bad one. Regenerate is the standard recovery affordance established by every reference chat product in the category.

## Severity rationale

High because soft-fail responses are common and the alternative recovery path (retyping) is friction users will not pay.

## Remediation

In `src/components/chat/MessageBubble.tsx`, render a regenerate button on the last assistant message wired to `reload()` from `useChat` (or a custom resubmit of the last user message). In error states, promote it to the primary recovery action with a "Try again" label.

```tsx
{isLastAssistantMessage && !isLoading && (
  <Button onClick={reload} variant="ghost" size="sm">
    <RotateCcw className="h-4 w-4 mr-1" /> Regenerate
  </Button>
)}
```

## Detection

- **ID:** `regenerate-response-button`
- **Severity:** `high`
- **What to look for:** Count all regeneration/retry mechanisms: `reload()` from `useChat`, custom retry logic, retry buttons on error states. Check whether AI message components have a regenerate or retry button. In the Vercel AI SDK, `useChat` provides a `reload()` function that re-sends the last message. Look for a retry or regenerate icon (circular arrows) on completed AI messages, or an error state that shows a "Try again" button. The button should appear on the last AI message only.
- **Pass criteria:** The most recent AI response has a regenerate/retry button. After an error, a "Try again" button is visible. Clicking it re-submits the last user message and replaces the last AI response. At least 1 retry mechanism must be present.
- **Fail criteria:** No regenerate or retry mechanism exists. Users who receive a bad, incomplete, or error response must manually retype their message to get a new response.
- **Skip (N/A) when:** No chat interface detected. Signal: same as `response-streaming-progressive`.
- **Detail on fail:** `"No regenerate button found on AI messages; users cannot retry failed or unsatisfactory responses without manually re-entering their message"`
- **Remediation:** In your message component at `src/components/chat/MessageBubble.tsx`, add a regenerate button:

  ```tsx
  {isLastAssistantMessage && !isLoading && (
    <Button onClick={reload} variant="ghost" size="sm">
      <RotateCcw className="h-4 w-4 mr-1" /> Regenerate
    </Button>
  )}
  ```

  In error states, make it the primary recovery action with clear "Try again" label.

Taxons: user-experience, error-resilience

HTML version: https://auditbuffet.com/patterns/ab-000148
