Skip to content

Skip conv_apps suggestion when user has preferred app #4639

@beastoin

Description

@beastoin

Parent: #4635

Problem

_trigger_apps() always calls get_suggested_apps_for_conversation() (LLM call) even when the user already has a preferred_app_id set in Redis. The suggestion result is stored but never used.

File: backend/utils/conversations/process_conversation.py:300-326

# Always runs suggestion first
if not conversation.suggested_summarization_apps:
    with track_usage(uid, Features.CONVERSATION_APPS):
        suggested_apps, reasoning = get_suggested_apps_for_conversation(...)

# Then checks preferred app anyway
preferred_app_id = redis_db.get_user_preferred_app(uid)
if preferred_app_id and preferred_app_id in all_apps_dict:
    app_to_run = all_apps_dict.get(preferred_app_id)  # Uses this, ignoring suggestion

Proposed Change

Check for preferred app FIRST. If user has one, skip the suggestion LLM call entirely.

# Check preferred app first
preferred_app_id = redis_db.get_user_preferred_app(uid)
if preferred_app_id and preferred_app_id in all_apps_dict:
    app_to_run = all_apps_dict[preferred_app_id]
else:
    # Only suggest if no preferred app
    if not conversation.suggested_summarization_apps:
        suggested_apps, reasoning = get_suggested_apps_for_conversation(...)

Impact

  • Eliminates 1 LLM call per conversation for users with preferred apps
  • Estimated 2-3% reduction in total costs
  • Uses llm_mini so cost per call is small, but volume is high

Risk

Low — suggested_summarization_apps field won't be populated for these users, but it's unused when preferred app is set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    intelligenceLayer: Summaries, insights, action itemsmaintainerLane: High-risk, cross-system changesp2Priority: Important (score 14-21)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions