Skip to content

The agent that grows with you

refactor(tui-gateway): state the depth-gate WHY without incident narration

kshitijk4poor9e99692b28e4
diff --git a/tui_gateway/methods_prompt.py b/tui_gateway/methods_prompt.py
index 221609bcaff..3f4eb68af1c 100644
--- a/tui_gateway/methods_prompt.py
+++ b/tui_gateway/methods_prompt.py
@@ -464,9 +464,8 @@ def _truncate_history_for_submit(rid, sid, session, params, requested_rebind_ids
rid, 4028,
"truncation would erase the entire session transcript; "
"resubmit with confirm_empty_truncate=true if this is intended"), {}
- # Depth gate (#133716): a valid anchor can still name the wrong row (a stale client
- # binding replayed a 4-hour-old turn and archived 107 messages). Tail regenerate and
- # edit-last drop exactly the target turn; anything deeper needs its own opt-in.
+ # Depth gate: a valid anchor can still name a stale row; tail regenerate / edit-last
+ # drop exactly one user turn, deeper cuts need confirm_deep_truncate.
archived_user_turns = len(_history_user_indices(history)) - ordinal
if archived_user_turns > 1 and not is_truthy_value(params.get("confirm_deep_truncate")):
archived_messages = len(history) - len(truncated)