The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tui): require explicit hidden flag on session.set_hidden A missing hidden param defaulted to True, so any caller that dropped it silently hid the session plus its whole compression lineage (set_session_hidden fans out via _set_lineage_column). Related to #122190.
finn76343d09822ae12
diff --git a/tests/tui_gateway/test_session_hidden_rpc.py b/tests/tui_gateway/test_session_hidden_rpc.pyindex c23b38a7871..05f2c7a690b 100644--- a/tests/tui_gateway/test_session_hidden_rpc.py+++ b/tests/tui_gateway/test_session_hidden_rpc.py@@ -59,6 +59,22 @@ def test_set_hidden_unknown_id_still_errors(db):assert envelope.get("error"), envelope+def test_set_hidden_without_flag_leaves_visible_session_alone(db):+ """Regression for #122190: a ``session.set_hidden`` call with no explicit+ ``hidden`` flag must not hide anything. The handler used to default the+ missing flag to True, so any caller that dropped the param (stale client,+ profile-switch retry, typo ``hide``) silently hid the session — and+ ``set_session_hidden`` propagates across the whole compression lineage,+ which is exactly the "whole chain hidden=1, user never hid anything"+ shape from the issue."""+ _seed(db, "plain-chat")+ assert db.get_session("plain-chat")["hidden"] == 0++ envelope = _call("session.set_hidden", {"session_id": "plain-chat"})+ assert envelope.get("error"), envelope+ assert db.get_session("plain-chat")["hidden"] == 0++def test_session_list_include_hidden(db):diff --git a/tui_gateway/methods_session.py b/tui_gateway/methods_session.pyindex feea676c0fd..cd71c8927cf 100644--- a/tui_gateway/methods_session.py+++ b/tui_gateway/methods_session.py@@ -1196,8 +1196,13 @@ def _(rid, params: dict) -> dict:@method("session.set_hidden")def _(rid, params: dict) -> dict:"""Set/clear ``hidden`` (leaves the default list, stays resumable by its owner) on a session + lineage:- LIVE runtime id first (unpersisted drafts via ``pending_hidden``), then a stored id/key in the profile db."""- hidden = is_truthy_value(params.get("hidden", True))+ LIVE runtime id first (unpersisted drafts via ``pending_hidden``), then a stored id/key in the profile db.+ ``hidden`` is required: defaulting a missing flag to True let any caller that dropped the param+ silently hide the session (and the whole compression lineage, via ``set_session_hidden``) —+ the "user never hid anything" shape in #122190."""+ if "hidden" not in params:+ return _err(rid, 4021, "hidden required")+ hidden = is_truthy_value(params.get("hidden"))# Quiet live lookup: a stored id that is not in memory is this method's expected second tier, not a# rejection — _sess_nowait would log "session-scoped RPC rejected … not in memory" for a request that is# then fulfilled from the profile db, burying the real stale-runtime-id signal under sweep noise.