From 1cc8b2273544f04a92e3c9f29ea55816438ee6a0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Nov 2025 04:08:35 +0000 Subject: [PATCH 1/3] Initial plan From 53577338d4a118332b4ba053b448d6f16bb83afc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Nov 2025 04:13:33 +0000 Subject: [PATCH 2/3] Fix duplicate bootstrap calls and move imports to top of file Co-authored-by: Steake <530040+Steake@users.noreply.github.com> --- backend/unified_server.py | 39 +++++++++++++++------------------------ demo_consciousness.py | 19 +++++++------------ 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/backend/unified_server.py b/backend/unified_server.py index 6f44be9..45b8b44 100644 --- a/backend/unified_server.py +++ b/backend/unified_server.py @@ -438,9 +438,18 @@ async def initialize_core_services(): # Bootstrap consciousness after initialization if hasattr(cognitive_manager, 'consciousness_engine') and cognitive_manager.consciousness_engine: try: - logger.info("🌅 Bootstrapping consciousness in cognitive manager...") - await cognitive_manager.consciousness_engine.bootstrap_consciousness() - logger.info("✅ Consciousness engine bootstrapped successfully") + ce = cognitive_manager.consciousness_engine + # Check if bootstrap already completed to avoid duplicate calls + bootstrap_done = False + if hasattr(ce, 'current_state') and hasattr(ce.current_state, 'phenomenal_experience'): + bootstrap_done = ce.current_state.phenomenal_experience.get('bootstrap_complete', False) + + if not bootstrap_done: + logger.info("🌅 Bootstrapping consciousness in cognitive manager...") + await ce.bootstrap_consciousness() + logger.info("✅ Consciousness engine bootstrapped successfully") + else: + logger.info("🟡 Consciousness engine bootstrap already completed; skipping duplicate call.") except Exception as bootstrap_error: logger.warning(f"⚠️ Consciousness bootstrap warning (non-fatal): {bootstrap_error}") @@ -477,27 +486,9 @@ async def initialize_core_services(): # Start the consciousness loop await unified_consciousness_engine.start_consciousness_loop() logger.info("🧠 Unified consciousness loop started") - - # Bootstrap consciousness from unconscious state to operational awareness - logger.info("🌅 Initiating consciousness bootstrap sequence...") - try: - bootstrap_state = await unified_consciousness_engine.consciousness_state_injector.capture_current_state() - # Update unified consciousness state from bootstrap - if hasattr(bootstrap_state, 'awareness_level') and bootstrap_state.awareness_level < 0.5: - # System needs bootstrapping - logger.info("Consciousness needs bootstrap - initiating awakening sequence") - # Note: UnifiedConsciousnessEngine doesn't have bootstrap_consciousness directly - # We'll need to check if cognitive_manager has it - if cognitive_manager and hasattr(cognitive_manager, 'consciousness_engine'): - await cognitive_manager.consciousness_engine.bootstrap_consciousness() - logger.info("✅ Consciousness bootstrapped successfully via cognitive manager") - else: - logger.warning("⚠️ Cognitive manager not available for bootstrap, consciousness will self-organize") - else: - logger.info(f"Consciousness already active (level: {bootstrap_state.awareness_level:.2f})") - except Exception as bootstrap_error: - logger.warning(f"⚠️ Consciousness bootstrap encountered issue (non-fatal): {bootstrap_error}") - logger.info("Consciousness will self-organize through normal operation") + + # Note: Consciousness bootstrap is handled in cognitive_manager initialization above + # to avoid duplicate bootstrap calls except Exception as e: logger.error(f"❌ Failed to initialize unified consciousness engine: {e}") diff --git a/demo_consciousness.py b/demo_consciousness.py index 0b36cfd..184b6fb 100644 --- a/demo_consciousness.py +++ b/demo_consciousness.py @@ -16,6 +16,13 @@ import time from datetime import datetime +# Backend imports - moved to top for better organization +from backend.core.consciousness_engine import ConsciousnessEngine +from backend.core.unified_consciousness_engine import UnifiedConsciousnessEngine +from backend.goal_management_system import GoalManagementSystem +from backend.core.metacognitive_monitor import MetaCognitiveMonitor +from backend.core.knowledge_graph_evolution import KnowledgeGraphEvolution + # Add project to path sys.path.insert(0, '/workspace/GodelOS') @@ -32,8 +39,6 @@ async def demo_1_bootstrap(): print("└" + "─" * 78 + "┘") print() - from backend.core.consciousness_engine import ConsciousnessEngine - print("Creating consciousness engine...") engine = ConsciousnessEngine() @@ -72,8 +77,6 @@ async def demo_2_real_computation(): print("└" + "─" * 78 + "┘") print() - from backend.core.unified_consciousness_engine import UnifiedConsciousnessEngine - print("Creating unified consciousness engine...") engine = UnifiedConsciousnessEngine() await engine.initialize_components() @@ -108,8 +111,6 @@ async def demo_3_conscious_query(): print("└" + "─" * 78 + "┘") print() - from backend.core.unified_consciousness_engine import UnifiedConsciousnessEngine - print("Setting up consciousness engine for query processing...") engine = UnifiedConsciousnessEngine() await engine.initialize_components() @@ -155,8 +156,6 @@ async def demo_4_goals_phenomenal(): print("└" + "─" * 78 + "┘") print() - from backend.goal_management_system import GoalManagementSystem - print("Creating goal management system...") goal_system = GoalManagementSystem() @@ -206,8 +205,6 @@ async def demo_5_metacognition_depth(): print("└" + "─" * 78 + "┘") print() - from backend.core.metacognitive_monitor import MetaCognitiveMonitor - print("Creating metacognitive monitor...") monitor = MetaCognitiveMonitor() @@ -248,8 +245,6 @@ async def demo_6_knowledge_graph_insights(): print("└" + "─" * 78 + "┘") print() - from backend.core.knowledge_graph_evolution import KnowledgeGraphEvolution - print("Creating knowledge graph...") kg = KnowledgeGraphEvolution() From 58f622f2dc01bc47caae26688de029826a8c4103 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Nov 2025 04:16:46 +0000 Subject: [PATCH 3/3] Add null check for phenomenal_experience in bootstrap guard Co-authored-by: Steake <530040+Steake@users.noreply.github.com> --- backend/unified_server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/unified_server.py b/backend/unified_server.py index 45b8b44..4a968ad 100644 --- a/backend/unified_server.py +++ b/backend/unified_server.py @@ -441,7 +441,9 @@ async def initialize_core_services(): ce = cognitive_manager.consciousness_engine # Check if bootstrap already completed to avoid duplicate calls bootstrap_done = False - if hasattr(ce, 'current_state') and hasattr(ce.current_state, 'phenomenal_experience'): + if (hasattr(ce, 'current_state') and + hasattr(ce.current_state, 'phenomenal_experience') and + ce.current_state.phenomenal_experience): bootstrap_done = ce.current_state.phenomenal_experience.get('bootstrap_complete', False) if not bootstrap_done: