[PR #1900] [MERGED] Reset hcHealth to "unknown" when health check is disabled #2754

Closed
opened 2026-04-16 09:35:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/pangolin/pull/1900
Author: @Copilot
Created: 11/20/2025
Status: Merged
Merged: 12/6/2025
Merged by: @oschwartz10612

Base: mainHead: copilot/fix-hc-health-status-unknown


📝 Commits (2)

  • 94b34c4 Initial plan
  • be4d697 Set hcHealth to 'unknown' when health check is disabled in updateTarget

📊 Changes

1 file changed (+8 additions, -1 deletions)

View changed files

📝 server/routers/target/updateTarget.ts (+8 -1)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/pangolin/pull/1900 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 11/20/2025 **Status:** ✅ Merged **Merged:** 12/6/2025 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `main` ← **Head:** `copilot/fix-hc-health-status-unknown` --- ### 📝 Commits (2) - [`94b34c4`](https://github.com/fosrl/pangolin/commit/94b34c489c673a2751bf76ed6c8e20cba01d4f70) Initial plan - [`be4d697`](https://github.com/fosrl/pangolin/commit/be4d697dfed7124c8241105fc5ea277bb819fb1e) Set hcHealth to 'unknown' when health check is disabled in updateTarget ### 📊 Changes **1 file changed** (+8 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `server/routers/target/updateTarget.ts` (+8 -1) </details> ### 📄 Description 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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 09:35:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#2754