@@ -1310,15 +1310,18 @@ def _handle_agent_failure(
13101310 exc : Exception ,
13111311 inc_id : str ,
13121312 store : "IncidentStore" ,
1313- incident : "Incident" ,
1313+ fallback : "Incident" ,
13141314) -> dict :
13151315 """Reload incident (absorbing partial tool writes), stamp a failure AgentRun,
13161316 persist, and return the error state dict for the LangGraph node.
1317+
1318+ ``fallback`` is the in-memory incident from the caller; we use it only
1319+ when the on-disk state has gone missing (FileNotFoundError on reload).
13171320 """
13181321 try :
13191322 incident = store .load (inc_id )
13201323 except FileNotFoundError :
1321- pass
1324+ incident = fallback
13221325 ended_at = datetime .now (timezone .utc ).strftime (_UTC_TS_FMT )
13231326 incident .agents_run .append (AgentRun (
13241327 agent = skill_name , started_at = started_at , ended_at = ended_at ,
@@ -1354,7 +1357,7 @@ async def node(state: GraphState) -> dict:
13541357 except Exception as exc : # noqa: BLE001
13551358 return _handle_agent_failure (
13561359 skill_name = skill .name , started_at = started_at , exc = exc ,
1357- inc_id = inc_id , store = store , incident = incident ,
1360+ inc_id = inc_id , store = store , fallback = incident ,
13581361 )
13591362
13601363 # Tools (e.g. update_incident) write straight to disk. Reload so the
0 commit comments