Skip to content

Honor max_turns=0 end-to-end for unlimited coaching sessions #331

@mottych

Description

@mottych

Problem

Conversation coaching topics should support max_turns = 0 as unlimited end to end.

Today an admin can define max_turns: 0 on a topic such as goals, and the topic detail response still shows 0, but users can still get blocked after 10 turns. That means the value is not being preserved and interpreted consistently across the full topic -> session -> execution pipeline.

Required behavior

  • If an admin defines max_turns: 0, that exact value must be stored as 0.
  • When creating a session, 0 must be preserved on the session and treated as unlimited turns.
  • If max_turns is undefined / None, the default should be 0.
  • Code must explicitly distinguish between:
    • 0 meaning unlimited
    • missing / None meaning use default

End-to-end paths to verify

Check the full flow and make sure 0 is handled correctly at every step:

  1. Topic definition / admin update
  2. Topic persistence in DynamoDB additional_config
  3. Topic readback in admin/detail responses
  4. Session creation from topic config
  5. Session persistence in DynamoDB (session.max_turns)
  6. Turn-limit enforcement during message handling
  7. Workflow/conversation decision logic so unlimited does not get converted into a hidden fallback cap

Notes

  • The bug pattern here is treating 0 as falsy (for example, config.get("max_turns") or 10), which collapses explicit unlimited into a fallback limit.
  • The fix should use key-presence / None checks instead of truthiness checks.

Acceptance criteria

  • Topic with max_turns: 0 results in new sessions with max_turns: 0
  • Users on those sessions are not blocked at 10 turns
  • Missing max_turns defaults to 0
  • Unit tests cover explicit 0, missing, and None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions