Skip to content

Test failure: test_add_turn_max_limit fails due to MAX_CONVERSATION_TURNS mismatch #332

@yonaka15

Description

@yonaka15

Hi! I just pulled the latest changes from origin/main (commit 4d3d177) and ran into a test failure when running the quality checks. Spent a bit debugging this and found an interesting config mismatch.

Description

The test tests/test_conversation_memory.py::TestConversationMemory::test_add_turn_max_limit fails when .env contains MAX_CONVERSATION_TURNS=40 (which comes from .env.example).

Root Cause

Turns out there's a mismatch between the code default (50 in utils/conversation_memory.py:122) and what .env.example sets (40). The test uses the runtime value from .env, so it creates 40 turns and expects add_turn() to reject adding one more—but the check len(context.turns) >= MAX_CONVERSATION_TURNS (40 >= 40) should catch this, yet it doesn't seem to.

Failure Details

FAILED tests/test_conversation_memory.py::TestConversationMemory::test_add_turn_max_limit - assert True is False

Steps to Reproduce

  1. Make sure .env has MAX_CONVERSATION_TURNS=40 (default from .env.example)
  2. Run: python -m pytest tests/test_conversation_memory.py::TestConversationMemory::test_add_turn_max_limit -v
  3. Test fails

Workaround

Setting MAX_CONVERSATION_TURNS=50 in .env makes the test pass.

Suggested Fix

A few options to fix this:

  1. Update .env.example to MAX_CONVERSATION_TURNS=50 (align with code default)
  2. Or update the code default to 40 (align with .env.example)
  3. Alternatively, make the test explicitly set MAX_CONVERSATION_TURNS=50 via @patch.dict

Environment

  • Python: 3.12.11
  • pytest: 9.0.1
  • Git commit: 4d3d177 (latest from origin/main)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions