The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(gateway): prove the unreadable-row negative actually reads the row
kshitijk4poor2e7c3322a471
diff --git a/gateway/run_topics.py b/gateway/run_topics.pyindex ffdd2a7331f..2d01dee33a1 100644--- a/gateway/run_topics.py+++ b/gateway/run_topics.py@@ -308,7 +308,8 @@ class GatewayTopicThreadsMixin:# row keeps the opening origin until that entry's first peer refresh overwrites it.db = self.session_store._db_for_key(session_key)row = db.get_session(entry.session_id) if db is not None else None- raw, origin = (row or {}).get("origin_json"), None+ raw = (row or {}).get("origin_json")+ origin = Noneif raw:with suppress(ValueError, KeyError, TypeError): # malformed/legacy row: no recoveryorigin = SessionSource.from_dict(json.loads(raw))diff --git a/tests/gateway/test_session_title_rename_lane.py b/tests/gateway/test_session_title_rename_lane.pyindex 06ec5c40b20..1c2a8d4c41c 100644--- a/tests/gateway/test_session_title_rename_lane.py+++ b/tests/gateway/test_session_title_rename_lane.py@@ -120,7 +120,11 @@ def test_discord_title_retry_recovers_auto_thread_origin(rebuilt_entry):assert (session_id, title) == ("sess-1", "Recovered semantic title")+_UNREADABLE_CALLS: list = []++def _unreadable(session_id):+ _UNREADABLE_CALLS.append(session_id)raise RuntimeError("state.db unavailable")@@ -139,6 +143,8 @@ def test_discord_title_retry_never_borrows_markers_from_another_origin(entry_ori)assert not hasattr(agent, "_on_session_title")assert scheduled == []+ if get_session is _unreadable: # the failing row read ran and was contained+ assert _UNREADABLE_CALLS == ["sess-1"]@pytest.mark.anyio