Compare commits

...

1 Commits

Author SHA1 Message Date
Alexander Whitestone
974962f40f fix(Phase-4): hardcoded path fixes and syntax errors in sovereignty scripts (#551)
Some checks failed
Self-Healing Smoke / self-healing-smoke (pull_request) Failing after 24s
Smoke Test / smoke (pull_request) Failing after 27s
Agent PR Gate / gate (pull_request) Failing after 48s
Agent PR Gate / report (pull_request) Successful in 11s
Refs #551

Fixes pre-existing syntax errors and migrates hardcoded home-directory
paths to use environment variables with fallbacks in Phase-4 sovereignty
infrastructure scripts.

**Syntax error fixes:**
- scripts/sovereignty_audit.py: Fixed unterminated string literals in
  crontab.split(
2026-04-22 03:27:50 -04:00
4 changed files with 12 additions and 14 deletions

View File

@@ -6,8 +6,8 @@ from pathlib import Path
MODEL = "NousResearch_Hermes-4-14B-Q4_K_M.gguf"
URL = "http://localhost:8081/v1/chat/completions"
SOUL = Path.home().joinpath('.timmy/SOUL.md').read_text()
OUT = Path.home().joinpath('.timmy/test-results', f'local_decision_session_{time.strftime("%Y%m%d_%H%M%S")}.md')
SOUL = (Path(os.environ.get("TIMMY_HOME", Path.home() / ".timmy")) / "SOUL.md").read_text()
OUT = Path(os.environ.get("TIMMY_HOME", Path.home() / ".timmy")) / "test-results" / f'local_decision_session_{time.strftime("%Y%m%d_%H%M%S")}.md'
OUT.parent.mkdir(parents=True, exist_ok=True)
messages = [

View File

@@ -10,9 +10,9 @@ from pathlib import Path
LLAMA_HEALTH = "http://localhost:8081/health"
LLAMA_MODELS = "http://localhost:8081/v1/models"
HERMES_AGENT_ROOT = Path.home() / ".hermes" / "hermes-agent"
SESSION_DIR = Path.home() / ".hermes" / "sessions"
REPORT_DIR = Path.home() / ".timmy" / "test-results"
HERMES_AGENT_ROOT = Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) / "hermes-agent"
SESSION_DIR = Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) / "sessions"
REPORT_DIR = Path(os.environ.get("TIMMY_HOME", Path.home() / ".timmy")) / "test-results"
REPORT_DIR.mkdir(parents=True, exist_ok=True)
REPORT_PATH = REPORT_DIR / f"local_timmy_proof_{time.strftime('%Y%m%d_%H%M%S')}.md"

View File

@@ -5,8 +5,8 @@ import os
from pathlib import Path
from datetime import datetime
DB_PATH = Path.home() / ".timmy" / "metrics" / "model_metrics.db"
REPORT_PATH = Path.home() / "timmy" / "SOVEREIGN_HEALTH.md"
DB_PATH = Path(os.environ.get("TIMMY_HOME", Path.home() / ".timmy")) / "metrics" / "model_metrics.db"
REPORT_PATH = Path(os.environ.get("TIMMY_HOME", Path.home() / ".timmy")) / "SOVEREIGN_HEALTH.md"
def generate_report():
if not DB_PATH.exists():

View File

@@ -75,8 +75,8 @@ def check_config_files():
"""Scan ~/.hermes and ~/.timmy config files for cloud dependencies."""
findings = []
config_dirs = [
Path.home() / ".hermes",
Path.home() / ".timmy",
Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")),
Path(os.environ.get("TIMMY_HOME", Path.home() / ".timmy")),
]
for config_dir in config_dirs:
@@ -145,8 +145,7 @@ def check_cron_jobs():
cloud_lines = []
local_lines = []
for line in crontab.split("
"):
for line in crontab.split("\n"):
if line.startswith("#") or not line.strip():
continue
for provider in CLOUD_PROVIDERS:
@@ -187,8 +186,7 @@ def check_tmux_sessions():
if result.returncode != 0:
return [Finding("tmux", "unknown", "No tmux sessions or tmux not running")]
sessions = result.stdout.strip().split("
")
sessions = result.stdout.strip().split("\n")
findings.append(Finding("tmux", "local", f"{len(sessions)} session(s) active: {', '.join(sessions[:5])}"))
except Exception as e:
@@ -256,7 +254,7 @@ def check_api_keys():
findings.append(Finding("env_keys", "local", "No cloud API keys in environment"))
# Check auth.json
auth_path = Path.home() / ".hermes" / "auth.json"
auth_path = Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) / "auth.json"
if auth_path.exists():
try:
auth = json.loads(auth_path.read_text())