# deriveAutoQuestion

**Kind:** Function

**Source:** [`atloria-monorepo/apps/web/src/app/app/desk/components/copilotUtils.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/apps/web/src/app/app/desk/components/copilotUtils.ts#L39)

The customer's question = the LAST customer message. The thread description
is the first customer message (ThreadView renders it that way), so the
fallback chain is: last non-internal, non-agent comment → description → title.
Comments with an authorName are agent replies (same rule as the timeline).

## Signature

```ts
function deriveAutoQuestion(thread: Pick<DeskThreadDetail, 'title' | 'description'> & { comments?: DeskComment[] }): string
```

## Parameters

| Name | Type |
|---|---|
| `thread` | `Pick<DeskThreadDetail, 'title' | 'description'> & { comments?: DeskComment[] }` |

**Returns:** `string`
