test(cli): cover retry-wait interactive routing
Keep provider retry wait messages on the interactive progress path so they do not fall through as assistant responses. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
Xubin Ren
co-authored by
Cursor
parent
c15d816d9c
commit
66682eb46f
@@ -0,0 +1,31 @@
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from nanobot.cli import commands
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_interactive_retry_wait_is_rendered_as_progress_even_when_progress_disabled():
|
||||
"""Provider retry waits should not fall through as assistant responses."""
|
||||
calls: list[tuple[str, object | None]] = []
|
||||
thinking = None
|
||||
channels_config = SimpleNamespace(send_progress=False, send_tool_hints=False)
|
||||
msg = SimpleNamespace(
|
||||
content="Model request failed, retry in 2s (attempt 1).",
|
||||
metadata={"_retry_wait": True},
|
||||
)
|
||||
|
||||
async def fake_print(text: str, active_thinking: object | None) -> None:
|
||||
calls.append((text, active_thinking))
|
||||
|
||||
with patch("nanobot.cli.commands._print_interactive_progress_line", side_effect=fake_print):
|
||||
handled = await commands._maybe_print_interactive_progress(
|
||||
msg,
|
||||
thinking,
|
||||
channels_config,
|
||||
)
|
||||
|
||||
assert handled is True
|
||||
assert calls == [("Model request failed, retry in 2s (attempt 1).", thinking)]
|
||||
Reference in New Issue
Block a user