fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Deleted hosts aren't removed from the finished script runs on the batch script progress page

Open AndreyKizimenko opened this issue 1 year ago • 14 comments

Fleet version: 4.74

Web browser and operating system: N/A


💥  Actual behavior

Hosts are removed from the list, but the count is still displayed on the total progress bar and in the corresponding tab in the batch script progress.

Image

🛠️ To fix

When a host is deleted, decrease host counts for any batch script runs they were part of.

🧑‍💻  Steps to reproduce

  1. Start a batch script run on several hosts
  2. Wait for it to finish
  3. Delete the hosts on which you ran it.
  4. Open Batch script UI

🕯️ More info (optional)

We update the host count for any in-progress and scheduled scripts, just not for the finished ones

Image

AndreyKizimenko avatar Sep 24 '25 16:09 AndreyKizimenko

Nice catch! Dealing with deleted hosts was something we all missed in the initial design and have been patching as it comes up.

For the progress bar, there's not a lot we can do safely w/ the current implementation. We cache the stats on the record when it's finished, because the query to generate those numbers is expensive and as the list of finished batch runs goes it'll become prohibitive to run.

The details page we can switch to using the "live" numbers, but then they wouldn't match the progress bar 🤔 .

The more thorough solution would be to add logic to update the stats for related batch script runs when a host is deleted. I wouldn't want to do that as a cherry-pick though, it'll require some planning.

sgress454 avatar Sep 24 '25 22:09 sgress454

@AndreyKizimenko , @sgress454 , did we miss this? Since it's not 4.76.0 I removed the unreleased label. TMWYT

sharon-fdm avatar Oct 20 '25 23:10 sharon-fdm

@sgress454 @AndreyKizimenko

Alternative frontend solution:

Frontend change where if count in progress bar is bigger than the hosts listed on such tab then we add a note saying that "host counts may include deleted hosts".

lucasmrod avatar Jan 21 '26 20:01 lucasmrod

@melpike @rachaelshaw See my last comment (moving to user story review).

lucasmrod avatar Jan 21 '26 20:01 lucasmrod

@lucasmrod I'm good with that. We can include the note as a tooltip over the count badge.

Image

melpike avatar Jan 26 '26 15:01 melpike

@melpike to be 100% clear do you want to add the tooltip to the badges at all times, or only when we detect a difference between the number on the badge and the number in the label of the hosts table?

sgress454 avatar Jan 28 '26 15:01 sgress454

Frontend change where if count in progress bar is bigger than the hosts listed on such tab then we add a note saying that "host counts may include deleted hosts".

@sgress454 Thanks for following up. Yes, to be clear, I was going off of Lucas' suggestion above. However, if there's complexity I'm not accounting for, I'll defer to the eng team.

melpike avatar Jan 28 '26 16:01 melpike

However, if there's complexity I'm not accounting for, I'll defer to the eng team.

There is a bit, because we only get the second number (the one above the table) after we click the badge. So the tooltip would only appear after you click the badge at least once (but should appear immediately as long as you're still hovering over the badge). After that we can keep it so that the tooltip always appears on hover.

sgress454 avatar Jan 28 '26 16:01 sgress454

Poker planning

lucasmrod avatar Jan 29 '26 15:01 lucasmrod

@melpike How about we render a help text message above the table instead? We could trigger it conditionally, only showing it if a specific category count (like Incompatible) doesn't match the host list count. Here is a preview of how that would look:

Image Image

juan-fdz-hawa avatar Feb 24 '26 19:02 juan-fdz-hawa

How about we render a help text message above the table instead?

Thanks for bringing this up @juan-fdz-hawa! Let's follow some of the UI's existing patterns and have a tooltip on the host count above the table "Some hosts may have been removed."

Image

melpike avatar Feb 24 '26 22:02 melpike

@juan-fdz-hawa While testing this I couldn't reproduce the original issue, so the tooltip is never showing for me, unless I'm not performing the steps to reproduce correctly. Here's a video:

https://github.com/user-attachments/assets/9e45deae-cb83-46e9-b4a5-93f8417ad9b0

Perhaps there was a change on main that solved the root cause of this issue and we no longer need the tooltip?

nulmete avatar Mar 25 '26 12:03 nulmete

Only way I could get the bug to surface was to cook it using something like: INSERT INTO fleet.batch_activities (script_id, execution_id, user_id, job_id, status, activity_type, num_targeted, num_pending, num_ran, num_errored, num_incompatible, num_canceled, created_at, updated_at, started_at, finished_at, canceled) VALUES (1, uuid(), null, null, 'finished', 'script', 2, 0, 1, 0, 0, 0, '2026-03-25 17:24:06', '2026-03-25 17:26:56', '2026-03-25 17:24:06', '2026-03-25 17:24:53', 0);

juan-fdz-hawa avatar Mar 25 '26 18:03 juan-fdz-hawa

Ghosts no longer cloud Script count, clear as glass city, Fleet's truth shines brightly.

fleet-release avatar Apr 01 '26 16:04 fleet-release