From 4e2a7017907424e0ae31ea17f3b059daaad79329 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 2 Sep 2026 19:24:12 -0700 Subject: [PATCH] refactor(agent/session_persistence): collapse nested if (SIM102) --- agent/session_persistence.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/agent/session_persistence.py b/agent/session_persistence.py index d701d9dd43..8f5576f614 100644 --- a/agent/session_persistence.py +++ b/agent/session_persistence.py @@ -170,9 +170,11 @@ def _db_flush_row(agent, msg: Dict, is_current_turn_user: bool) -> Dict[str, Any api_content = None # get_messages_as_conversation replays rows through sanitize_context().strip(); capture the # sent bytes when they would differ (compared in wire form). - if api_content is None and role in ("user", "assistant") and isinstance(content, str) and content: - if sanitize_context(content).strip() != content.strip(): - api_content = content + if ( + api_content is None and role in ("user", "assistant") and isinstance(content, str) and content + and sanitize_context(content).strip() != content.strip() + ): + api_content = content # Key order is the divert-JSONL wire order (divert_session_transcript_jsonl). row = { "role": role,