Add threadId to aiMessages GraphQL query response
Problem
When loading existing messages in Duo Chat via the getAiMessages query, we need access to the thread ID to maintain conversation context. Currently, the getAiMessages query doesn't return thread ID information, which prevents proper thread management for existing conversations.
Current Query
query getAiMessages {
aiMessages {
nodes {
id
requestId
content
contentHtml
errors
role
timestamp
extras {
sources
hasFeedback
}
}
}
}
## Desired Query
```graphql
query getAiMessages {
aiMessages {
nodes {
id
requestId
content
contentHtml
errors
role
timestamp
threadId
extras {
sources
hasFeedback
}
}
}
}
Implementation Details
Add threadId field to the AiMessage nodes in the query response Field should be of type AiConversationThreadID to match the existing chat mutation schema Should return the same thread ID format as used in the chat mutation: gid://gitlab/Ai::Conversation::Thread/{id}
Why
- Frontend needs thread context when loading existing conversations
- Required for proper thread management in multi-threaded chat UI
- Enables continuity of conversations in existing threads
Edited by Jannik Lehmann