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 "