From c4794b82a9b09ababf9737712c165b15cd230ed4 Mon Sep 17 00:00:00 2001 From: Wayne Heng Date: Mon, 18 May 2026 17:56:44 +0800 Subject: [PATCH] fix(webui): accept end/error phases in backend transcript replay Match the frontend fix: tool_trace_lines_from_events now processes end and error phases with call_id deduplication so transcript replay shows tool calls correctly. Co-authored-by: Sisyphus --- nanobot/utils/webui_transcript.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nanobot/utils/webui_transcript.py b/nanobot/utils/webui_transcript.py index bee71c542..31d10380b 100644 --- a/nanobot/utils/webui_transcript.py +++ b/nanobot/utils/webui_transcript.py @@ -99,11 +99,17 @@ def tool_trace_lines_from_events(events: Any) -> list[str]: if not isinstance(events, list): return [] lines: list[str] = [] + seen: set[str] = set() for event in events: if not event or not isinstance(event, dict): continue - if event.get("phase") != "start": + if event.get("phase") not in {"start", "end", "error"}: continue + call_id = event.get("call_id") + if call_id is not None and call_id in seen: + continue + if call_id is not None: + seen.add(call_id) t = _format_tool_call_trace(event) if t: lines.append(t)