b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
"""Regression tests for CLI /retry history replacement semantics."""
|
|
|
|
from tests.cli.test_cli_init import _make_cli
|
|
|
|
|
|
def test_retry_last_truncates_history_before_requeueing_message():
|
|
cli = _make_cli()
|
|
cli.conversation_history = [
|
|
{"role": "user", "content": "first"},
|
|
{"role": "assistant", "content": "one"},
|
|
{"role": "user", "content": "retry me"},
|
|
{"role": "assistant", "content": "old answer"},
|
|
]
|
|
|
|
retry_msg = cli.retry_last()
|
|
|
|
assert retry_msg == "retry me"
|
|
assert cli.conversation_history == [
|
|
{"role": "user", "content": "first"},
|
|
{"role": "assistant", "content": "one"},
|
|
]
|
|
|
|
cli.conversation_history.append({"role": "user", "content": retry_msg})
|
|
cli.conversation_history.append({"role": "assistant", "content": "new answer"})
|
|
|
|
assert [m["content"] for m in cli.conversation_history if m["role"] == "user"] == [
|
|
"first",
|
|
"retry me",
|
|
]
|
|
|
|
|
|
def test_process_command_retry_requeues_original_message_not_retry_command():
|
|
cli = _make_cli()
|
|
queued = []
|
|
|
|
class _Queue:
|
|
def put(self, value):
|
|
queued.append(value)
|
|
|
|
cli._pending_input = _Queue()
|
|
cli.conversation_history = [
|
|
{"role": "user", "content": "retry me"},
|
|
{"role": "assistant", "content": "old answer"},
|
|
]
|
|
|
|
cli.process_command("/retry")
|
|
|
|
assert queued == ["retry me"]
|
|
assert cli.conversation_history == []
|