diff --git a/backend/internal/server/routes/gateway.go b/backend/internal/server/routes/gateway.go index c12bddcd0..cbf455b45 100644 --- a/backend/internal/server/routes/gateway.go +++ b/backend/internal/server/routes/gateway.go @@ -106,7 +106,10 @@ func RegisterGatewayRoutes( }) } videoStatusHandler := func(c *gin.Context) { - if getGroupPlatform(c) == service.PlatformGrok { + // Video status requests do not carry a model, so composite groups cannot + // be resolved by compositeTargetPlatformMiddleware. Route them through + // the Grok handler and let scheduler/account selection enforce capacity. + if getGroupPlatform(c) == service.PlatformGrok || getGroupPlatform(c) == service.PlatformComposite { h.OpenAIGateway.GrokVideoStatus(c) return } diff --git a/backend/internal/server/routes/gateway_test.go b/backend/internal/server/routes/gateway_test.go index 36c5d1158..e37a446be 100644 --- a/backend/internal/server/routes/gateway_test.go +++ b/backend/internal/server/routes/gateway_test.go @@ -177,6 +177,22 @@ func TestGatewayRoutesGrokImagesAndVideosPathsAreRegistered(t *testing.T) { } } +func TestGatewayRoutesCompositeVideoStatusUsesGrokHandler(t *testing.T) { + router := newGatewayRoutesTestRouter(service.PlatformComposite) + + for _, path := range []string{ + "/v1/videos/request-123", + "/videos/request-123", + } { + req := httptest.NewRequest(http.MethodGet, path, nil) + w := httptest.NewRecorder() + + router.ServeHTTP(w, req) + require.NotEqual(t, http.StatusNotFound, w.Code, "path=%s should hit Grok video status handler", path) + require.NotContains(t, w.Body.String(), "not supported for this platform") + } +} + func TestGatewayRoutesNonGrokVideosAreRejectedAtPlatformGate(t *testing.T) { router := newGatewayRoutesTestRouter(service.PlatformOpenAI)