fix: store full AI response in convo_miner exchange chunking (#695)

This commit is contained in:
shafdev
2026-04-13 02:53:52 +05:30
committed by GitHub
parent 091c2fe1c6
commit d52d6c9622
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ def _chunk_by_exchange(lines: list) -> list:
ai_lines.append(next_line.strip())
i += 1
ai_response = " ".join(ai_lines[:8])
ai_response = " ".join(ai_lines)
content = f"{user_turn}\n{ai_response}" if ai_response else user_turn
if len(content.strip()) > MIN_CHUNK_SIZE:
+11
View File
@@ -47,6 +47,17 @@ class TestChunkExchanges:
# Too short to produce chunks (below MIN_CHUNK_SIZE)
assert isinstance(chunks, list)
def test_long_ai_response_not_truncated(self):
"""AI responses longer than 8 lines must be stored in full (verbatim principle)."""
lines = [f"Step {i}: important detail that must be stored" for i in range(1, 14)]
content = "> How do I implement authentication?\n" + "\n".join(lines)
chunks = chunk_exchanges(content)
assert len(chunks) >= 1
stored = chunks[0]["content"]
# All 13 lines must be present — none silently dropped
for i in range(1, 14):
assert f"Step {i}:" in stored, f"Step {i} was truncated and not stored"
class TestDetectConvoRoom:
def test_technical_room(self):