Skip to content

The agent that grows with you

fix(tui_gateway): session.set_hidden requires an explicit hidden flag (#122190, salvage #122568)

teknium128365a5bec35
diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.ts
index 7548bf292a9..8d17a583d2d 100644
--- a/apps/shared/src/gateway-contract.generated.ts
+++ b/apps/shared/src/gateway-contract.generated.ts
@@ -3057,7 +3057,7 @@ export interface SessionTitleResult {
/** ``session_id`` is a live runtime id first, else a stored id / key / title. */
export interface SessionSetHiddenParams {
session_id: string
- hidden?: boolean
+ hidden: boolean
profile?: string | null
}
export interface SessionSetHiddenResult {
diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.json
index bcb93cda2e7..fc40e122f96 100644
--- a/apps/shared/src/gateway-contract.openrpc.json
+++ b/apps/shared/src/gateway-contract.openrpc.json
@@ -30982,7 +30982,6 @@
"type": "string"
},
"hidden": {
- "default": true,
"title": "Hidden",
"type": "boolean"
},
@@ -31000,7 +30999,8 @@
}
},
"required": [
- "session_id"
+ "session_id",
+ "hidden"
],
"title": "SessionSetHiddenParams",
"type": "object"
diff --git a/tests/tui_gateway/test_session_hidden_rpc.py b/tests/tui_gateway/test_session_hidden_rpc.py
index 05f2c7a690b..8026856713d 100644
--- a/tests/tui_gateway/test_session_hidden_rpc.py
+++ b/tests/tui_gateway/test_session_hidden_rpc.py
@@ -60,13 +60,7 @@ def test_set_hidden_unknown_id_still_errors(db):
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."""
+ """#122190: a flag-less ``session.set_hidden`` is rejected, never treated as hide."""
_seed(db, "plain-chat")
assert db.get_session("plain-chat")["hidden"] == 0
@@ -75,8 +69,6 @@ def test_set_hidden_without_flag_leaves_visible_session_alone(db):
assert db.get_session("plain-chat")["hidden"] == 0
-
-
def test_session_list_include_hidden(db):
_seed(db, "plain-chat")
_seed(db, "bot-chat")
diff --git a/tui_gateway/contracts/sessions.py b/tui_gateway/contracts/sessions.py
index 73e0b397ac8..a5a90291a27 100644
--- a/tui_gateway/contracts/sessions.py
+++ b/tui_gateway/contracts/sessions.py
@@ -312,7 +312,7 @@ class SessionSetHiddenParams(Params):
"""``session_id`` is a live runtime id first, else a stored id / key / title."""
session_id: str
- hidden: bool = True
+ hidden: bool
profile: str | None = None
diff --git a/tui_gateway/methods_session.py b/tui_gateway/methods_session.py
index cd71c8927cf..55babcb088b 100644
--- a/tui_gateway/methods_session.py
+++ b/tui_gateway/methods_session.py
@@ -1197,12 +1197,10 @@ def _(rid, params: dict) -> dict:
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 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."""
+ ``hidden`` is required: a default of True hid the whole lineage for any caller that dropped the flag (#122190)."""
if "hidden" not in params:
return _err(rid, 4021, "hidden required")
- hidden = is_truthy_value(params.get("hidden"))
+ hidden = is_truthy_value(params["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.