exo icon indicating copy to clipboard operation
exo copied to clipboard

feat(macos-app): add custom namespace UI for cluster isolation

Open madanlalit opened this issue 2 months ago • 5 comments

Overview

Add Advanced Options section with custom namespace field that allows users to override EXO_LIBP2P_NAMESPACE environment variable. This enables splitting machines that can see each other into separate clusters.

  • Added customNamespace property with UserDefaults persistence
  • Added Advanced Options collapsible section with text field
  • Added Save & Restart button that auto-restarts exo process
  • Namespace replaces buildTag when custom value is set
  • Falls back to buildTag (version) when namespace is empty

Motivation

EXO supports multiple p2p namespaces to split up clusters via the EXO_LIBP2P_NAMESPACE environment variable when building from source. However, when using the macOS app, this was hardcoded to the application version, making it impossible for users to isolate machines into separate clusters without rebuilding the app.

This PR adds a UI option in the macOS app to set a custom namespace, allowing users to split machines that can see each other into multiple logical clusters.

Changes

  • Added customNamespace property to ExoProcessController.swift with UserDefaults persistence
  • Added "Advanced Options" collapsible section to ContentView.swift (similar to existing Debug Info section)
  • Added text field for entering custom namespace with "Save & Restart" button
  • Modified computeNamespace() to use custom namespace when set, falling back to buildTag (app version) when empty
  • Button is disabled when no changes are pending
  • Automatically restarts exo process when namespace is saved (if running)

Why It Works

The implementation modifies the makeEnvironment() function to set EXO_LIBP2P_NAMESPACE using the custom value from UserDefaults. When the namespace is changed and saved:

  1. User enters namespace in text field (value stored in local state)
  2. Clicking "Save & Restart" writes to UserDefaults and calls controller.restart()
  3. On next launch, computeNamespace() returns the custom value instead of buildTag
  4. This namespace is used when creating the exo process, isolating it from other clusters

Test Plan

Manual Testing

Hardware: MacBook Air M1 8GB (macOS 26.02)

What I tested:

  • Verified namespace field appears in Advanced Options section
  • Tested entering custom namespace (e.g., "my-cluster")
  • Confirmed "Save & Restart" button restarts exo process
  • Verified namespace persists across app restarts (UserDefaults)
  • Tested empty namespace falls back to buildTag (app version)
  • Confirmed button is disabled when no changes pending

Automated Testing

No automated tests added.

madanlalit avatar Dec 24 '25 17:12 madanlalit