Compare commits
8
Commits
known-good
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
298b7ac6f6 | ||
|
|
c7270b8d81 | ||
|
|
66b8743024 | ||
|
|
617a0129b7 | ||
|
|
3b4eb40f1e | ||
|
|
6b7f3889ea | ||
|
|
9240000e75 | ||
|
|
5248513ad1 |
+11
-3
@@ -378,6 +378,7 @@ class AgentLoop:
|
||||
)
|
||||
self._unified_session = unified_session
|
||||
self._running = False
|
||||
self._shutting_down = False
|
||||
self._mcp_servers = mcp_servers or {}
|
||||
self._mcp_stacks: dict[str, MCPConnection] = {}
|
||||
self._mcp_connecting = False
|
||||
@@ -1224,11 +1225,11 @@ class AgentLoop:
|
||||
# it into session history now makes it visible in the
|
||||
# next conversation turn.
|
||||
#
|
||||
# During gateway shutdown (self._running is False), skip
|
||||
# this so the pending markers survive and
|
||||
# During gateway shutdown (self._shutting_down is True),
|
||||
# skip this so the pending markers survive and
|
||||
# recover_stale_sessions() can notify the user and
|
||||
# re-trigger the interrupted turn on next startup.
|
||||
if self._running:
|
||||
if not self._shutting_down:
|
||||
try:
|
||||
key = self._effective_session_key(msg)
|
||||
session = self.sessions.get_or_create(key)
|
||||
@@ -1318,6 +1319,7 @@ class AgentLoop:
|
||||
def stop(self) -> None:
|
||||
"""Stop the agent loop."""
|
||||
self._running = False
|
||||
self._shutting_down = True
|
||||
logger.info("Agent loop stopping")
|
||||
|
||||
async def _process_message(
|
||||
@@ -2151,6 +2153,12 @@ class AgentLoop:
|
||||
sender_id=chat_id,
|
||||
chat_id=chat_id,
|
||||
content=last_user_msg["content"],
|
||||
# The message already exists in session history
|
||||
# (persisted before the crash); skip persisting it
|
||||
# again so recovery does not duplicate it.
|
||||
metadata={
|
||||
turn_continuation.SKIP_USER_PERSIST_META: True
|
||||
},
|
||||
)
|
||||
)
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user