Repository navigation
feat(ai-monitoring): Return stored conversation titles from the list endpoint - #120665
Merged
Merged
Conversation
…endpoint Titles generated into AIConversationMetadata were never read back. The AI conversations list response now carries a `title` field, resolved from the metadata row belonging to a project the conversation actually has spans in. The field is always present and null when no title is stored, so existing clients are unaffected.
vgrozdanic
commented
Jul 28, 2026
| def _first_title( | ||
| titles: Mapping[tuple[str, int], str], conv_id: str, project_ids: Sequence[int] | ||
| ) -> str | None: | ||
| """Lowest project id with a stored title wins, so results are stable across requests.""" |
Member
Author
There was a problem hiding this comment.
technically conversation can span multiple projects, and we generate one title per conversation-project pair. It's an edge case, but let's rather handle it in a consistent way, than have some random bugs (if this ever even will happen)
Member
There was a problem hiding this comment.
Wouldn't it be more coherent with how we generate these titles to pick the one that was generated first using title_source_timestamp?
vgrozdanic
marked this pull request as ready for review
July 28, 2026 08:45
shellmayr
reviewed
Jul 28, 2026
| conversations_map, results["enrichment"] | ||
| ) | ||
| self._apply_first_last_io(conversations_map, results["first_last_io"]) | ||
| self._apply_titles(conversations_map, project_ids_by_conversation) |
Member
There was a problem hiding this comment.
Shall we feature flag this for rollout? Just in case something goes wrong
shellmayr
approved these changes
Jul 28, 2026
3 tasks
vgrozdanic
added a commit
that referenced
this pull request
Jul 29, 2026
…120746) Follow up to #120665, which added `title` to the conversations list and left the details endpoint alone because adding one there breaks its response shape. That endpoint returns a bare array of spans, so there is nowhere to put a field that describes the conversation rather than a span. Passing `apiVersion=2` now returns an object instead, with the spans moved under `spans`: ```jsonc // no apiVersion, or apiVersion=1 — unchanged [ {span}, {span} ] // apiVersion=2 { "conversationId": "abc", "title": "Refund a duplicate charge", // null when nothing has been titled yet "spans": [ {span}, {span} ] } ``` Requests that don't send the parameter keep the old array, so this lands without touching the UI. The frontend switches over in its own PR, and only once it pins `apiVersion=2` explicitly does flipping the default become safe for cached bundles. An unsupported value is a 400 rather than a silent fallback. Pagination is unaffected either way — cursors live in the `Link` header, not the body.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Conversation titles have been written into
AIConversationMetadatasince title generation was hooked into the ingestion pipeline, but nothing ever read them back. The AI conversations list response now includes atitlefor each conversation.The conversation details endpoint is deliberately untouched — adding a title there is a breaking change to its response shape and will be done as a follow up.
Resolving a title
This is where it gets a bit tricky, so bear with me....
Metadata rows are keyed on
(project_id, sha256(conversation_id)), but the list endpoint groups bygen_ai.conversation.idacross every project in the request, so a conversation on its own doesn't identify a row. The enrichment span query now also selectsproject.id, which gives the set of projects each conversation actually has spans in, and titles are matched against exactly those pairs.This matters because a conversation id is only unique within a project. Matching on the id alone would let an unrelated conversation that happens to share an id in another project supply the title.
A conversation genuinely spanning several projects can have a row in each. The lowest project id with a stored title wins, so repeated requests return the same title rather than varying with row ordering. This is an edge case behavior, but we need to handle it :(