From ff8dcbe87bd6ab480ef55c8366ab381748aec70f Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Wed, 16 Sep 2026 12:14:53 -0700 Subject: [PATCH] test: state that /new is deliberately exempt from the mid-turn switch guard Reviewers asked why /new still rotates agent.session_id mid-turn while /branch, /resume and /sessions now refuse. new_session flushes the in-flight turn to the old session before rotating (#47202), so the refusal rationale does not apply; record that in the invariant suite's docstring so the exemption reads as a choice, not an omission. --- tests/hermes_cli/test_session_switch_mid_turn_guard.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/hermes_cli/test_session_switch_mid_turn_guard.py b/tests/hermes_cli/test_session_switch_mid_turn_guard.py index e777a0de02..c4070a8535 100644 --- a/tests/hermes_cli/test_session_switch_mid_turn_guard.py +++ b/tests/hermes_cli/test_session_switch_mid_turn_guard.py @@ -4,6 +4,9 @@ The classic CLI shares ONE agent object across sessions: a switch ends the curre repoints ``agent.session_id`` (``_sync_agent_to_session``), so a still-running turn would flush its remaining messages onto the switched-to session. ``/handoff`` already refuses mid-turn for the same reason; these commands must match it. See #112137. + +``/new`` is intentionally NOT guarded: ``new_session`` flushes the in-flight turn to the old session +before rotating (flush-then-rotate, #47202), so nothing lands on the wrong row. """ import pytest