fix(agent): keep tool results stable across replay (#5695)

* fix(agent): keep processed tool results stable across replay

* fix(agent): preserve multimodal text and complete result references

* docs: trim tool result persistence comments

* fix(tools): allow complete reads of oversized text lines

* fix: keep read_file interface unchanged in replay fix

* refactor: pass one tool result reference path

* refactor: keep tool result persistence text-only

* fix: keep tool output references stable across workspace changes
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-08 14:10:55 +08:00
1 parent 7aaff4f66b
commit e77c638f89
6 files changed
+333 -67

No files matched your search

+4 -7
View File
@@ -1,15 +1,12 @@
from types import SimpleNamespace
def test_sanitize_persisted_blocks_truncates_text() -> None:
def test_sanitize_persisted_blocks_preserves_tool_text() -> None:
from nanobot.agent.loop import AgentLoop
dummy = SimpleNamespace(max_tool_result_chars=5)
dummy = SimpleNamespace()
content = [{"type": "text", "text": "0123456789"}]
out = AgentLoop._sanitize_persisted_blocks(dummy, content, should_truncate_text=True)
assert isinstance(out, list)
assert out and out[0]["type"] == "text"
assert isinstance(out[0]["text"], str)
assert out[0]["text"] != content[0]["text"]
out = AgentLoop._sanitize_persisted_blocks(dummy, content)
assert out == content