Skip to content

Conversation

@Dumbris
Copy link
Contributor

@Dumbris Dumbris commented Jul 7, 2025

  • Introduced unit tests for sorting server names and quarantine server names to ensure correct alphanumeric order.
  • Added tests for menu rebuild logic to verify detection of new servers and proper sorting during updates.
  • Enhanced existing menu management functions to support sorting and rebuilding based on new server data.

- Introduced unit tests for sorting server names and quarantine server names to ensure correct alphanumeric order.
- Added tests for menu rebuild logic to verify detection of new servers and proper sorting during updates.
- Enhanced existing menu management functions to support sorting and rebuilding based on new server data.
@Dumbris Dumbris merged commit fdd1543 into main Jul 7, 2025
31 checks passed
@Dumbris Dumbris deleted the feature/menu-order branch July 14, 2025 08:53
rannow pushed a commit to rannow/mcpproxy-go that referenced this pull request Sep 23, 2025
…t-mcp-proxy#9)

- Introduced unit tests for sorting server names and quarantine server names to ensure correct alphanumeric order.
- Added tests for menu rebuild logic to verify detection of new servers and proper sorting during updates.
- Enhanced existing menu management functions to support sorting and rebuilding based on new server data.
Dumbris added a commit that referenced this pull request Nov 2, 2025
Implements Issues #3, #9, and #11 (Layers 2, 5) from docker-recovery-improvements.md

**Issue #11 Layer 2: Container Labels for Ownership Tracking**
- Add Docker labels to all containers (instance ID, server name, PID)
- formatContainerLabels() generates ownership labels automatically
- Labels: com.mcpproxy.managed, com.mcpproxy.instance, com.mcpproxy.server
- Enables accurate cleanup of orphaned containers from crashed instances
- New file: internal/upstream/core/instance.go for instance ID management

**Issue #11 Layer 5: cidfile Timeout Fallback**
- When cidfile read times out (slow image pull), fall back to name lookup
- Use 'docker ps --filter name=...' to recover container ID
- Prevents orphaned containers when cidfile fails
- Graceful degradation maintains container cleanup capability

**Issue #3: Exponential Backoff Polling**
- Replace fixed 5s Docker polling with exponential backoff
- Intervals: 2s → 5s → 10s → 30s → 60s (max)
- Fast recovery when Docker quickly resumes (2s vs 5s)
- Lower CPU/battery usage when Docker off for extended periods
- Logs total wait time and attempt count for observability

**Issue #9: Partial Failure Handling**
- ForceReconnectAll() now returns detailed ReconnectResult struct
- Tracks: total servers, attempted, successful, failed, skipped
- Per-server skip reasons ("container healthy", "not Docker", "disabled")
- Per-server failure errors for debugging
- Runtime logs comprehensive summary of reconnection results

**Files Modified:**
- internal/upstream/core/instance.go: NEW - instance ID persistence
- internal/upstream/core/isolation.go: add container labels
- internal/upstream/core/docker.go: cidfile timeout fallback
- internal/upstream/manager.go: ReconnectResult struct, detailed tracking
- internal/runtime/lifecycle.go: log reconnection results
- cmd/mcpproxy-tray/main.go: exponential backoff polling, min() helper

**Testing:**
- All upstream tests passing
- Code compiles cleanly
- Exponential backoff logic validated

**Impact:**
- Container labels enable cleanup of orphaned containers across restarts
- cidfile fallback prevents container orphaning on slow pulls
- Exponential backoff saves resources while maintaining fast recovery
- Partial failure tracking improves debugging and observability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants