Skip to content

Fix coaching max_turns=0 treated as missing (defaulted to 10) #330

Description

@mottych

Problem

When a conversation coaching topic has max_turns set to 0 (unlimited), sessions were still capped at 10 turns. Users reported hitting the limit on guided goal creation despite the topic being configured for unlimited turns.

Root cause

CoachingSessionService resolved max turns with a falsy chain: get("max_turns") or ... or 10. In Python, 0 is falsy, so an explicit max_turns: 0 was skipped and the default 10 was applied.

Fix

  • Centralize resolution in resolve_max_turns_from_additional_config (key presence / None checks so 0 is honored).
  • Use the same helper for admin topic detail (max_turns vs legacy estimated_messages).

Verification

  • Unit tests: coaching/tests/unit/core/test_topic_conversation_limits.py
  • Domain behavior for max_turns == 0 was already correct once the session entity received the right value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions