cloudflare / cloudflare/moltworker
Admin UI: show gateway status and improve controls
- Dominant language
- TypeScript
- Stars
- 10k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
The admin UI's Gateway Controls section only shows a "Restart Gateway" button with static text. There's no indication of whether the gateway is actually running, starting, or stopped.
This makes it hard to diagnose issues — for example, the sync endpoint returns 500 when the gateway isn't running (#207), but the admin UI gives no visual clue that the gateway is down. You have to check logs to understand what's happening.
After clicking "Restart Gateway", there's also no feedback on whether the restart succeeded. The button shows "Restarting..." briefly during the API call, but the restart is fire-and-forget (`waitUntil`) so the client never learns the outcome.
## Proposal
Add a gateway status indicator and improve the controls:
1. **New endpoint** `GET /api/admin/gateway/status` returning process state (`running` / `starting` / `stopped`) using the existing `findExistingMoltbotProcess()` + a quick port check
2. **Status badge** next to "Gateway Controls" header — green "Running" / yellow "Starting" / red "Stopped"
3. **Context-aware button** — show "Start Gateway" when stopped, "Restart Gateway" when running
4. **Post-restart polling** — after restart, poll status until gateway is ready (or timeout with error)
5. **Disable "Backup Now"** when gateway is stopped, since sync requires the gateway (#207)
## Related
- #207 — R2 backup fails when gateway isn't running (chicken-and-egg)
- #209 — adds `ensureMoltbotGateway()` before sync
- #211 — adds gateway check + diagnostics to sync endpoint
Contributor guide
Assessment
This issue has not been assessed yet.