feat(device): PENDING_DELETION status while client uninstall is in flight - #1794
Open
aliaska-varieva wants to merge 3 commits into
Open
feat(device): PENDING_DELETION status while client uninstall is in flight#1794aliaska-varieva wants to merge 3 commits into
aliaska-varieva wants to merge 3 commits into
Conversation
…ight - Force client uninstall marks the machine PENDING_DELETION after publishing the command (skips machines already DELETED) - MachineStatusService ignores connect/disconnect/heartbeat events for machines in PENDING_DELETION or DELETED, so the still-running agent can't flip the device back to ONLINE/OFFLINE before it uninstalls - Agent deregistration callback still moves PENDING_DELETION -> DELETED Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
yevhenii-flamingo
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Between "dashboard triggered uninstall" and "agent finished uninstalling and deregistered", the device is still alive and heartbeating — so it kept flipping back to ONLINE and looked healthy in the dashboard. This PR makes that window explicit:
DeviceStatus.PENDING_DELETION— new status set byForceClientUninstallServiceright after the uninstall command is published (machines alreadyDELETEDare skipped with aFAILEDitem instead of publishing a command that could only replay later).MachineStatusServicenow ignores connect/disconnect/heartbeat events for machines inPENDING_DELETIONorDELETED— device-side signals can no longer resurrect a device that is being (or has been) deleted. This is the single funnel for all device-driven status flips (ClientConnectionListener,MachineHeartbeatListener); the management-side offline-detection job only queriesONLINEmachines, so it needs no change.POST /api/agents/uninstall) still transitionsPENDING_DELETION→DELETEDunchanged.Deliberate escape hatch: an explicit
/registeror/reinstallstill resets the status (toPENDING) — a human intentionally reinstalling the client on a machine outranks a stale pending deletion.Status flow
ONLINE/OFFLINE→ (force uninstall published) →PENDING_DELETION→ (agent deregisters) →DELETEDTesting
mvn test-compileclean across touched modules; no exhaustive switches overDeviceStatusexist, so the new enum value is additive.🤖 Generated with Claude Code