fix(agent): reset recovery chains across injections

Reset both the recovered segments and retry budget whenever injected input starts a new logical answer. Cover fatal tool-error boundaries and rename the prompt test module so pytest can collect the full suite.
This commit is contained in:
chengyongru
2026-07-27 01:39:46 +08:00
committed by Xubin Ren
parent 154cbc1974
commit 1d2ed6e4d2
3 changed files with 25 additions and 8 deletions
@@ -0,0 +1,16 @@
"""Tests for length-recovery prompt construction."""
from nanobot.utils.runtime import build_length_recovery_message
def test_length_recovery_message_anchors_the_existing_tail() -> None:
omitted_prefix = "OMITTED_PREFIX"
tail = "x" * 64
message = build_length_recovery_message(omitted_prefix + tail)
assert message["role"] == "user"
assert omitted_prefix not in message["content"]
assert f"<already_delivered_tail>\n{tail}\n</already_delivered_tail>" in message["content"]
assert "Output only new continuation text" in message["content"]
assert "Break remaining work into smaller steps" not in message["content"]