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.
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
CoachingSessionServiceresolved max turns with a falsy chain:get("max_turns") or ... or 10. In Python,0is falsy, so an explicitmax_turns: 0was skipped and the default 10 was applied.Fix
resolve_max_turns_from_additional_config(key presence / None checks so 0 is honored).max_turnsvs legacyestimated_messages).Verification
coaching/tests/unit/core/test_topic_conversation_limits.pymax_turns == 0was already correct once the session entity received the right value.