Skip to content

bug: server removal is not atomic with the config commit; a pending removal can be resurrected by any later save #1559

Closed

Description

@Dumbris

Problem

Removing a server is not part of the config commit protocol, and a pending (async) removal can be undone by any later save:

  • REST removal (Server.RemoveServer, internal/server/server.go:2153-2240) removes the client and storage row first and only then calls SaveConfiguration (takes configCommitMu), while the live config still lists the server. A concurrent LoadConfiguredServers in that gap re-creates the deleted storage row (lifecycle.go:1557) and reconnects it; the removal's own save then republishes the recreated row. A successful DELETE leaves the server configured and possibly running.
  • Config-driven removal is asynchronous (lifecycle.go:1613-1640): cleanup runs later in a goroutine. If an unrelated commit (add/toggle of server B -> SaveConfiguration, :1667) happens before cleanup, SaveConfiguration rebuilds the server list from storage and republishes A into runtime config and disk. A then looks "configured" again, the cleanup guard/skip logic cancels the removal, and A stays configured/persisted despite the successful removal.
  • A delayed sync that resumes after such a resurrection reconciles against the resurrected config, so A is never even scheduled for removal.

Failure scenario

Apply a config removing A, delay cleanup, add B (save republishes A from storage), release cleanup: A remains in storage, runtime config, disk and the manager.

Suggested direction

Introduce a single removal commit (under configCommitMu: drop from live config, delete storage row, retire client) used by REST, MCP and config-driven paths, plus a pending-removal tombstone that SaveConfiguration/reconcile/supervisor respect until cleanup finishes, while still allowing a deliberate re-add. Tests: gate cleanup, add B, release; REST removal paused after storage delete while reconcile runs.

Where Sol found it

ux01-r3.txt #2, ux01-r4.txt #2, ux01-r6a.txt #3, ux01-r7a.txt #2, ux01-r10-B.txt #1.

Related: #1558


Found by OpenCode Sol 6.1 cross-model review of the (now split) oversized PRs #1553 (UX-01) and #1555 (UX-02); verified still present on origin/main (704795c) by reading the cited sites. Pre-existing, deliberately out of scope of the minimal core PRs. Review transcripts: docs/qa/0.70.0-ux-2026-10-10/remediation/reviews/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/storagekind/bugpriority/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions