Android BYOD: "Unenroll" , "Lock", "Clear passcode" still shown in Actions while a Wipe/Unenroll is pending
Fleet versions
- Discovered: 4.94.0-rc.2610131847
- Reproduced: 4.94.0-rc.2610131847
Web browser and operating system: Chrome on macOS
💥 Actual behavior
On a personally-owned (BYOD) Android host, after Unenroll (or Wipe) is sent while the device is offline, Host details > Actions still offers Unenroll (plus Lock and Clear passcode), and nothing in the UI shows that an action is pending. An admin can click Unenroll again on top of the pending work-profile wipe.
The API hides the pending state for BYOD Android: GET /api/v1/fleet/hosts/{id} returns "pending_action": "" and "device_status": "unlocked" while the work-profile WIPE is still Pending (suppressAndroidBYODWipeStatus in server/service/hosts.go). The Actions dropdown only hides Unenroll when device_status !== "unlocked" (frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx), so it stays visible.
For comparison, a company-owned Android host with a pending wipe returns "pending_action": "wipe" from GET /hosts/{id}.
🛠️ Expected behavior
While an Unenroll or Wipe is pending on a BYOD Android host, Unenroll, Lock, and Clear passcode is removed from the Actions menu, consistent with how pending actions are handled on other platforms (per LeAnn).
🧑💻 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.
- Fleet Premium with Android MDM turned on. Enroll an Android phone with a work profile (BYOD, MDM status "On (personal)").
- Put the phone in airplane mode.
- On Host details, click Actions > Unenroll and confirm. (Same result with
POST /api/v1/fleet/hosts/{id}/wipe.) - Refresh Host details and click Actions: Unenroll, Lock and Clear passcode are still offered; no pending status is shown.
GET /api/v1/fleet/hosts/{id}→"enrollment_status": "On (personal)","device_status": "unlocked","pending_action": "".- Turn airplane mode off → the work profile is removed, host shows MDM Off.
🕯️ More info (optional)
- Repro log (BYOD, Unenroll clicked in UI while device offline, 2026-10-19):
- 17:26:51 UTC:
mdm_unenrolledlogged (admin actor) before any device ack; WIPEf40d81d3-…Pending. - While pending:
GET /hosts/{id}→"enrollment_status": "On (personal)","device_status": "unlocked","pending_action": ""; Actions still offers Unenroll, Lock, Clear passcode (screenshot above). - 17:29:07 UTC: device back online → WIPE Acknowledged, second
mdm_unenrolledlogged, host MDM Off.
- 17:26:51 UTC:
- Clicking Unenroll again while pending is accepted (204) and sends a second AMAPI WIPE; on reconnect the work profile is removed once and the extra WIPE stays Pending until the next re-enroll. Nothing breaks, but it's avoidable.
- A BYOD Unenroll logs
mdm_unenrolledtwice (on click and on device ack). - LeAnn is filing a separate quick win to improve the pending-actions dropdown.
QA'd on rc-minor-fleet-v4.95.0 (local dev server, build 65eede4869) with a Pixel 8a, first as personal enrollment (MDM "On (personal)") and then as company-owned (MDM "On (automatic)"). All pass.
| Flow | Host | Steps | Expected | Result |
|---|---|---|---|---|
| Baseline | Pixel 8a | Host details > Actions with nothing pending | Unenroll offered; pending_action: "" |
Pass |
| Unenroll while offline: UI | Pixel 8a | Airplane mode on, Actions > Unenroll, open Actions without reload and after reload | Only Transfer and Delete offered; no badge next to the host name | Pass |
| Unenroll while offline: API | Pixel 8a | GET /api/v1/fleet/hosts/{id} and GET /api/v1/fleet/hosts?include_device_status=true |
pending_action: "unenroll", device_status: "unlocked" on both |
Pass |
| Second Unenroll / Wipe while pending | Pixel 8a | DELETE /api/v1/fleet/hosts/{id}/mdm, then POST /api/v1/fleet/hosts/{id}/wipe |
409 "Couldn't unenroll. This host already has a pending unenroll. It will unenroll when it comes online."; 422 for wipe; no new WIPE command | Pass |
| Stale page Unenroll | Pixel 8a | Open the Unenroll modal, send a wipe through the API, then confirm the modal | 409; toast shows the pending-unenroll message (not "MDM already turned off"); no new WIPE command | Pass |
| Wipe through API while offline | Pixel 8a | POST /api/v1/fleet/hosts/{id}/wipe, then GET host details/list and reload Host details |
pending_action: "unenroll"; Actions offers only Transfer and Delete |
Pass |
| Device back online | Pixel 8a | Airplane mode off | WIPE Acknowledged; host MDM Off; pending_action: "" |
Pass |
| Regression: company-owned pending wipe | Pixel 8a (company-owned) | Baseline Actions, then airplane mode on, Actions > Wipe, reload | Baseline offers Lock, Wipe, Clear passcode (no Unenroll); while pending, "Wipe pending" badge, Actions offers only Transfer and Delete, API pending_action: "wipe" |
Pass |
Docs: the PR says the REST API docs for the new pending_action value will go in a separate PR. That PR isn't open yet, and docs-v4.95.0 (docs/API/rest-api.md, List hosts) still lists only lock, unlock, wipe, or an empty string. The new 409 from DELETE /api/v1/fleet/hosts/{id}/mdm isn't documented under "Turn off host's MDM" either.
Actions blur in the mist device sleeps, work still pending show what waits to come