Skip to content

bug: GetDevices mutates Syncthing state (auto-deletes pending devices) as a side-effect #27

Description

@gitcoder89431

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions