From 42a3840f43968326f022816c89541fae0fc9a902 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 16 Nov 2025 23:31:04 +0000 Subject: [PATCH 1/2] fix(api): remove duplicate session activity GET route registration Removes the duplicate GET /sessions/:id/activity route from ActivityHandler.RegisterRoutes() since this route is already registered with SessionActivityHandler which provides more comprehensive activity tracking with database persistence and caching. The ActivityHandler now only registers the POST /sessions/:id/heartbeat endpoint, avoiding the panic: handlers are already registered for path '/api/v1/sessions/:id/activity' Fixes duplicate route registration that was causing API server startup failure. --- api/internal/handlers/activity.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/internal/handlers/activity.go b/api/internal/handlers/activity.go index 2aed8e00..822bf0a1 100644 --- a/api/internal/handlers/activity.go +++ b/api/internal/handlers/activity.go @@ -72,7 +72,8 @@ func (h *ActivityHandler) RegisterRoutes(router *gin.RouterGroup) { sessions := router.Group("/sessions") { sessions.POST("/:id/heartbeat", h.RecordHeartbeat) - sessions.GET("/:id/activity", h.GetActivity) + // NOTE: GET /:id/activity is now handled by SessionActivityHandler + // which provides more comprehensive activity tracking with database persistence } } From 1f7ed24155c153ae2796324b260ee73e0e5c2344 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 17 Nov 2025 00:05:27 +0000 Subject: [PATCH 2/2] fix(api): remove duplicate WebSocket /ws/sessions route registration Removes the duplicate GET /ws/sessions route from the manual WebSocket group since this route is already registered by websocketHandler.RegisterRoutes() which provides comprehensive real-time session updates. The manual WebSocket group now only contains cluster, logs, and enterprise routes, while the websocketHandler handles sessions, notifications, metrics, and alerts. Fixes panic: handlers are already registered for path '/api/v1/ws/sessions' --- api/cmd/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/cmd/main.go b/api/cmd/main.go index c1fb0264..541960cc 100644 --- a/api/cmd/main.go +++ b/api/cmd/main.go @@ -781,13 +781,14 @@ func setupRoutes(router *gin.Engine, h *api.Handler, userHandler *handlers.UserH ws := router.Group("/api/v1/ws") ws.Use(authMiddleware) { - ws.GET("/sessions", h.SessionsWebSocket) + // NOTE: /ws/sessions is now handled by websocketHandler.RegisterRoutes() below ws.GET("/cluster", operatorMiddleware, h.ClusterWebSocket) ws.GET("/logs/:namespace/:pod", operatorMiddleware, h.LogsWebSocket) ws.GET("/enterprise", handlers.HandleEnterpriseWebSocket) // Real-time enterprise features } // Real-time updates via WebSocket - using dedicated handler (all authenticated users) + // Registers: /ws/sessions, /ws/notifications, /ws/metrics, /ws/alerts websocketHandler.RegisterRoutes(router.Group("/api/v1", authMiddleware)) // Webhook endpoints (HMAC signature validation required)