From 0023b904e4a153a647ac0c8a5ea5d2a1d61a61c2 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Wed, 16 Sep 2026 12:29:38 -0700 Subject: [PATCH] fix(compression): re-arm the drifted-prompt INFO on session reset so it is once per session The INFO-once flag `_compaction_prompt_drift_logged` lived on the AIAgent and was never cleared, so on a CLI agent that /new, /resume or /branch-rebinds sessions the line was INFO once per agent lifetime, not once per session as the commit and PR text claim. reset_session_state is the per-session reset point for agent-held counters (`_user_turn_count` lives there); clear the flag alongside it. --- run_agent.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run_agent.py b/run_agent.py index 61263d4ebf..67eac17cf7 100644 --- a/run_agent.py +++ b/run_agent.py @@ -404,6 +404,8 @@ class AIAgent( # Turn counter (added after reset_session_state was first written — #2635) self._user_turn_count = 0 + # The drifted-prompt compaction INFO is once per session, so a /new or /resume re-arms it. + self._compaction_prompt_drift_logged = False # Who wrote the current turn. build_turn_context() sets it at the start of every turn. self._turn_author = None # Copilot x-initiator: True for the first API call of a user turn, False for tool-loop follow-ups.