Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion emrg/server/daemon.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -2425,7 +2425,13 @@ async def _run_tool_loop(
return

full_content = "".join(content_parts)
full_reasoning = "".join(reasoning_parts) or None
# llm.py yields the ACCUMULATED reasoning snapshot on every chunk
# (contract: chunk["reasoning"] = full think text so far, see
# llm.py:366). Appending every snapshot and joining would
# double-accumulate → O(n²) blowup (29640 chars for 47 real tokens,
# up to 10MB records in llm.jsonl, rant 2026-08-23T10:15:06). Take the
# LAST snapshot = complete think text.
full_reasoning = reasoning_parts[-1] if reasoning_parts else None
logger.debug("round %d finish: %s, tool_calls=%d, content_len=%d%s",
round_num, final_finish, len(tc_by_index), len(full_content),
self._format_cache_pct(final_usage))
Expand Down
Loading