feat(deployments): registry, deterministic probes, breach signals to Joe - #606
Merged
Conversation
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>
This was referenced Aug 30, 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.
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
~/.codekin/deployments.json, 0600): deployments withhttp(status/latency/TLS days),pm2(status/restarts/memory), anddisk(free %) probes.repoPathlinks a deployment to its source repo for future incident→recent-merges correlation.GET /api/deployments/discoverproposes pm2 processes — never auto-enrolls.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.ok → breachedpublishes oneprobe-breachsignal;breached → okpublishesprobe-recovered; a pm2 restart-count increase publishes a one-offprobe-event. A persistent condition alerts once, not every 5 minutes.registerTickTaskon the engine: periodic work (probe sampling here) rides the dispatch tick + heartbeat instead of adding anothersetInterval— non-overlapping, error-isolated. This is the A0 promise of folding scattered loops onto one clock, now available as a mechanism.pm2 jlist,dfas the unprivileged user; probe failures are themselves breaches so a broken probe is visible.list_deployments/get_deployment_samplesMCP 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-breachsignal 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.🤖 Generated with Claude Code