← Back to PRs

#10123: fix: guard deep health probe against unreachable gateway (#9091)

by petter-b open 2026-02-06 04:51 View on GitHub →
commands stale size: S trusted-contributor
Root cause: `status --deep` health probe had no `gatewayReachable` guard and no error handling, causing crashes when gateway is unreachable. Fix: Add `gatewayReachable` guard (matching `status-all.ts` pattern) and capture errors via `.catch((err) => ({ error: String(err) }))` for display in the Health section. Test: Two independent tests verify (1) guard prevents health probe when gateway unreachable, (2) errors are captured and displayed when probe fails. Fixes #17106 <!-- greptile_comment --> <h3>Greptile Summary</h3> Added `gatewayReachable` guard to prevent health probe when gateway is unreachable, and wrapped the probe in `.catch()` to capture errors instead of crashing. This matches the established pattern from `status-all.ts:192-198` where health probes are guarded and errors are caught. - Fixed crash when `status --deep` runs with unreachable gateway - Added type guard `isHealthError()` to distinguish error results from valid `HealthSummary` objects - Added comprehensive tests covering both guard and error-capture scenarios - Updated CHANGELOG.md with fix description Minor issue: type guard function is placed between import statements (should be moved after all imports). <h3>Confidence Score: 4/5</h3> - Safe to merge after fixing import placement - The fix correctly implements the guard pattern from `status-all.ts`, adds proper error handling, and includes thorough tests. One syntax issue (type guard between imports) needs fixing, but the core logic is sound. - Fix `src/commands/status.command.ts:38-42` to move type guard after imports <sub>Last reviewed commit: 0a0dd16</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs