Skip to content

feat: activate and improve autonomous orchestrator, shield, health checker, and innovation modules#156

Merged
ruffy80 merged 4 commits into
mainfrom
copilot/activate-and-improve-modules
Apr 13, 2026
Merged

feat: activate and improve autonomous orchestrator, shield, health checker, and innovation modules#156
ruffy80 merged 4 commits into
mainfrom
copilot/activate-and-improve-modules

Conversation

Copilot AI commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Four autonomous subsystems (orchestrator, shield, health checker, innovation agent) existed in partial/inactive states. This PR activates all of them, fills capability gaps, and wires everything into the PM2 ecosystem.

New: backend/modules/github-ops.js

Centralized GitHub operations module used by the orchestrator:

  • pullLatest(branch) — authenticated git pull
  • createPR / mergePR — GitHub API PR lifecycle
  • triggerWorkflow(id, branch) — workflow dispatch (CI/deploy trigger)
  • getWorkflowRuns — CI status polling
  • rollback(sha) — git revert + push

New: scripts/system-shield.js (PM2: unicorn-system-shield)

Standalone shield daemon replacing the simpler quantum watchdog for file/process protection:

  • Real-time critical file monitoring via chokidar
  • PM2 process health polling every 30s with execFile('pm2', ['restart', ...]) on failure
  • Corrupted/missing file restoration via git checkout -- using execFile
  • Deploy-lock via /tmp/unicorn-deploy.lock with 30-min auto-expire
  • HTTP API on port 3099: GET /status, POST /lock, POST /unlock, POST /heal
  • isSafeProcName() (regex) + isSafeFilePath() (path.relative-based) guards prevent injection

Enhanced: scripts/health-guardian.js

  • Added external URL check (HEALTH_GUARDIAN_EXTERNAL_URL, default PUBLIC_APP_URL/health) on a separate 2-min interval
  • Notifies orchestrator via POST /api/orchestrator/check on any failure (internal, shield, or external)
  • log() now uses separate console.log args (not template literals) to avoid tainted-format-string

Enhanced: autonomous-orchestrator.js

Adds a 9th cycle (runGithubCycle, default every 10 min):

await githubOps.pullLatest(GH_BRANCH);
const runs = await githubOps.getWorkflowRuns('deploy-hetzner.yml', 3);
if (latestRun.conclusion === 'failure' && GH_AUTO_ROLLBACK === 'true') {
  await githubOps.rollback(latestRun.sha, GH_BRANCH);
}

ecosystem.config.js

  • Added unicorn-system-shield app entry
  • unicorn-health-guardian env extended with HEALTH_GUARDIAN_EXTERNAL_URL, HEALTH_GUARDIAN_EXTERNAL_MS, HEALTH_GUARDIAN_ORCHESTRATOR_URL
  • unicorn-orchestrator env extended with GH_PULL_INTERVAL=600, GH_AUTO_ROLLBACK=false

backend/index.js

  • github-ops required and started
  • Routes: GET /api/github-ops/status, GET /api/github-ops/workflow-runs, POST /api/github-ops/pull, POST /api/github-ops/trigger-workflow, POST /api/github-ops/rollback (all admin-gated except status)

Copilot AI and others added 3 commits April 13, 2026 19:53
- Create backend/modules/github-ops.js: GitHub pull/PR/merge/workflow-trigger/rollback ops
- Create scripts/system-shield.js: real-time file-watch (chokidar) + PM2 process-monitor + deploy-lock + HTTP API
- Enhance scripts/health-guardian.js: add external URL check (https://zeusai.pro) + orchestrator notifications
- Enhance autonomous-orchestrator.js: integrate github-ops cycle (pull, CI-check, rollback)
- Update ecosystem.config.js: add unicorn-system-shield PM2 process + external health URL env vars
- Wire /api/github-ops/* routes into backend/index.js

Agent-Logs-Url: https://github.com/ruffy80/ZeusAI/sessions/d8f4af31-6da5-4108-8ec4-4b73cafe0e53

Co-authored-by: ruffy80 <29306714+ruffy80@users.noreply.github.com>
- system-shield.js: use execFile instead of exec for pm2/git commands, add isSafeProcName() + isSafeFilePath() validators, log notification errors
- github-ops.js: use separate console.log args to avoid tainted-format-string, fix spread whitespace
- health-guardian.js: log orchestrator notification errors

Agent-Logs-Url: https://github.com/ruffy80/ZeusAI/sessions/d8f4af31-6da5-4108-8ec4-4b73cafe0e53

Co-authored-by: ruffy80 <29306714+ruffy80@users.noreply.github.com>
…check, fix tainted-format-string in health-guardian log

Agent-Logs-Url: https://github.com/ruffy80/ZeusAI/sessions/d8f4af31-6da5-4108-8ec4-4b73cafe0e53

Co-authored-by: ruffy80 <29306714+ruffy80@users.noreply.github.com>
@vercel

vercel Bot commented Apr 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zeusai Ready Ready Preview, Comment Apr 13, 2026 8:11pm

Request Review

@ruffy80 ruffy80 marked this pull request as ready for review April 13, 2026 20:11
@ruffy80 ruffy80 merged commit 0597ecc into main Apr 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants