#11478: Chore: add Dockerfile HEALTHCHECK and debug-log silent catch blocks
gateway
docker
agents
stale
Cluster:
Docker and Deployment Improvements
#### Summary
Added HEALTHCHECK to the Dockerfile and added debug logging to silent catch blocks in 3 files. No behavior changes.
lobster-biscuit
#### Why This Matters
HEALTHCHECK lets container orchestrators (Docker Compose, Swarm, K8s) detect an unresponsive gateway and restart it automatically. Uses Node 22 native
`fetch()` against the `/health` endpoint every 30s.
Silent catch blocks were making debugging harder. They now log via `getLogger().debug()` — crash behavior unchanged.
#### Tests
- `pnpm build` and `pnpm check` pass
- No new tests — logging-only and Dockerfile changes
#### Manual Testing
1. `docker build -t openclaw-test .` then `docker inspect` shows HEALTHCHECK
2. Debug logs only appear when actual errors occur during gateway operation
#### Evidence
- `Dockerfile` — added HEALTHCHECK
- `src/infra/update-startup.ts` — log update check failures
- `src/agents/model-auth.ts` — log auth profile resolution failures
- `src/gateway/server-close.ts` — log shutdown cleanup failures (pluginServices, configReloader, browserControl)
Telegram catch blocks (`withTelegramApiErrorLogging` already handles logging), media-understanding speculative JSON parse blocks, and cleanup/finally
blocks were intentionally left unchanged.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a Dockerfile HEALTHCHECK that probes the gateway’s `/health` endpoint via Node’s built-in `fetch()`, and replaces a few silent `catch {}` blocks with `getLogger().debug(...)` calls in the auth profile resolver, gateway shutdown handler, and update check scheduler. The logging changes are localized and keep control flow the same; the main behavioral impact is the new container health probe, which will affect how orchestrators classify the service as healthy/unhealthy.
<h3>Confidence Score: 3/5</h3>
- This PR is mostly safe, but the Docker HEALTHCHECK may mark containers unhealthy depending on gateway /health auth behavior.
- The code changes are small and limited to logging, but the Dockerfile HEALTHCHECK introduces a new runtime contract with orchestrators. If `/health` requires auth under the default container config, the container will flap unhealthy and be restarted despite the gateway running normally.
- Dockerfile
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#13950: fix(docker): add browser sidecar service and health checks
by n24q02m · 2026-02-11
82.1%
#9190: feat(docker): Add autonomous container self-restart and runtime pac...
by alexdredmon · 2026-02-05
81.2%
#9999: Docker: fix token mismatch and add dev setup workflow
by benclarkeio · 2026-02-06
79.3%
#8050: fix: docker hardening
by christopherbarnett96 · 2026-02-03
79.2%
#9881: chore(compose): harden gateway (localhost ports, limits, logging, h...
by tiagoderossi · 2026-02-05
78.7%
#8478: Security: remove --allow-unconfigured from default Dockerfile CMD
by uttej-badwane · 2026-02-04
78.4%
#8710: fix: Docker 安全強化與 Ollama 整合
by bluefishs · 2026-02-04
78.3%
#7133: feat: Automated Docker setup with environment-based configuration
by synetalsolutions · 2026-02-02
78.0%
#13953: feat(docker): add .env template and improve Dockerfile
by n24q02m · 2026-02-11
77.8%
#12504: fix: allow docker cli container to connect to gateway
by bvanderdrift · 2026-02-09
77.4%