Conversation
… drift detection, GRU, security Agent-Logs-Url: https://github.com/lippytm/AI-Time-Machines/sessions/aec97134-fd4c-4989-a9e7-b66c3ffb3694 Co-authored-by: lippytm <65956507+lippytm@users.noreply.github.com>
…s, numpy import, configurable timeout Agent-Logs-Url: https://github.com/lippytm/AI-Time-Machines/sessions/aec97134-fd4c-4989-a9e7-b66c3ffb3694 Co-authored-by: lippytm <65956507+lippytm@users.noreply.github.com>
…ion, module-level re import Agent-Logs-Url: https://github.com/lippytm/AI-Time-Machines/sessions/aec97134-fd4c-4989-a9e7-b66c3ffb3694 Co-authored-by: lippytm <65956507+lippytm@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Analyze repositories and suggest improvements for autonomous systems
feat: autonomous systems upgrades — health monitoring, SSE streaming, drift detection, GRU, webhook security
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Broad platform upgrade targeting autonomous operation: real-time observability, model performance self-monitoring, secure integrations, and modernised AI client.
Description
Adds foundational autonomous-systems capabilities across backend, Python ML service, and ChatGPT client — covering live training observability, drift-triggered retraining, webhook security hardening, and modern LLM API usage.
Type of Change
Changes Made
Backend (Node.js)
SIGTERM/SIGINThandlers with configurableSHUTDOWN_TIMEOUT_MS; fixes Jest open-handle leakGET /api/status— aggregate health endpoint polling backend uptime + Python service; returns200/503for orchestration probesGET /api/models/:id/stream— SSE endpoint that polls DB every 5 s and pushes live training status/metrics; auto-closes on completion or client disconnectX-Webhook-Signatureagainst the raw request body (captured viaexpress.json({ verify })); uses equal-lengthtimingSafeEqualto prevent timing attacksChatGPT Client (
src/chatgpt.js)gpt-4→gpt-4o; available list includesgpt-4o-mini,gpt-4-turbostreamChat(message, onChunk)— token-by-token streaming with per-chunk callbackanalyzeTimeSeries(data)— structured GPT prompt returning parsed JSON:trend,seasonality,anomalies,insights,recommendationsPython ML Service
LSTMModel(use_gru=True)swaps all recurrent layers tokeras.layers.GRU; previously just aliased LSTMdetect_drift(recent_data, baseline_metrics, drift_threshold)— computes MAE on recent observations vs. baselinetest_loss; returnsdrift_scoreanddrift_detectedflagPOST /api/monitor— drift detection endpoint; validatesmodelIdas alphanumeric (prevents path traversal), optionally POSTs to backend/retrainwhen drift exceeds thresholdprint()replaced withlogging(ISO timestamps + levels)Infrastructure
healthcheckadded tobackendandpython-servicecontainers.env.exampleupdated:WEBHOOK_SECRET,SHUTDOWN_TIMEOUT_MS,DRIFT_THRESHOLD,OPENCLAW_API_KEY,PYTHON_SERVICE_PORTTesting
All 40 JS unit tests pass with clean exit. Python monitor endpoint validated for missing fields, invalid
modelId, insufficient data, and missing model file.Checklist
Additional Context
The
/api/monitorendpoint is designed for periodic calls from an external scheduler (cron, Kubernetes CronJob, etc.) or from the frontend. WhenautoRetrain: true, the service autonomously notifies the backend to re-queue training — no human intervention required.