fix: capture pending_user_turn before _restore_runtime_checkpoint clears it
Test Suite / Detect changes (push) Has been cancelled
Test Suite / Python (Windows, 3.14) (push) Has been cancelled
Test Suite / Python (minimum, 3.11) (push) Has been cancelled
Test Suite / Python (latest, 3.14 + coverage) (push) Has been cancelled
Test Suite / webui (push) Has been cancelled
Test Suite / docker (push) Has been cancelled

_restore_runtime_checkpoint() clears both the runtime_checkpoint and
pending_user_turn flags (lines 1966-1967). recover_stale_sessions()
checked had_pending AFTER calling it, so had_pending was always False
when a checkpoint existed. This meant the re-publish of the last user
message never happened — the user got a notification but the interrupted
turn was never re-triggered.
This commit is contained in:
nanobot
2026-07-28 14:13:23 +08:00
parent 206ab0943c
commit 79a0fd8ed0
+6 -1
View File
@@ -2063,7 +2063,12 @@ class AgentLoop:
try: try:
session = self.sessions.get_or_create(key) session = self.sessions.get_or_create(key)
changed = False changed = False
had_pending = False # Capture pending flag before _restore_runtime_checkpoint
# clears it (it clears both checkpoint and pending_turn at
# lines 1966-1967).
had_pending = bool(
session.metadata.get(self._PENDING_USER_TURN_KEY)
)
if self._restore_runtime_checkpoint(session): if self._restore_runtime_checkpoint(session):
changed = True changed = True
if self._restore_pending_user_turn(session): if self._restore_pending_user_turn(session):