homelab-codex-ws/services/agent-system
oskar 4083f18673 fix(agent-system): deploy.sh nigdy nie dolaczal override'u hosta -> panel czytal legacy Redis, nie VPS observera
Root cause rozjazdu panelu agents.okit.pl vs services.json NIE lezal w
observer.py/operator_ui.py (te sa poprawne: ghost-prune dziala in-memory
i na plik co cykl, operator_ui czyta services.json na zywo bez cache).

Prawdziwy lancuch: npm proxy_host agents.okit.pl -> 100.108.208.3:18180
(Tailscale IP PIHA, nie VPS!) -> legacy kontener agent-system-webui
(services/agent-system/, sprzed migracji do control-plane/, brak
service.yaml, nieobecny w hosts/piha/services.yaml i topology.yaml).
Jego runtime-materializer czytal z Redis (homelab:services:*), do ktorego
NIC juz nie pisze w obecnej architekturze -- stad 27 martwych/ghost
wpisow (w tym hash-prefixed) i inna liczba serwisow (110 vs 117 w
services.json z VPS).

Fix na to juz istnial w repo od 2026-05-27 (7277bdc): materializer.py ma
materialize_from_api() ktory mirroruje czysty output observera z VPS przez
CONTROL_PLANE_URL, a hosts/piha/runtime/agent-system/docker-compose.override.yml
ustawia ta zmienna. Nigdy sie jednak nie aktywowal, bo
services/agent-system/deploy.sh (jedyna sciezka deployu tego serwisu)
wolal `docker compose up` uzywajac WYLACZNIE docker-compose.yml, bez
dolaczania override'u z hosts/ -- w odroznieniu od control-plane/
deploy-local.sh i stability-agent/deploy-local.sh, ktore ten wzorzec juz
stosuja.

Fix: deploy.sh dolacza teraz hosts/piha/runtime/agent-system/docker-compose.override.yml
(ten sam wzorzec co control-plane, ktory hardkoduje vps). Po nastepnym
`services/agent-system/deploy.sh` na PIHA runtime-materializer zacznie
mirrorowac /nodes /services /summary itd. z control-plane API zamiast
Redis -- panel bedzie pokazywal to samo co services.json.

Docker socket PIHA (DOCKER_API_ERROR 2026-07-17T00:00:40Z): NIE regres
group_add/gid (node-agent ma poprawne grupy 999/123, gid docker.sock=123
sie zgadza). Wszystkie ~40 kontenerow na PIHA wystartowaly jednoczesnie o
00:00:26 UTC -- to byl automatyczny apt-get upgrade docker-ce
29.6.1->29.6.2 (apt/history.log, Start-Date 02:00:08 CEST), ktory
zrestartowal Docker Engine. stability-agent (root) trafil na gniazdo w
~1-sekundowym oknie zanim daemon w pelni wstal (docker.service
ActiveEnterTimestamp 02:00:41 CEST). Jednorazowy, samo-naprawiony,
zdarzenie sie nie powtorzylo. Brak zmiany kodu.

Testy: ast.parse (observer.py, operator_ui.py, materializer.py) OK,
bash -n deploy.sh OK, docker compose config (merge z override) poprawnie
wstrzykuje CONTROL_PLANE_URL, pytest services/control-plane/tests 114
passed, pytest services/agent-system/telegram-bot/tests 8 passed.

Co NIE zrobiono (poza zakresem/deploy nalezy do operatora): rzeczywisty
redeploy agent-system na PIHA + weryfikacja panelu na zywo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 14:14:19 +02:00
..
runtime-materializer Fix Copy for AI: materializer fetches from control-plane API instead of Redis 2026-05-27 16:07:51 +02:00
scripts Add Telegram approval bot for agent actions 2026-05-16 21:53:06 +02:00
telegram-bot fix(telegram-bot): correct risk_level field + show description in alerts 2026-05-29 16:26:49 +02:00
webui feat(observer): 3-state node liveness (fresh/stale/dead) + transitions + read-time net 2026-06-17 20:07:25 +02:00
action-model.md docs: uzupelnij dokumentacje pod katem agentow AI 2026-05-20 12:06:23 +02:00
deploy.sh fix(agent-system): deploy.sh nigdy nie dolaczal override'u hosta -> panel czytal legacy Redis, nie VPS observera 2026-07-17 14:14:19 +02:00
docker-compose.yml feat(observer): 3-state node liveness (fresh/stale/dead) + transitions + read-time net 2026-06-17 20:07:25 +02:00
env.example Refactor Telegram bot to use control plane API 2026-05-17 23:42:52 +02:00
README.md Refactor Telegram bot to use control plane API 2026-05-17 23:42:52 +02:00

Agent System

Central runtime materializer and Operator Control Plane UI.

Components

  • Redis: Central state store (on PIHA).
  • Runtime Materializer: Converts Redis state to JSON files in /opt/homelab/world.
  • Web UI: Exposes API endpoints and serving the Operator UI.
  • Telegram Bot: Provides operator commands and action approvals via Telegram.

Configuration

Environment variables should be set in .env (see env.example). Key variables for the Telegram Bot:

  • TELEGRAM_BOT_TOKEN: Your bot token from @BotFather.
  • TELEGRAM_ALLOWED_USER_IDS: Comma-separated list of authorized Telegram User IDs.
  • CONTROL_PLANE_URL: URL to the agent-system-webui (default: http://webui:8080).

Telegram Commands

  • /status: Check bot and API connectivity.
  • /summary: System health overview.
  • /nodes: List homelab nodes and their status.
  • /services: Summary of services across nodes.
  • /unhealthy: List all unhealthy components.
  • /incidents: View active incidents.
  • /actions: Summary of operator actions.
  • /help: List all commands.

Deployment (on PIHA)

cd services/agent-system
./deploy.sh

Deployment (on CHELSTY)

cd services/stability-agent
docker compose up -d --build

Verification

The deploy.sh script automatically verifies the local endpoints. You can also manually check:

# Check runtime summary
curl http://localhost:18180/summary

# Check discovered nodes
curl http://localhost:18180/nodes

# Check discovered services
curl http://localhost:18180/services

Directory Structure

  • /opt/homelab/world: Contains materialized JSON state.
  • /opt/homelab/state: Contains operator configuration and local heartbeats.