-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(queen): Add proper daemon supervisor with PID tracking #430
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestpriority:P2MediumMediumstatus:pendingQueuedQueued
Description
Problem
Queen daemon lacks proper supervision — no heartbeat monitoring, auto-restart, or health tracking.
Requirements
- PID tracking —
queen.pidfile with process lifecycle - Health monitor — periodic heartbeat checks
- Auto-restart — restart on crash (with backoff)
- Graceful shutdown — SIGTERM handling with cleanup
- Status command —
tri queen statusshows real state
Implementation Plan
Phase 1: PID File
// .trinity/queen/queen.pid
{
"pid": 12345,
"started_at": 1773945606,
"heartbeat": 1774273571
}Phase 2: Monitor Loop
- Read PID file every 30s
- Check if process exists (kill -0)
- If dead: log, wait, restart (exponential backoff)
Phase 3: Signal Handling
- SIGTERM: graceful shutdown (save state, close connections)
- SIGINT: same as SIGTERM
- SIGHUP: reload config
Phase 4: Status Command
tri queen status
# → Running: ✓ | PID: 12345 | Uptime: 3d 2h | Heartbeat: 5s agoSuccess Criteria
- PID file created on start, removed on exit
- Monitor detects dead Queen within 30s
- Auto-restart with max 3 retries/hour
-
tri queen statusshows accurate info - Graceful shutdown saves state
References
- Doctor:
./zig-out/bin/queens doctor - State:
.trinity/queen_state.json
φ² + 1/φ² = 3 = TRINITY
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority:P2MediumMediumstatus:pendingQueuedQueued
Projects
Status
No status