@@ -115,12 +115,30 @@ async def _restore_resume_input(
115115 Returns:
116116 Input to use for resume: {interrupt_id: resume_data, ...}
117117 """
118+ # Fetch all triggers from storage
119+ triggers = await self .storage .get_triggers (self .runtime_id )
120+
118121 # If user provided explicit input, use it
119122 if input is not None :
123+ if triggers :
124+ if len (triggers ) == 1 :
125+ # Single trigger - just delete it
126+ await self .storage .delete_trigger (self .runtime_id , triggers [0 ])
127+ else :
128+ # Multiple triggers - match by interrupt_id
129+ found = False
130+ for trigger in triggers :
131+ if trigger .interrupt_id in input :
132+ await self .storage .delete_trigger (self .runtime_id , trigger )
133+ found = True
134+ if not found :
135+ logger .warning (
136+ f"Multiple triggers detected but none match the provided input. "
137+ f"Please specify which trigger to resume by {{interrupt_id: value}}. "
138+ f"Available interrupt_ids: { [t .interrupt_id for t in triggers ]} ."
139+ )
120140 return input
121141
122- # Fetch all triggers from storage
123- triggers = await self .storage .get_triggers (self .runtime_id )
124142 if not triggers :
125143 return None
126144
@@ -184,9 +202,7 @@ async def _handle_suspension(
184202
185203 if suspended_result .triggers :
186204 await self .storage .save_triggers (self .runtime_id , suspended_result .triggers )
187-
188- # Backward compatibility: set single trigger directly
189- if len (suspended_result .triggers ) == 1 :
205+ # Backward compatibility: set single trigger directly
190206 suspended_result .trigger = suspended_result .triggers [0 ]
191207
192208 return suspended_result
0 commit comments