homelab-codex-ws/scripts
oskar 4bfd6c4429 fix(observer): map containers_not_running to unhealthy status + incident — dead/crash-looping containers created no incident, so supervisor never alerted
node-agent (and stability-agent) emit containers_not_running for exited/dead
and crash-looping containers, but the observer's event->status/incident map
only handled service_recovered/service_healthy/service_unhealthy/
healthcheck_failed. containers_not_running fell through: status stayed at its
last "healthy" value and no incident was opened, so the supervisor saw no drift
and generated no action — a dead container produced ZERO operator alerts
(matches the "action queue empty despite failures" symptom).

- containers_not_running now sets status=unhealthy and opens an incident whose
  trigger_type ("containers_not_running") is already in the supervisor's
  CONTAINER_RESTART_TRIGGERS, so remediation (container_restart) fires with no
  supervisor change. Recovery is unchanged: service_healthy resolves the
  incident via the existing svc_key->incident_id link.
- container_restarting / container_state_unexpected (added in 4746ebe) are kept
  intentionally observational — no incident, status not flipped to unhealthy
  (would cause a false redeploy for a transient blip) — but leave a
  last_observation trace so they don't vanish. A real crash-loop still escalates
  via node-agent re-emitting containers_not_running.

Tests: services/control-plane/tests/test_observer_container_events.py — status
+ incident + trigger_type, end-to-end reconcile -> container_restart, recovery
auto-resolve, observational no-incident/trace, idempotent (no incident
multiplication). Full control-plane suite: 117 passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 16:28:31 +02:00
..
bootstrap Implement VPS control-plane deployment profile 2026-05-12 20:19:05 +02:00
deploy feat(kb): add kb-query service skeleton (search API, no ingress yet) 2026-07-22 16:06:18 +02:00
dev fix(dev): agent.sh worktree_count/paths grep exit-1 on empty set 2026-06-03 18:04:38 +02:00
ha fix(ha): normalize.py round-trips custom HA !tag nodes 2026-07-21 17:41:12 +02:00
lib Implement filesystem-first runtime event system 2026-05-12 13:38:25 +02:00
maintenance fix(events): service_healthy tylko na transition + cleanup 358k backlog + retencja — glob zalewu paralizowal reconcile supervisora 2026-07-16 20:20:17 +02:00
monitor feat(node-agent): implement health monitor and safe cleanup policy 2026-05-27 13:15:06 +02:00
npm feat(scripts): npm_api.py — CLI do zarzadzania npm PIHA+VPS przez REST API 2026-07-10 14:57:42 +02:00
observer fix(observer): map containers_not_running to unhealthy status + incident — dead/crash-looping containers created no incident, so supervisor never alerted 2026-07-22 16:28:31 +02:00
onboard feat(onboard): implement 40-register + 50-verify, remove dead scaffold 2026-06-09 20:36:00 +02:00
bootstrap.sh Initial homelab workspace structure 2026-05-07 20:17:27 +02:00