{"record":{"id":"0a453135608d1ae8","repo":"microsoft/autogen","slug":"no-more-recorded-turns-to-check","errorCode":null,"errorMessage":"No more recorded turns to check.","messagePattern":"No more recorded turns to check\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/experimental/task_centric_memory/utils/chat_completion_client_recorder.py","lineNumber":118,"sourceCode":"                json_output=json_output,\n                tool_choice=tool_choice,\n                extra_create_args=extra_create_args,\n                cancellation_token=cancellation_token,\n            )\n\n            rec: RecordDict = {\n                \"mode\": \"create\",\n                \"messages\": current_messages,\n                \"response\": response.model_dump(),\n                \"stream\": [],\n            }\n            self.records.append(rec)\n            return response\n        elif self.mode == \"replay\":\n            if self._record_index >= len(self.records):\n                error_str = \"\\nNo more recorded turns to check.\"\n                self.logger.error(error_str)\n                raise ValueError(error_str)\n            rec = self.records[self._record_index]\n            if rec.get(\"mode\") != \"create\":\n                error_str = f\"\\nRecorded call type mismatch at index {self._record_index}: expected 'create', got '{rec.get('mode')}'.\"\n                self.logger.error(error_str)\n                raise ValueError(error_str)\n            recorded_messages = rec.get(\"messages\")\n            if recorded_messages != current_messages:\n                error_str = (\n                    \"\\nCurrent message list doesn't match the recorded message list. See the pagelogs for details.\"\n                )\n                assert recorded_messages is not None\n                self.logger.log_dict_list(recorded_messages, \"recorded message list\")\n                assert current_messages is not None\n                self.logger.log_dict_list(current_messages, \"current message list\")\n                self.logger.error(error_str)\n                raise ValueError(error_str)\n            self._record_index += 1\n            self._num_checked_records += 1","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/experimental/task_centric_memory/utils/chat_completion_client_recorder.py#L100-L136","documentation":"Raised in replay mode when the code under test makes more create() calls than were recorded: the replay index has consumed all records. It usually means the current conversation diverged from the recorded one and produced an extra LLM call.","triggerScenarios":"Running with mode='replay' after the agent's logic changed to issue an additional LLM request per run (new tool loop iteration, extra agent turn), or replaying against a test flow with more create() calls than the session captured.","commonSituations":"Code changes adding retries or extra LLM calls after the session was recorded, non-deterministic agent loops (extra tool-call round), tests sharing one session file in different orders, sessions recorded with a different library version.","solutions":["If the code legitimately makes more calls now, re-record the session with mode='record' and use the new file.","Check the pagelogs/logger output just before the failure to see which call diverged.","Make the agent flow deterministic (fixed tool outputs, seeded decisions) so call counts match the recording."],"exampleFix":"# before\nclient = ChatCompletionClientRecorder(inner, mode=\"replay\", session_file_path=\"sessions/old.json\")\n# ValueError: No more recorded turns to check.\n\n# after\n# re-record once with the new flow, then replay:\nclient = ChatCompletionClientRecorder(inner, mode=\"record\", session_file_path=\"sessions/new.json\")\nrun_agent()  # then switch back to mode=\"replay\"","handlingStrategy":"try-catch","validationCode":"import json\nfrom pathlib import Path\n\ndef session_covers(session_file: str, expected_calls: int) -> bool:\n    records = json.loads(Path(session_file).read_text())\n    return len(records) >= expected_calls","typeGuard":null,"tryCatchPattern":"try:\n    await run_under_replay(client)\nexcept ValueError as e:\n    if \"No more recorded turns\" in str(e):\n        pytest.fail(\"Agent issued more LLM calls than recorded - re-record the session\")\n    raise","preventionTips":["Re-record sessions whenever agent logic changes the number of LLM calls.","Keep replayed flows deterministic (fixed tool outputs, seeds).","Treat 'No more recorded turns' as a test-maintenance signal, not a flake."],"tags":["replay","testing","determinism"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}