8f1a260d96
Includes PR #745 isolated credentials fix - prevents API key hijacking from random project .env files by using centralized credentials from ~/.claude-mem/.env Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.1 KiB
2.1 KiB
Phase 02: Merge PR #820 - Health Check Endpoint Fix
PR: https://github.com/thedotmack/claude-mem/pull/820
Branch: fix/health-check-endpoint-811
Status: Has conflicts, needs rebase
Review: Approved by bayanoj330-dev
Priority: HIGH - Fixes 15-second timeout issue affecting all users
Summary
Fixes the "Worker did not become ready within 15 seconds" timeout issue by changing health check functions from /api/readiness to /api/health.
Root Cause: isWorkerHealthy() and waitForHealth() were using /api/readiness which returns 503 until full initialization completes (including MCP connection which can take 5+ minutes). Hooks only have 15 seconds timeout.
Solution: Use /api/health (liveness check) which returns 200 as soon as HTTP server is listening.
Files Changed
| File | Change |
|---|---|
src/shared/worker-utils.ts |
Change /api/readiness → /api/health in isWorkerHealthy() |
src/services/infrastructure/HealthMonitor.ts |
Change /api/readiness → /api/health in waitForHealth() |
tests/infrastructure/health-monitor.test.ts |
Update test to expect /api/health |
Dependencies
- None - Independent fix
Fixes Issues
- #811
- #772
- #729
Tasks
- Checkout PR branch
fix/health-check-endpoint-811and rebase onto main to resolve conflicts - Review the endpoint change logic in
worker-utils.tsandHealthMonitor.ts - Verify build succeeds after rebase
- Run health monitor tests:
npm test -- tests/infrastructure/health-monitor.test.ts - Merge PR #820 to main
- Manual verification: Kill worker and start fresh session - should not see 15-second timeout
Verification
# After merge, verify hooks work during MCP initialization
# Start a fresh session and observe logs
tail -f ~/.claude-mem/logs/worker.log | grep -i "health"
Notes
- This is a quick fix with minimal code changes
- The
/api/healthendpoint returns 200 as soon as Express is listening - Background initialization continues after health check passes
- Related to PR #774 which had the same fix but has merge conflicts