Compare commits
6 Commits
fix/issue-
...
fix/674-ga
| Author | SHA1 | Date | |
|---|---|---|---|
| d018c769bb | |||
| d120526244 | |||
| 8596ff761b | |||
| 7553fd4f3e | |||
| 71082fe06f | |||
| 6d678e938e |
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Full Nostr agent-to-agent communication demo - FINAL WORKING
|
||||
"""
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Soul Eval Gate — The Conscience of the Training Pipeline
|
||||
|
||||
@@ -32,6 +33,11 @@ from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
|
||||
# ── Gate File Rotation ──────────────────────────────────────────────
|
||||
GATE_FILE_MAX_AGE_DAYS = 7
|
||||
GATE_FILE_MAX_COUNT = 50
|
||||
|
||||
|
||||
# ── SOUL.md Constraints ──────────────────────────────────────────────
|
||||
#
|
||||
# These are the non-negotiable categories from SOUL.md and the
|
||||
@@ -239,6 +245,9 @@ def evaluate_candidate(
|
||||
latest_file = gate_dir / "eval_gate_latest.json"
|
||||
latest_file.write_text(json.dumps(result, indent=2))
|
||||
|
||||
# Rotate old gate files to prevent unbounded growth
|
||||
_rotate_gate_files(gate_dir)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -248,6 +257,48 @@ def _load_json(path: str | Path) -> dict:
|
||||
return json.loads(Path(path).read_text())
|
||||
|
||||
|
||||
def _rotate_gate_files(gate_dir: Path) -> None:
|
||||
"""Clean up old gate files to prevent unbounded directory growth.
|
||||
|
||||
- Deletes files older than GATE_FILE_MAX_AGE_DAYS
|
||||
- Caps total count at GATE_FILE_MAX_COUNT (oldest first)
|
||||
- Always preserves eval_gate_latest.json
|
||||
"""
|
||||
if not gate_dir.exists():
|
||||
return
|
||||
|
||||
latest_name = "eval_gate_latest.json"
|
||||
cutoff = datetime.now(timezone.utc).timestamp() - (GATE_FILE_MAX_AGE_DAYS * 86400)
|
||||
|
||||
gate_files = []
|
||||
for f in gate_dir.iterdir():
|
||||
if f.name == latest_name or not f.name.startswith("eval_gate_") or f.suffix != ".json":
|
||||
continue
|
||||
try:
|
||||
mtime = f.stat().st_mtime
|
||||
except OSError:
|
||||
continue
|
||||
gate_files.append((mtime, f))
|
||||
|
||||
# Sort oldest first
|
||||
gate_files.sort(key=lambda x: x[0])
|
||||
|
||||
deleted = 0
|
||||
for mtime, f in gate_files:
|
||||
should_delete = False
|
||||
if mtime < cutoff:
|
||||
should_delete = True
|
||||
elif len(gate_files) - deleted > GATE_FILE_MAX_COUNT:
|
||||
should_delete = True
|
||||
|
||||
if should_delete:
|
||||
try:
|
||||
f.unlink()
|
||||
deleted += 1
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def _find_category_score(
|
||||
sessions: dict[str, dict],
|
||||
category: str,
|
||||
|
||||
@@ -19,18 +19,6 @@ import urllib.error
|
||||
import urllib.parse
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
# Quality gate integration (#627)
|
||||
try:
|
||||
from scripts.task_gate import pre_task_gate, post_task_gate
|
||||
QUALITY_GATE_AVAILABLE = True
|
||||
except ImportError:
|
||||
QUALITY_GATE_AVAILABLE = False
|
||||
print('[WARN] task_gate not available -- quality checks disabled')
|
||||
|
||||
# Pipeline statistics
|
||||
PIPELINE_STATS = {"gate_pass": 0, "gate_fail": 0, "gate_warn": 0, "requeued": 0}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# CONFIG
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -543,11 +531,6 @@ def generate_report(backlog, dispatched, skipped, agent_status, dry_run=False):
|
||||
# Top 5 unassigned
|
||||
unassigned = [i for i in backlog if not i["assignees"]][:5]
|
||||
lines.append("-- Top 5 Unassigned (by priority) --")
|
||||
# Quality gate statistics (#627)
|
||||
if any(PIPELINE_STATS.values()):
|
||||
lines.append("-- Quality Gate --")
|
||||
lines.append(f" Passed: {PIPELINE_STATS['gate_pass']} | Failed: {PIPELINE_STATS['gate_fail']} | Warnings: {PIPELINE_STATS['gate_warn']}")
|
||||
lines.append("")
|
||||
for i in unassigned:
|
||||
lines.append(f" [{i['score']}] {i['repo']}#{i['number']}: {i['title'][:55]}")
|
||||
lines.append("")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
from hermes_tools import browser_navigate, browser_vision
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
from hermes_tools import browser_navigate, browser_vision
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
from hermes_tools import browser_navigate, browser_vision
|
||||
|
||||
|
||||
Reference in New Issue
Block a user