fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Android re-enrollment doesn't update the host's enrollment or last-seen time

Open AndreyKizimenko opened this issue 2 months ago • 2 comments

Fleet versions

  • Discovered: 4.92.0-rc.2609041753
  • Reproduced: 4.92.0-rc.2609041753

Web browser and operating system: Chrome running on macOS; Android 16 (Samsung SM-S906U1, BYOD work profile)


💥 Actual behavior

When an Android host re-enrolls, nothing on the host itself records it. I removed and re-added the work profile, and Fleet processed the re-enrollment — but Host details still shows the original enrollment date, and the host stays "offline."

The only sign it happened is a fleet_enrolled entry in the global activity feed. If you're looking at the host, there's no way to tell it re-enrolled a minute ago.

The "offline" part is the same root cause: an Android host's last-seen time is only ever set when the host row is first created, so every Android host reads offline once the online window passes, and re-enrolling doesn't refresh it.

🛠️ Expected behavior

A re-enrollment should update the host's enrollment and last-seen times, so Host details shows when the device actually re-enrolled and the host doesn't sit there permanently marked offline.

🧑‍💻 Steps to reproduce

These steps:

  • [ ] Have been confirmed to consistently lead to reproduction in multiple Fleet instances.
  • [x] Describe the workflow that led to the error, but have not yet been reproduced in multiple Fleet instances.
  1. Enroll an Android host (BYOD work profile) and note the enrollment date on Host details.
  2. On the device, remove the work profile and re-enroll it with the same enrollment secret.
  3. Confirm Fleet processed the re-enrollment — a fleet_enrolled activity appears in the global activity feed and the host's software/vitals timestamps move.
  4. Host details still shows the original enrollment date, and the host still reads "offline."

🕯️ More info (optional)

Two columns are never written on the Android path:

  • UpdateAndroidHost's UPDATE statement covers detail_updated_at, label_updated_at, hostname, OS, build, memory, serial, CPU, model, vendor and UUID — but not last_enrolled_at (server/datastore/mysql/android.go:263-277). Git history shows last_enrolled_at has never appeared in that file.
  • Nothing in server/mdm/android/ or server/datastore/mysql/android.go touches host_seen_times, so seen_time keeps the value from host creation. Host.Status() is computed purely from seen_time with no platform special-casing (server/fleet/hosts.go:1299-1317), which is why Android hosts read offline.

Observed via the API on the same host, before and after a re-enrollment that Fleet definitely processed:

before after
last_enrolled_at 2026-09-03T18:57:29Z 2026-09-03T18:57:29Z
seen_time 2026-09-03T18:57:29Z 2026-09-03T18:57:29Z
detail_updated_at 2026-09-04T16:03:22Z 2026-09-04T19:15:26Z
software_updated_at 2026-09-04T16:03:22Z 2026-09-04T19:15:26Z
status offline offline

created_at is unchanged too, which is correct — the re-enroll reuses the existing host row rather than creating a new one.

Not new in 4.92; this is how the Android enrollment path has always worked. Found while QAing #43500, where it makes the story hard to verify from the UI: the whole point is what happens on re-enrollment, and Host details gives no indication that a re-enrollment occurred.

Small related nit, mentioning it here rather than filing separately: the fleet_enrolled activity shows the host as "samsung SM-S906U1" (the raw device name) instead of the display name used everywhere else ("QA-1-FirstName QA-1-LastName's Samsung SM-S906U1").

AndreyKizimenko avatar Sep 04 '26 19:09 AndreyKizimenko

  • Verified the re-enrollment update the host's enrollment time. Image

terry-kwok-code avatar Oct 09 '26 18:10 terry-kwok-code

Devices rejoin the flock timestamps now mark the moment clouds reflect the truth

fleet-release avatar Oct 29 '26 00:10 fleet-release