Skip to content

fix: use user's configured name in conversation transcript summaries#5320

Open
atlas-agent-omi[bot] wants to merge 1 commit intomainfrom
atlas/fix-transcript-user-name
Open

fix: use user's configured name in conversation transcript summaries#5320
atlas-agent-omi[bot] wants to merge 1 commit intomainfrom
atlas/fix-transcript-user-name

Conversation

@atlas-agent-omi
Copy link

Problem

Conversation summaries show "User" instead of the person's actual name when generating the transcript for the summary LLM call.

Root Cause

conversation.get_transcript() and Conversation.get_transcript() were called without user_name in process_conversation.py. The segments_as_string() method defaults to "User" when user_name is None.

Fix

  • Add user_name parameter to Conversation.get_transcript() and CreateConversation.get_transcript()
  • Fetch user's configured name via get_user_name(uid) in process_conversation()
  • Pass user_name through _get_structured()get_transcript()segments_as_string()
  • Also passes user_name to the app results transcript call

Note: memories.py already passes user_name correctly — this fix aligns the conversation summary path.

Fixes #5319

Previously, conversation summaries used 'User' as the speaker name
because get_transcript() was called without user_name in the
conversation processing pipeline. Now we fetch the user's configured
name via get_user_name(uid) and pass it through to
segments_as_string(), so transcripts show 'Aarav:' instead of 'User:'.

Fixes #5319
@greptile-apps
Copy link

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR aims to use the user's configured name instead of "User" in conversation transcript summaries. The approach is mostly correct: adding user_name parameter through the call chain from process_conversation()_get_structured()get_transcript()segments_as_string().

Changes:

  • ✅ Added user_name parameter to Conversation.get_transcript() and CreateConversation.get_transcript()
  • ✅ Modified _get_structured() to accept and pass user_name
  • ✅ Fetched user's name via get_user_name(uid) in process_conversation()
  • Critical bug: _trigger_apps() uses user_name in nested function but doesn't accept it as parameter, causing NameError

Impact:
The bug will cause conversation processing to fail when triggering apps (conversation summarization), which is a core feature. The main conversation structuring path (lines 635-638) will work correctly, but app execution (line 696) will crash.

Confidence Score: 1/5

  • This PR has a critical runtime bug that will break conversation processing
  • Score of 1 reflects a critical logical error that will cause NameError when apps are triggered during conversation processing. While the intent and most of the implementation are correct, the missing user_name parameter in _trigger_apps() makes this PR unsafe to merge without fixes.
  • backend/utils/conversations/process_conversation.py requires immediate attention - must add user_name parameter to _trigger_apps() function and its call site

Important Files Changed

Filename Overview
backend/models/conversation.py Added user_name parameter to get_transcript() methods in both Conversation and CreateConversation classes - changes are correct
backend/utils/conversations/process_conversation.py Added user_name to transcript calls but has critical bug: user_name used in _trigger_apps without being passed as parameter, will cause NameError at runtime

Last reviewed commit: ddb010f

with track_usage(uid, Features.CONVERSATION_APPS):
result = get_app_result(
conversation.get_transcript(False, people=people), conversation.photos, app, language_code=language_code
conversation.get_transcript(False, people=people, user_name=user_name), conversation.photos, app, language_code=language_code
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user_name undefined here - will cause NameError

user_name is not a parameter of _trigger_apps() nor is it defined in the function scope. When execute_app runs, it will raise NameError: name 'user_name' is not defined.

Fix needed:

  1. Add user_name: str = None parameter to _trigger_apps() signature (line 286)
  2. Pass user_name=user_name when calling _trigger_apps() (line 696)
def _trigger_apps(
    uid: str,
    conversation: Conversation,
    is_reprocess: bool = False,
    app_id: Optional[str] = None,
    language_code: str = 'en',
    people: List[Person] = None,
    user_name: str = None,  # Add this
):

And at line 696:

_trigger_apps(
    uid, conversation, is_reprocess=is_reprocess, app_id=app_id, 
    language_code=language_code, people=people, user_name=user_name
)

people = [Person(**p) for p in people_data]

structured, discarded = _get_structured(uid, language_code, conversation, force_process, people=people)
from database.auth import get_user_name
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move import to module level per coding standards

The import is inside the function, violating rule 40d2fa4f (Backend Python import rules - no in-function imports). While this file has other in-function imports, best practice is to import at the module level.

Move to top of file:

Suggested change
from database.auth import get_user_name
from database.auth import get_user_name

Context Used: Rule from dashboard - Backend Python import rules - no in-function imports, follow module hierarchy (source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pass speaker name instead of "User" in transcript for summary generation

0 participants