fix: preserve per-match context decode failure isolation

This commit is contained in:
Teknium
2026-09-07 02:39:49 -07:00
parent 7e73ef4676
commit 68a6945ae8

View File

@@ -970,14 +970,16 @@ class SessionSearchMixin:
with self._read_ctx() as conn:
rows = conn.execute(sql, list(contexts)).fetchall()
for row in rows:
contexts[row["match_id"]].append({
"role": row["role"],
"content": _flatten_text(self._decode_content(row["content"]))[:200],
})
contexts[row["match_id"]].append(row)
except Exception:
contexts = {}
for match in batch:
match["context"] = contexts.get(match["id"], [])
try:
match["context"] = [
{"role": row["role"], "content": _flatten_text(self._decode_content(row["content"]))[:200]}
for row in contexts.get(match["id"], [])]
except Exception:
match["context"] = []
# No route selects full content; the pop guards any future one that does.
for match in matches:
match.pop("content", None)