1.5 KiB
1.5 KiB
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-workerwhen 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
- Add watchdog-oriented backend services for stale-sync recovery and persisted health snapshot access.
- Add admin API endpoints for Dify health visibility and manual stale-sync cleanup.
- Add host watchdog script and deployment wiring on
192.168.100.230. - Extend admin UI with a compact Dify health panel.
- Verify locally, deploy to server, run real Dify health and sync smoke checks.