fix(memory): drop scrub from interim commentary + final response

Same layering concern as the persisted-assistant scrub already removed:
_emit_interim_assistant_message and the final_response return path were
mutating model output broadly.  Streaming scrubber covers real leaks
delta-by-delta; these post-stream scrubs were redundant.
This commit is contained in:
Erosika
2026-04-27 14:53:53 -04:00
committed by kshitij
parent 49e3a1d8ee
commit 4a9ac5c355
2 changed files with 10 additions and 11 deletions

View File

@@ -6069,7 +6069,7 @@ class AIAgent:
if cb is None or not isinstance(assistant_msg, dict):
return
content = assistant_msg.get("content")
visible = sanitize_context(self._strip_think_blocks(content or "")).strip()
visible = self._strip_think_blocks(content or "").strip()
if not visible or visible == "(empty)":
return
already_streamed = self._interim_content_was_streamed(visible)
@@ -12748,9 +12748,7 @@ class AIAgent:
truncated_response_prefix = ""
length_continue_retries = 0
# Strip internal context / reasoning wrappers from the user-facing
# response (keep only clean visible text in transcript + UI).
final_response = sanitize_context(self._strip_think_blocks(final_response)).strip()
final_response = self._strip_think_blocks(final_response).strip()
final_msg = self._build_assistant_message(assistant_message, finish_reason)