Problem
GetDevices is a read method but it silently deletes pending devices older than 5 minutes as a side-effect:
if err == nil && time.Since(t) > 5*time.Minute {
_ = c.delete("/rest/cluster/pending/devices?device=" + id)
continue
}
This is dangerous because:
- Every call to
GetDevices (polling, MCP list_devices, CLI meshd devices, meshd status) mutates state
- A user who runs
meshd status will silently dismiss pending devices they haven't seen yet
- The MCP
list_devices tool would also trigger deletions on every agent query
Fix
Remove the auto-dismiss logic from GetDevices entirely. Either:
- Add an explicit
CleanupStalePendingDevices() method called only where appropriate (e.g. on TUI startup)
- Or expose stale pending devices in the UI with a visual indicator and let the user dismiss them manually via
d key
Problem
GetDevicesis a read method but it silently deletes pending devices older than 5 minutes as a side-effect:This is dangerous because:
GetDevices(polling, MCPlist_devices, CLImeshd devices,meshd status) mutates statemeshd statuswill silently dismiss pending devices they haven't seen yetlist_devicestool would also trigger deletions on every agent queryFix
Remove the auto-dismiss logic from
GetDevicesentirely. Either:CleanupStalePendingDevices()method called only where appropriate (e.g. on TUI startup)dkey