Skip to content

feat(deployments): registry, deterministic probes, breach signals to Joe - #606

Merged
alari76 merged 1 commit into
mainfrom
feat/deployment-monitoring
Aug 30, 2026
Merged

feat(deployments): registry, deterministic probes, breach signals to Joe#606
alari76 merged 1 commit into
mainfrom
feat/deployment-monitoring

Conversation

@alari76

@alari76 alari76 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase C2 of the Joe value-expansion plan (§4, §5.1 partially): Joe's first non-repo value surface. Registered deployments are probed deterministically; the agent enters only on a breach.

Design

  • Registry (~/.codekin/deployments.json, 0600): deployments with http (status/latency/TLS days), pm2 (status/restarts/memory), and disk (free %) probes. repoPath links a deployment to its source repo for future incident→recent-merges correlation. GET /api/deployments/discover proposes pm2 processes — never auto-enrolls.
  • Two-layer architecture: probes are plain code sampled into deployment_samples (runs.db, 30-day retention); no LLM in the hot path. Breaches flow to Joe as notifications via the durable signal queue from C1 (feat(workflows): durable signals — at-least-once event queue in the trigger engine #605) — at-least-once, deduped while pending.
  • Transition-based alerting: ok → breached publishes one probe-breach signal; breached → ok publishes probe-recovered; a pm2 restart-count increase publishes a one-off probe-event. A persistent condition alerts once, not every 5 minutes.
  • registerTickTask on the engine: periodic work (probe sampling here) rides the dispatch tick + heartbeat instead of adding another setInterval — non-overlapping, error-isolated. This is the A0 promise of folding scattered loops onto one clock, now available as a mechanism.
  • Sudo-free by policy (per the proposal §5.2): fetch, pm2 jlist, df as the unprivileged user; probe failures are themselves breaches so a broken probe is visible.
  • Joe integration: list_deployments / get_deployment_samples MCP tools (allowlisted, template v6 tells Joe to check state+history before reacting and reiterates propose-only for privileged host actions).

Phase D (breach → trust-gated diagnostic child + incident reports) builds directly on the probe-breach signal payload.

Testing

  • server/deployment-monitor.test.ts (7 tests): sampling+metrics, disabled skip, breach-only-on-transition + recovery, first-sample breach, restart events, history ordering + retention pruning.
  • trigger-dispatch.test.ts +1: tick tasks run at interval, non-overlapping, error-isolated.
  • Full suite: 3043 tests pass; build + lint clean.

🤖 Generated with Claude Code

Phase C2 of the Joe value-expansion plan: Joe watches production.

- ~/.codekin/deployments.json registry (0600): deployments with http /
  pm2 / disk probes, optional repoPath link back to the source repo
- DeploymentMonitor: probes are plain code (no LLM in the hot path),
  sampled every 5 min via the engine's new registerTickTask — periodic
  work rides the dispatch tick instead of adding interval loops
- deployment_samples table in runs.db (30-day retention, pruned at boot)
- Breach detection on transitions: ok→breached publishes one durable
  probe-breach signal (not one per sample), breached→ok publishes
  probe-recovered; pm2 restart-count increases publish one-off
  probe-event signals; all deduped while pending and delivered to Joe
  as notifications through the at-least-once queue
- Probe failures (pm2 absent, df unparseable) are breaches themselves —
  a broken probe is visible, never silent
- Sudo-free by policy: fetch, pm2 jlist, df as the unprivileged user
- Discovery proposes pm2 processes, never auto-enrolls
- REST: /api/deployments CRUD + /discover + /samples
- MCP: list_deployments + get_deployment_samples (template v6)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@alari76
alari76 merged commit a4dee99 into main Aug 30, 2026
2 checks passed
@alari76
alari76 deleted the feat/deployment-monitoring branch August 30, 2026 07:16
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.

1 participant