Reset hcHealth to "unknown" when health check is disabled #612

Closed
opened 2026-04-05 17:26:50 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @Copilot on 11/20/2025

When disabling a target's health check via updateTarget, the hcHealth status remains at its previous value (e.g., "unhealthy"). This causes previously unhealthy targets to stay excluded from serving traffic even after health checking is turned off.

Changes

  • Set hcHealth to "unknown" when hcEnabled is set to false or null
  • Uses conditional spread to only update hcHealth when health check is being disabled
// When health check is disabled, reset hcHealth to "unknown"
const hcHealthValue = (parsedBody.data.hcEnabled === false || parsedBody.data.hcEnabled === null) 
    ? "unknown" 
    : undefined;

const [updatedHc] = await db
    .update(targetHealthCheck)
    .set({
        hcEnabled: parsedBody.data.hcEnabled || false,
        // ... other fields
        ...(hcHealthValue !== undefined && { hcHealth: hcHealthValue })
    })
    .where(eq(targetHealthCheck.targetId, targetId))
    .returning();

Fixes #1865

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: node /home/REDACTED/work/pangolin/pangolin/node_modules/.bin/next build (dns block)
  • scarf.sh
    • Triggering command: node ./report.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

On updateTarget.ts, When the health check is disabled it should set the hcHealth status to the string "unknown" because if it was previously unhealthy you dont want to keep preventing serving the resource.

Reference #1865


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

*Originally created by @Copilot on 11/20/2025* When disabling a target's health check via `updateTarget`, the `hcHealth` status remains at its previous value (e.g., "unhealthy"). This causes previously unhealthy targets to stay excluded from serving traffic even after health checking is turned off. ## Changes - Set `hcHealth` to "unknown" when `hcEnabled` is set to `false` or `null` - Uses conditional spread to only update `hcHealth` when health check is being disabled ```typescript // When health check is disabled, reset hcHealth to "unknown" const hcHealthValue = (parsedBody.data.hcEnabled === false || parsedBody.data.hcEnabled === null) ? "unknown" : undefined; const [updatedHc] = await db .update(targetHealthCheck) .set({ hcEnabled: parsedBody.data.hcEnabled || false, // ... other fields ...(hcHealthValue !== undefined && { hcHealth: hcHealthValue }) }) .where(eq(targetHealthCheck.targetId, targetId)) .returning(); ``` Fixes #1865 > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `fonts.googleapis.com` > - Triggering command: `node /home/REDACTED/work/pangolin/pangolin/node_modules/.bin/next build` (dns block) > - `scarf.sh` > - Triggering command: `node ./report.js` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/fosrl/pangolin/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > On updateTarget.ts, When the health check is disabled it should set the hcHealth status to the string "unknown" because if it was previously unhealthy you dont want to keep preventing serving the resource. > > Reference #1865 </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pangolin#612