From 1f3407aa002a97347553eee5d7a14977c1a1aaf8 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Mon, 14 Sep 2026 20:29:40 +0530 Subject: [PATCH] fix(cli): sync session id after quiet -Q follow-up turns _follow_up now calls _sync_cli_session_id_from_agent like the main turn, so a mid-run compression rotation during a follow-up turn cannot leave a stale session id on the stderr exit line (read by automation wrappers) or on the notify-drain ownership key. --- cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli.py b/cli.py index 53cb5aff0a..a30db87344 100644 --- a/cli.py +++ b/cli.py @@ -4113,6 +4113,9 @@ def _run_quiet_single_query(cli, effective_query): ) if isinstance(follow, dict) and follow.get("messages"): history = follow["messages"] + # Same sync contract as the main turn: a compression rotation during a + # follow-up must not leave a stale id on the exit line / drain key. + _sync_cli_session_id_from_agent(cli) return follow # One shared linger budget for the whole run: the loop below and the later