From cf7790ca3b9531c0ea76d8ca01a790235a32420d Mon Sep 17 00:00:00 2001 From: ciregenz Date: Wed, 19 Aug 2026 16:51:35 -0700 Subject: [PATCH] [eric] agents: status flips to running BEFORE the user-message snapshot; a stale completed on disk hid follow-up-turn crashes from the boot detector (exp.19 drill catch) --- backend/apps/agents/manager/Messaging.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/apps/agents/manager/Messaging.py b/backend/apps/agents/manager/Messaging.py index 0be6f19b..bc1e1cdf 100644 --- a/backend/apps/agents/manager/Messaging.py +++ b/backend/apps/agents/manager/Messaging.py @@ -134,6 +134,10 @@ class Messaging(AgentManagerProtocol): client_message_id=client_message_id, ) session.messages.append(user_msg) + # Status flips BEFORE the snapshot: the old order persisted a stale "completed" from the + # prior turn, so a dirty death during a follow-up turn was invisible to the boot-time crash + # detector (drilled live: round-2 kill -9 resumed nothing because disk said completed). + session.status = "running" snapshot_session_now(session) await ws_manager.send_to_session(session_id, "agent:message", { "session_id": session_id, @@ -279,6 +283,8 @@ class Messaging(AgentManagerProtocol): attached_skills=target_msg.attached_skills, ) session.messages.append(edited_msg) + # Same status-before-snapshot rule as send_message: a stale terminal status on disk hides a mid-turn dirty death from the crash detector. + session.status = "running" snapshot_session_now(session) await ws_manager.send_to_session(session_id, "agent:message", {