GitHub Copilot commited on
Commit
37a07d6
·
1 Parent(s): 610d968

Debugging: Enhanced Neural Router logging to diagnose startup failure

Browse files
Files changed (1) hide show
  1. app.py +26 -2
app.py CHANGED
@@ -26,11 +26,35 @@ except ImportError:
26
  import threading
27
  import subprocess
28
 
 
 
 
 
 
29
  def start_neural_router():
30
  print("[SYSTEM] Igniting Neural Router (Port 5000)...")
 
31
  try:
32
- subprocess.Popen([sys.executable, "-m", "logos.server"],
33
- env={**os.environ, "PYTHONPATH": current_dir})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  except Exception as e:
35
  print(f"❌ Failed to start Neural Router: {e}")
36
 
 
26
  import threading
27
  import subprocess
28
 
29
+ # --- PROTOCOL 26: START NEURAL ROUTER ---
30
+ import threading
31
+ import subprocess
32
+ import time
33
+
34
  def start_neural_router():
35
  print("[SYSTEM] Igniting Neural Router (Port 5000)...")
36
+ log_file = open("neural_router.log", "w")
37
  try:
38
+ # Launch with stdout/stderr redirection for debugging
39
+ process = subprocess.Popen(
40
+ [sys.executable, "-m", "logos.server"],
41
+ env={**os.environ, "PYTHONPATH": current_dir},
42
+ stdout=subprocess.PIPE,
43
+ stderr=subprocess.STDOUT,
44
+ text=True,
45
+ bufsize=1
46
+ )
47
+ print(f"✅ Neural Router Process ID: {process.pid}")
48
+
49
+ # Stream logs in a separate thread to avoid blocking
50
+ def stream_logs(p):
51
+ for line in iter(p.stdout.readline, ''):
52
+ print(f"[ROUTER] {line.strip()}")
53
+ log_file.write(line)
54
+ log_file.flush()
55
+
56
+ threading.Thread(target=stream_logs, args=(process,), daemon=True).start()
57
+
58
  except Exception as e:
59
  print(f"❌ Failed to start Neural Router: {e}")
60