From e1951ce704d451cf75518879df684a4fbc24140b Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sun, 31 May 2026 21:20:51 -0700 Subject: [PATCH] fix(memory): only forward rewound kwarg when set The on_session_switch fan-out passed rewound=rewound unconditionally, injecting rewound=False into every provider's **kwargs on the common /resume, /branch, /new, and compression paths. Providers that capture extra kwargs into an 'extra' dict (and the exact-dict-equality tests guarding them) broke. Forward rewound only when truthy; /undo sets it explicitly, everyone else stays clean. --- agent/memory_manager.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/agent/memory_manager.py b/agent/memory_manager.py index 11ab353bc..aabd31ec6 100644 --- a/agent/memory_manager.py +++ b/agent/memory_manager.py @@ -511,13 +511,20 @@ class MemoryManager: """ if not new_session_id: return + # Only forward ``rewound`` when it's actually set. Passing it + # unconditionally would inject ``rewound=False`` into every + # provider's **kwargs for the common /resume, /branch, /new, and + # compression paths, polluting providers that capture extra kwargs + # (and breaking exact-dict assertions). The /undo path sets + # rewound=True explicitly; everyone else stays clean. + if rewound: + kwargs["rewound"] = True for provider in self._providers: try: provider.on_session_switch( new_session_id, parent_session_id=parent_session_id, reset=reset, - rewound=rewound, **kwargs, ) except Exception as e: