@@ -438,9 +438,20 @@ async def initialize_core_services():
438438 # Bootstrap consciousness after initialization
439439 if hasattr (cognitive_manager , 'consciousness_engine' ) and cognitive_manager .consciousness_engine :
440440 try :
441- logger .info ("🌅 Bootstrapping consciousness in cognitive manager..." )
442- await cognitive_manager .consciousness_engine .bootstrap_consciousness ()
443- logger .info ("✅ Consciousness engine bootstrapped successfully" )
441+ ce = cognitive_manager .consciousness_engine
442+ # Check if bootstrap already completed to avoid duplicate calls
443+ bootstrap_done = False
444+ if (hasattr (ce , 'current_state' ) and
445+ hasattr (ce .current_state , 'phenomenal_experience' ) and
446+ ce .current_state .phenomenal_experience ):
447+ bootstrap_done = ce .current_state .phenomenal_experience .get ('bootstrap_complete' , False )
448+
449+ if not bootstrap_done :
450+ logger .info ("🌅 Bootstrapping consciousness in cognitive manager..." )
451+ await ce .bootstrap_consciousness ()
452+ logger .info ("✅ Consciousness engine bootstrapped successfully" )
453+ else :
454+ logger .info ("🟡 Consciousness engine bootstrap already completed; skipping duplicate call." )
444455 except Exception as bootstrap_error :
445456 logger .warning (f"⚠️ Consciousness bootstrap warning (non-fatal): { bootstrap_error } " )
446457
@@ -477,27 +488,9 @@ async def initialize_core_services():
477488 # Start the consciousness loop
478489 await unified_consciousness_engine .start_consciousness_loop ()
479490 logger .info ("🧠 Unified consciousness loop started" )
480-
481- # Bootstrap consciousness from unconscious state to operational awareness
482- logger .info ("🌅 Initiating consciousness bootstrap sequence..." )
483- try :
484- bootstrap_state = await unified_consciousness_engine .consciousness_state_injector .capture_current_state ()
485- # Update unified consciousness state from bootstrap
486- if hasattr (bootstrap_state , 'awareness_level' ) and bootstrap_state .awareness_level < 0.5 :
487- # System needs bootstrapping
488- logger .info ("Consciousness needs bootstrap - initiating awakening sequence" )
489- # Note: UnifiedConsciousnessEngine doesn't have bootstrap_consciousness directly
490- # We'll need to check if cognitive_manager has it
491- if cognitive_manager and hasattr (cognitive_manager , 'consciousness_engine' ):
492- await cognitive_manager .consciousness_engine .bootstrap_consciousness ()
493- logger .info ("✅ Consciousness bootstrapped successfully via cognitive manager" )
494- else :
495- logger .warning ("⚠️ Cognitive manager not available for bootstrap, consciousness will self-organize" )
496- else :
497- logger .info (f"Consciousness already active (level: { bootstrap_state .awareness_level :.2f} )" )
498- except Exception as bootstrap_error :
499- logger .warning (f"⚠️ Consciousness bootstrap encountered issue (non-fatal): { bootstrap_error } " )
500- logger .info ("Consciousness will self-organize through normal operation" )
491+
492+ # Note: Consciousness bootstrap is handled in cognitive_manager initialization above
493+ # to avoid duplicate bootstrap calls
501494
502495 except Exception as e :
503496 logger .error (f"❌ Failed to initialize unified consciousness engine: { e } " )
0 commit comments