Skip to content

[Fleet] Update query in delete unenrolled agents task#224808

Merged
juliaElastic merged 1 commit intoelastic:mainfrom
juliaElastic:delete-unenrolled-task
Jun 24, 2025
Merged

[Fleet] Update query in delete unenrolled agents task#224808
juliaElastic merged 1 commit intoelastic:mainfrom
juliaElastic:delete-unenrolled-task

Conversation

@juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Jun 23, 2025

Summary

Issue reported by users that some unenrolled agents on the UI are not being deleted by the background task.
The cause turned out to be a discrepancy in how unenrolled agents are determined on the UI versus the background task.

The UI shows agents as unenrolled if active:false field matches (logic here)

The delete unenrolled agents task also queried on the existence of unenrolled_at field.
It seems some agents don't have this field set, those should be deleted too.

@juliaElastic juliaElastic self-assigned this Jun 23, 2025
@juliaElastic juliaElastic requested a review from a team as a code owner June 23, 2025 09:15
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Jun 23, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

cc @juliaElastic

Copy link
Contributor

@Supplementing Supplementing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@juliaElastic juliaElastic merged commit c989634 into elastic:main Jun 24, 2025
20 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.17, 8.18, 8.19, 9.0

https://github.com/elastic/kibana/actions/runs/15843281758

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.17 Backport failed because of merge conflicts
8.18 Backport failed because of merge conflicts
8.19 Backport failed because of merge conflicts
9.0 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 224808

Questions ?

Please refer to the Backport tool documentation

juliaElastic added a commit to juliaElastic/kibana that referenced this pull request Jun 24, 2025
Issue reported by users that some unenrolled agents on the UI are not
being deleted by the background task.
The cause turned out to be a discrepancy in how unenrolled agents are
determined on the UI versus the background task.

The UI shows agents as unenrolled if `active:false` field matches (logic
[here](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/fleet/server/services/agents/build_status_runtime_field.ts#L115-L119))

The delete unenrolled agents task also queried on the existence of
`unenrolled_at` field.
It seems some agents don't have this field set, those should be deleted
too.
juliaElastic added a commit to juliaElastic/kibana that referenced this pull request Jun 24, 2025
Issue reported by users that some unenrolled agents on the UI are not
being deleted by the background task.
The cause turned out to be a discrepancy in how unenrolled agents are
determined on the UI versus the background task.

The UI shows agents as unenrolled if `active:false` field matches (logic
[here](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/fleet/server/services/agents/build_status_runtime_field.ts#L115-L119))

The delete unenrolled agents task also queried on the existence of
`unenrolled_at` field.
It seems some agents don't have this field set, those should be deleted
too.
juliaElastic added a commit to juliaElastic/kibana that referenced this pull request Jun 24, 2025
Issue reported by users that some unenrolled agents on the UI are not
being deleted by the background task.
The cause turned out to be a discrepancy in how unenrolled agents are
determined on the UI versus the background task.

The UI shows agents as unenrolled if `active:false` field matches (logic
[here](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/fleet/server/services/agents/build_status_runtime_field.ts#L115-L119))

The delete unenrolled agents task also queried on the existence of
`unenrolled_at` field.
It seems some agents don't have this field set, those should be deleted
too.
@mistic
Copy link
Contributor

mistic commented Jun 24, 2025

This PR didn't make it on time for the latest v8.18.3 and v9.0.3 BC. Updating the labels

akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request Jun 25, 2025
## Summary

Issue reported by users that some unenrolled agents on the UI are not
being deleted by the background task.
The cause turned out to be a discrepancy in how unenrolled agents are
determined on the UI versus the background task.

The UI shows agents as unenrolled if `active:false` field matches (logic
[here](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/fleet/server/services/agents/build_status_runtime_field.ts#L115-L119))

The delete unenrolled agents task also queried on the existence of
`unenrolled_at` field.
It seems some agents don't have this field set, those should be deleted
too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:fix Team:Fleet Team label for Observability Data Collection Fleet team v8.18.4 v9.0.4 v9.1.0

5 participants