Loop truncates last_response to 500 chars.
(self)
| 229 | |
| 230 | @pytest.mark.asyncio |
| 231 | async def test_max_response_length_truncated(self): |
| 232 | """Loop truncates last_response to 500 chars.""" |
| 233 | ctx = _make_context() |
| 234 | long_response = "x" * 1000 |
| 235 | ctx.conversation_history = [ |
| 236 | {"role": "assistant", "content": long_response}, |
| 237 | ] |
| 238 | ui = _make_ui() |
| 239 | q: asyncio.Queue = asyncio.Queue() |
| 240 | done = asyncio.Event() |
| 241 | |
| 242 | await q.put("go") |
| 243 | await q.put("exit") |
| 244 | |
| 245 | mock_convo = MagicMock() |
| 246 | mock_convo.process_conversation = AsyncMock() |
| 247 | |
| 248 | with patch( |
| 249 | "mcp_cli.chat.conversation.ConversationProcessor", |
| 250 | return_value=mock_convo, |
| 251 | ): |
| 252 | result = await run_agent_loop(ctx, ui, q, done) |
| 253 | |
| 254 | assert len(result) == 500 |
nothing calls this directly
no test coverage detected