From 52feffdc8fddf2fa27b16bd0b29b26bfba01a81a Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sat, 14 Nov 2026 03:12:30 -0800 Subject: [PATCH] fix(session_search): hidden-lineage note recommends a plain read, not a rejected scroll Greptile: Recovery advice leads to rejection. _scroll rejects anchors in the current lineage (the exact sessions disclosed) and the note gave no anchor; a session_id-only read works, and the test now follows the advice. --- tests/tools/test_session_search.py | 6 ++++++ tools/session_search_tool.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_session_search.py b/tests/tools/test_session_search.py index b3b9366d6b..b2082200af 100644 --- a/tests/tools/test_session_search.py +++ b/tests/tools/test_session_search.py @@ -1268,6 +1268,12 @@ class TestSameLineageHiddenDisclosure: assert "s_lost" in sessions lost = next(s for s in hidden["sessions"] if s["session_id"] == "s_lost") assert lost["end_reason"] is None # the tell-tale of the lost end-write + # The recovery the note recommends must work: a plain read of the disclosed id + # (scroll rejects anchors in the current lineage, so the note must not suggest it). + assert "around_message_id" not in hidden["note"] + read = json.loads(session_search(session_id="s_lost", db=db, current_session_id="s_cur")) + assert read["success"] is True and read["mode"] == "read" + assert any("zephyrwidgets" in m["content"] for m in read["messages"]) def test_current_session_live_rows_not_disclosed_as_hidden(self, db): """The current session's own live rows are already in context — diff --git a/tools/session_search_tool.py b/tools/session_search_tool.py index 40a939663e..b671181c36 100644 --- a/tools/session_search_tool.py +++ b/tools/session_search_tool.py @@ -447,8 +447,8 @@ def _discover(db, query: str, role_filter: Optional[list[str]], limit: int, sort **({"hidden_same_lineage": {"count": hidden_rows, "sessions": list(hidden_sessions.values()), "note": f"{hidden_rows} matching message(s) in {len(hidden_sessions)} same-lineage session(s) " "were hidden because they are still treated as live context (unended). This can be a gateway " - "session whose end-write was lost. To read one anyway, scroll it directly: " - "session_search(session_id=..., around_message_id=...)."}} if hidden_rows else {}), + "session whose end-write was lost. To read one anyway, pass only its session_id: " + "session_search(session_id=...)."}} if hidden_rows else {}), link_hint=( "When referring the user to a session, write its `link` value " "verbatim inline mid-sentence (it renders as a titled link) — never "