Exception handlers in act() and observe() methods call self.set_phase() instead of self._set_phase(), bypassing phase transition validation.
Root Cause
Two methods exist for setting phase:
_set_phase() (line 97): ✓ Validates transitions via check_successor()
set_phase() (line 266): ✗ Sets phase directly without validation
Exception handlers incorrectly use the public method that skips validation.
Impact
During error recovery, agent can be forced into invalid phase state, causing:
- Invalid agent state after exception recovery
- Downstream errors from invalid phase transitions
- Race conditions in multi-threaded scenarios
Current Code (lines 187-191, 209-213)
except Exception:
self.set_phase(entity_component.Phase.READY) # BUG: No validation
raise
Fix
except Exception:
self._set_phase(entity_component.Phase.READY) # Fixed: Validates transition
raise
This ensures phase transitions are validated even during error handling.
Exception handlers in
act()andobserve()methods callself.set_phase()instead ofself._set_phase(), bypassing phase transition validation.Root Cause
Two methods exist for setting phase:
_set_phase()(line 97): ✓ Validates transitions viacheck_successor()set_phase()(line 266): ✗ Sets phase directly without validationException handlers incorrectly use the public method that skips validation.
Impact
During error recovery, agent can be forced into invalid phase state, causing:
Current Code (lines 187-191, 209-213)
Fix
This ensures phase transitions are validated even during error handling.