We consider an infinite horizon portfolio problem with borrowing constraints, in which an agent receives labor income which adjusts to financial market shocks in a path dependent way. This path-dependency is the novelty of the model, and leads to an infinite dimensional stochastic optimal control problem. We solve the problem completely, and find explicitly the optimal controls in feedback form. This is possible because we are able to find an explicit solution to the associated infinite dimensional Hamilton-Jacobi-Bellman (HJB) equation, even if state constraints are present. To the best of our knowledge, this is the first infinite dimensional generalization of Merton's optimal portfolio problem for which explicit solutions can be found. The explicit solution allows us to study the properties of optimal strategies and discuss their financial implications.Key words: Stochastic functional (delay) differential equations; Optimal control problems in infinite dimension with state constraints; Second order Hamilton-Jacobi-Bellman equations in infinite dimension; Verification theorems and optimal feedback controls; Life-cycle optimal portfolio with labor income; Wages with path dependent dynamics (sticky).AMS classification: 34K50 (Stochastic functional-differential equations), 93E20 (Optimal stochastic control), 49L20 (Dynamic programming method), 35R15 (Partial differential equations on infinite-dimensional spaces), 91G10 (Portfolio theory), 91G80 (Financial applications of other theories (stochastic control, calculus of variations, PDE, SPDE, dynamical systems)) * Biffis