Skip to content

Preserve recovered project MCP settings when creating the settings file #2175

Open

Description

@edelauna

The JSON persistence caller audit identified a default-write gap in the openProjectMcpSettings handler.

Source: src/core/webview/webviewMessageHandler.ts.

The handler checks whether .roo/mcp.json exists. If it appears absent, it calls safeWriteJson with an empty mcpServers object and no merge. The writer can restore an orphaned committed backup, then replace that restored content with defaults. A peer can also create settings between the existence check and the write.

Proposed scope:

  • Decide whether defaults are needed while holding the file lock.
  • Preserve valid settings restored from backup or written by a peer.
  • Keep the normal empty-file creation behavior.

Acceptance:

  • A genuinely missing file gets default settings.
  • Opening settings preserves a valid orphaned backup.
  • A concurrent creator's settings survive.
  • Recovery failures retain backups and remain observable.

Evidence: source inspection. Add regression coverage through the public message handler.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions