Skip to content

The agent that grows with you

fix(yuanbao): preserve archived history on recall redaction

kshitij2d9b809ff0b7
diff --git a/gateway/platforms/yuanbao.py b/gateway/platforms/yuanbao.py
index 2e3ed0253b3..5c1a02401cd 100644
--- a/gateway/platforms/yuanbao.py
+++ b/gateway/platforms/yuanbao.py
@@ -1150,7 +1150,7 @@ class RecallGuardMiddleware(InboundMiddleware):
if entry.get("role") == "user" and entry.get("content") == recalled_text:
entry["content"] = cls._REDACTED
try:
- store.rewrite_transcript(sid, transcript)
+ store.rewrite_transcript(sid, transcript, active_only=True)
logger.info("[%s] Recall redact: session %s", adapter.name, session_key[:30])
except Exception as exc:
logger.warning("[%s] Recall redact failed: %s", adapter.name, exc)
@@ -1210,7 +1210,7 @@ class RecallGuardMiddleware(InboundMiddleware):
if target is not None:
target["content"] = cls._REDACTED
try:
- store.rewrite_transcript(sid, transcript)
+ store.rewrite_transcript(sid, transcript, active_only=True)
logger.info("[%s] Recall: redacted msg_id=%s (%s)", adapter.name, recalled_id, branch_label)
except Exception as exc:
logger.warning("[%s] Recall: rewrite_transcript failed: %s", adapter.name, exc)
diff --git a/gateway/session.py b/gateway/session.py
index d0e96461d6f..fa019133c05 100644
--- a/gateway/session.py
+++ b/gateway/session.py
@@ -3379,8 +3379,7 @@ class SessionStore:
compaction history that archive_and_compact() keeps on disk
(#38763). Callers rewriting the live transcript of a session that
may carry archived rows must pass ``active_only=True`` so only the
- live rows are replaced; callers that mean to purge (e.g. yuanbao
- recall redaction) keep the default.
+ live rows are replaced.
Returns ``True`` when the write lands (or there is no DB to write to)
and ``False`` when the canonical write fails. Most callers can ignore