Files
syops/project-governance/plans/2026-03-29-dify-self-healing-plan.md
T
2026-04-27 17:03:56 +08:00

1.5 KiB
Raw Blame History

Dify Self-Healing Implementation Plan

For agent: REQUIRED SUB-SKILL: Use Section 4 or Section 5 to implement this plan. Goal: Add automatic Dify sync self-healing so stuck syncs recover cleanly, admins can see Dify health, and the server can restart Dify worker when queue execution stalls. Architecture: The backend gains a watchdog service layer for stale-sync recovery and health snapshot reading, plus admin APIs for inspection and manual recovery. A host-level watchdog script on the deployment server inspects Dify queues/tasks via Docker, persists a JSON health snapshot into the app data volume, and restarts dify-worker when stuck-task thresholds are exceeded. Tech Stack: FastAPI, SQLAlchemy, Vue 3, Docker Compose, Redis, PostgreSQL, host-side Python watchdog script.

Scope

  • Backend stale sync recovery logic
  • Admin health/status APIs
  • Host watchdog script and server cron installation
  • Admin console Dify health panel
  • Real server verification

Non-Goals

  • Replacing Dify’s own queue implementation
  • Automatic blind resync loops for failed documents
  • Adding Docker socket access into the app containers

Task Outline

  1. Add watchdog-oriented backend services for stale-sync recovery and persisted health snapshot access.
  2. Add admin API endpoints for Dify health visibility and manual stale-sync cleanup.
  3. Add host watchdog script and deployment wiring on 192.168.100.230.
  4. Extend admin UI with a compact Dify health panel.
  5. Verify locally, deploy to server, run real Dify health and sync smoke checks.