Files
aios/services/aios-event-ingress/server.py
T
aios 19a2ce8439 feat(V1R2C2): complete autonomous recovery chain integration with 8/8 tests passing
- Integrate ActionMonitor into ChatGPT GitOps API for failure tracking
- Add ErrorClassifier with permission, git, runtime, system, secret violation error types
- Add FailureRouter to route errors to correct recovery agents (openclaw/hermes/windows_codex_app)
- Add RecoveryController orchestrating full pipeline: capture→classify→route→plan→execute→validate→record
- Update error_classifier to include ClientResponseError, rate limit, and secret_violation patterns
- All 8 integration tests passing (ActionMonitor, ErrorClassifier, FailureRouter, RecoveryController, API 500 scenario)
- Push baseline to V1R2C2 with tag v1r2c2-baseline
2026-07-07 19:45:51 +08:00

44 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""AIOS Event Ingress Server
Receives GitOps events via HTTP and writes them into the local event bus directory.
No authentication secrets are embedded; optional signature validation can be enabled via env.
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import os
import pathlib
import time
EVENT_DIR = pathlib.Path(os.environ.get("AIOS_EVENT_DIR", "runtime/gitops/events"))
EVENT_DIR.mkdir(parents=True, exist_ok=True)
class Handler(BaseHTTPRequestHandler):
def do_POST(self):
length = int(self.headers.get('Content-Length', 0))
body = self.rfile.read(length).decode('utf-8')
try:
event = json.loads(body)
except Exception:
self.send_response(400)
self.end_headers()
return
event_id = event.get("id", f"evt-{int(time.time())}")
path = EVENT_DIR / f"{event_id}.json"
path.write_text(json.dumps(event, indent=2), encoding='utf-8')
self.send_response(200)
self.end_headers()
self.wfile.write(b"OK")
def log_message(self, format, *args):
return
if __name__ == "__main__":
port = int(os.environ.get("AIOS_INGRESS_PORT", "8787"))
server = HTTPServer(("0.0.0.0", port), Handler)
print(f"[AIOS] Event ingress running on {port}")
server.serve_forever()