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 <id> 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.
This commit is contained in:
teknium1
2026-09-16 12:14:53 -07:00
committed by Teknium
parent 6671365fb2
commit ff8dcbe87b

View File

@@ -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