hermes-agent/tests/agent/test_partial_stream_continuation_prompt.py
kshitijk4poor b7f91258b9 fix(agent): tools-available note on dropped-tools continuation; keep legacy stub recognized (#74990)
The dropped-tools partial-stream continuation now also states the cut was a
transport interruption and tools remain available. The pre-rewording
network-stub text stays in the compressor's synthetic-turn set so
crash-persisted nudges from older sessions are not mistaken for user turns.
2026-09-24 22:27:18 +05:30

18 lines
862 B
Python

"""After a mid-stream transport cut the continuation must keep tools on the table (#74990)."""
import pytest
from agent import conversation_loop as cl
from agent.context_compressor import ContextCompressor
@pytest.mark.parametrize("dropped", [None, ["write_file"]])
def test_partial_stub_continuation_says_tools_remain_available(dropped):
prompt = cl._get_continuation_prompt(True, dropped).lower()
assert "tools" in prompt and "available" in prompt
assert "finish the answer directly" not in prompt
@pytest.mark.parametrize("dropped", [None, ["write_file"]])
def test_new_and_legacy_stub_nudges_are_recognized_as_synthetic(dropped):
for text in (cl._get_continuation_prompt(True, dropped), cl._LEGACY_LENGTH_CONTINUATION_NETWORK_STUB):
assert ContextCompressor._is_synthetic_compression_user_turn({"role": "user", "content": text})