Skip to content

Commit cc397d6

Browse files
CopilotSteake
andcommitted
Fix hardcoded paths and critical safety issues
Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
1 parent c7aed3a commit cc397d6

File tree

7 files changed

+23
-13
lines changed

7 files changed

+23
-13
lines changed

backend/core/knowledge_graph_evolution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import json
1111
import logging
1212
from datetime import datetime, timedelta
13-
from dataclasses import dataclass, asdict
13+
from dataclasses import dataclass, asdict, field
1414
from typing import Dict, List, Optional, Any, Tuple, Set, Union
1515
from enum import Enum
1616
import uuid
@@ -155,6 +155,7 @@ class EmergentPattern:
155155
discovery_time: datetime
156156
validation_score: float
157157
implications: List[str]
158+
metadata: Dict[str, Any] = field(default_factory=dict)
158159

159160
class KnowledgeGraphEvolution:
160161
"""
@@ -750,7 +751,6 @@ async def _generate_emergence_phenomenal_experience(self, patterns: List[Emergen
750751

751752
if experience:
752753
# Store experience reference with the pattern
753-
pattern.metadata = pattern.__dict__.get("metadata", {})
754754
pattern.metadata["phenomenal_experience_id"] = experience.id
755755
pattern.metadata["subjective_feeling"] = experience.narrative_description
756756

backend/core/unified_consciousness_engine.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,13 @@ async def _unified_consciousness_loop(self):
573573
# Strange loop stability from consistency of recursive patterns
574574
if len(self.consciousness_history) > 5:
575575
depth_history = [s.recursive_awareness.get("recursive_depth", 1) for s in self.consciousness_history[-5:]]
576-
depth_variance = sum((d - sum(depth_history)/len(depth_history))**2 for d in depth_history) / len(depth_history)
577-
# Lower variance = higher stability
578-
stability = max(0.0, min(1.0, 1.0 - (depth_variance / 4.0)))
579-
current_state.recursive_awareness["strange_loop_stability"] = stability
576+
if len(depth_history) > 0:
577+
depth_variance = sum((d - sum(depth_history)/len(depth_history))**2 for d in depth_history) / len(depth_history)
578+
# Lower variance = higher stability
579+
stability = max(0.0, min(1.0, 1.0 - (depth_variance / 4.0)))
580+
current_state.recursive_awareness["strange_loop_stability"] = stability
581+
else:
582+
current_state.recursive_awareness["strange_loop_stability"] = 0.5
580583
else:
581584
current_state.recursive_awareness["strange_loop_stability"] = 0.5
582585

backend/goal_management_system.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ async def _generate_goal_phenomenal_experience(self, goals: List[Dict], context:
261261

262262
except Exception as e:
263263
# Non-fatal - goals still work without phenomenal experience
264-
import logging
265-
logging.getLogger(__name__).warning(f"Could not generate phenomenal experience for goals: {e}")
264+
logger.warning(f"Could not generate phenomenal experience for goals: {e}")
266265

267266
def _calculate_goal_intensity(self, goal: Dict) -> float:
268267
"""Calculate intensity of goal-related phenomenal experience"""

backend/unified_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2725,7 +2725,7 @@ async def enhanced_cognitive_query(query_request: dict):
27252725
"awareness_level": consciousness_state.consciousness_score,
27262726
"recursive_depth": consciousness_state.recursive_awareness.get("recursive_depth", 1),
27272727
"phi_measure": consciousness_state.information_integration.get("phi", 0.0),
2728-
"phenomenal_experience": consciousness_state.phenomenal_experience.get("quality", ""),
2728+
"phenomenal_experience": consciousness_state.phenomenal_experience.get("quality", "") if isinstance(consciousness_state.phenomenal_experience, dict) else "",
27292729
"strange_loop_stability": consciousness_state.recursive_awareness.get("strange_loop_stability", 0.0)
27302730
},
27312731
"enhanced_features": {

demo_consciousness.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313

1414
import asyncio
1515
import sys
16+
import os
1617
import time
1718
from datetime import datetime
1819

19-
# Add project to path
20-
sys.path.insert(0, '/workspace/GodelOS')
20+
# Add project to path dynamically
21+
project_root = os.path.dirname(os.path.abspath(__file__))
22+
sys.path.insert(0, project_root)
2123

2224
# Backend imports - moved to top for better organization
2325
from backend.core.consciousness_engine import ConsciousnessEngine

inline_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import sys
2-
sys.path.insert(0, '/workspace/GodelOS')
2+
import os
3+
4+
# Add project root to path dynamically
5+
project_root = os.path.dirname(os.path.abspath(__file__))
6+
sys.path.insert(0, project_root)
37

48
print("Testing consciousness integrations...")
59
print()

quick_verify.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ echo "🔍 Quick Verification of Consciousness Integrations"
55
echo "===================================================="
66
echo ""
77

8-
cd /workspace/GodelOS
8+
# Change to the script's directory, then to project root
9+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10+
cd "$SCRIPT_DIR"
911

1012
echo "1. Checking Python syntax of modified files..."
1113
echo ""

0 commit comments

Comments
 (0)