diff --git a/.gitignore b/.gitignore index d12bef3..1860200 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ **/*.nfs* scripts/start_agent.bat *.log +scripts/move_orphans.exp diff --git a/ai-hub/app/core/grpc/services/assistant.py b/ai-hub/app/core/grpc/services/assistant.py index 8492bc1..8e37d2f 100644 --- a/ai-hub/app/core/grpc/services/assistant.py +++ b/ai-hub/app/core/grpc/services/assistant.py @@ -564,7 +564,7 @@ else: os.remove(dest) # Broadcast delete to other nodes - targets = [nid for nid in self.registry.nodes if nid != node_id] + targets = [nid for nid in self.registry._nodes if nid != node_id] for target_id in targets: target_node = self.registry.get_node(target_id) if target_node: diff --git a/scripts/move_orphans.exp b/scripts/move_orphans.exp deleted file mode 100755 index c3b63d3..0000000 --- a/scripts/move_orphans.exp +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/expect -f -set timeout 60 -set password "a6163484a" - -# 1. Create backup directory -spawn ssh -o StrictHostKeyChecking=no axieyangb@192.168.68.113 "mkdir -p /home/coder/project/cortex-hub/data/orphans_backup/" -expect { - "password:" { - send "$password\r" - exp_continue - } - eof -} - -# 2. Move files -set orphans { - "/home/coder/project/cortex-hub/ai-hub-dump.db" - "/home/coder/project/cortex-hub/ai-hub/ai-hub/test.db" - "/home/coder/project/cortex-hub/ai-hub/ai-hub/data/ai_hub.db" - "/home/coder/project/cortex-hub/ai-hub/app/db/data/ai_hub.db" - "/home/coder/project/cortex-hub/ai-hub/cortex_integration_test.db" - "/home/coder/project/cortex-hub/data/ai-hub-copy.db" -} - -foreach file $orphans { - spawn ssh -o StrictHostKeyChecking=no axieyangb@192.168.68.113 "mv $file /home/coder/project/cortex-hub/data/orphans_backup/" - expect { - "password:" { - send "$password\r" - exp_continue - } - eof - } -} - -# 3. Verify -spawn ssh -o StrictHostKeyChecking=no axieyangb@192.168.68.113 "ls -lh /home/coder/project/cortex-hub/data/orphans_backup/" -expect { - "password:" { - send "$password\r" - exp_continue - } - eof -} diff --git a/scripts/test_eval_loop.py b/scripts/test_eval_loop.py deleted file mode 100644 index 6ae2621..0000000 --- a/scripts/test_eval_loop.py +++ /dev/null @@ -1,68 +0,0 @@ -import requests -import time -import sys - -BASE_URL = "http://192.168.68.113:8000/api/v1" -HEADERS = {"X-User-ID": "585cd6e9-05e5-42ac-83a5-93029c6cb038"} - -def check(): - print("1. Fetching agents...") - resp = requests.get(f"{BASE_URL}/agents", headers=HEADERS) - if not resp.ok: - print(f"Failed to fetch agents: {resp.text}") - sys.exit(1) - - agents = resp.json() - if not agents: - print("No agents found for user.") - sys.exit(1) - - agent_id = agents[0]["id"] - print(f"2. Injecting test task to Agent {agent_id}...") - - inject_resp = requests.post(f"{BASE_URL}/agents/{agent_id}/run", json={"prompt": "list the current directory on your node please"}, headers=HEADERS) - if not inject_resp.ok: - print(f"Inject failed: {inject_resp.text}") - sys.exit(1) - - print("3. Polling for evaluation completion...") - start_time = time.time() - - last_status = "" - last_eval_status = "" - - while time.time() - start_time < 120: - a_resp = requests.get(f"{BASE_URL}/agents", headers=HEADERS) - if not a_resp.ok: continue - - alist = a_resp.json() - me = next((a for a in alist if a["id"] == agent_id), None) - if not me: continue - - curr_status = me.get("status", "unknown") - curr_eval = me.get("evaluation_status", "") - - if curr_status != last_status or curr_eval != last_eval_status: - print(f"[{int(time.time() - start_time)}s] Status: {curr_status} | Eval: {curr_eval}") - last_status = curr_status - last_eval_status = curr_eval - - if curr_status in ("idle", "error_suspended") and time.time() - start_time > 5: - # Check if eval was passed - print("\nFinal State Reached.") - print(f"Successful Runs: {me.get('successful_runs', 0)}") - print(f"Latest Score: {me.get('latest_quality_score', 0)}") - - # Print last message - if me.get("session_id"): - m_resp = requests.get(f"{BASE_URL}/sessions/{me['session_id']}/messages", headers=HEADERS) - if m_resp.ok: - msgs = m_resp.json().get("messages", []) - if msgs: - print(f"Last Assistant Msg: {msgs[-1]['content'][:200]}...") - break - - time.sleep(2) - -if __name__ == "__main__": - check() diff --git a/scripts/tmp_check_db.exp b/scripts/tmp_check_db.exp deleted file mode 100755 index 86f108e..0000000 --- a/scripts/tmp_check_db.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -f -set timeout 30 -set password "a6163484a" -spawn ssh -o StrictHostKeyChecking=no axieyangb@192.168.68.113 "ls -lh --time-style=long-iso /home/coder/project/cortex-hub/ai-hub-dump.db /home/coder/project/cortex-hub/ai-hub/ai-hub/test.db /home/coder/project/cortex-hub/ai-hub/ai-hub/data/ai_hub.db /home/coder/project/cortex-hub/ai-hub/app/db/data/ai_hub.db /home/coder/project/cortex-hub/ai-hub/cortex_integration_test.db /home/coder/project/cortex-hub/data/ai-hub-copy.db /home/coder/project/cortex-hub/data/ai-hub.db" -expect { - "password:" { - send "$password\r" - exp_continue - } - eof -} diff --git a/scripts/verify_coworker.sh b/scripts/verify_coworker.sh deleted file mode 100755 index f532e22..0000000 --- a/scripts/verify_coworker.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Local verification for Co-Worker performance and non-blocking behavior - -cd ai-hub -export DB_MODE=sqlite -export LOCAL_DB_PATH="data/verify_ai_hub.db" -export LOG_LEVEL="INFO" -export SKIP_DOCKER_NODES=true -export TEST_HUB_URL="http://127.0.0.1:8001" -export TEST_GRPC_ENDPOINT="127.0.0.1:50051" -export SYNC_TEST_BASE_URL="http://127.0.0.1:8001/api/v1" - -# Step 1: Start Hub Server -echo "Starting local Hub server..." -python3 -m uvicorn app.main:app --host 127.0.0.1 --port 8001 & -HUB_PID=$! - -# Step 2: Start gRPC Node (Simulated) -# In a real integration test, conftest.py handles this if SKIP_DOCKER_NODES=true -# but we need to ensure dependencies are installed. - -# Step 3: Run pytest -echo "Running Co-Worker integration tests..." -python3 -m pytest -v integration_tests/test_coworker_flow.py - -# Cleanup -kill $HUB_PID