From df4c786279ee2844c16a4a0fc60bc6d32e4b7988 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Mon, 7 Sep 2026 00:04:45 +0530 Subject: [PATCH] docs(gateway): say WHY the replay sidecar survives a timestamp-only render --- gateway/run.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gateway/run.py b/gateway/run.py index fdd646195e..d6bfc83ec1 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -1059,8 +1059,8 @@ def _build_replay_entry( providers. """ entry: Dict[str, Any] = {"role": role, "content": content} - # Preserve exact sent content unless cleanup rewrote the body. - # Timestamp-only rendering is checked separately by the history builder. + # api_content sidecar keeps the request prefix byte-stable — ONLY if this pipeline did not rewrite + # content. The caller renders timestamps AFTER this check so a stamp alone never drops the sidecar. _sidecar = msg.get("api_content") if ( role in ("user", "assistant") @@ -1208,7 +1208,7 @@ def _build_gateway_agent_history( if msg.get("mirror"): mirror_src = msg.get("mirror_source", "another session") entry["content"] = f"[Delivered from {mirror_src}] {entry['content']}" - entry.pop("api_content", None) + entry.pop("api_content", None) # prefix rewrite: the sidecar no longer matches agent_history.append(entry) # Strip interrupted tool-call tails so the LLM doesn't re-execute tools killed mid-flight.