This paper analyzes the optimal response of the social insurance system to a rise in labor market risk. To this end, we develop a tractable macroeconomic model with risk-free physical capital, risky human capital (labor market risk) and unobservable effort choice affecting the distribution of human capital shocks (moral hazard). We show that constrained optimal allocations are simple in the sense that they can be found by solving a static social planner problem. We further show that constrained optimal allocations are the equilibrium allocations of a market economy in which the government uses taxes and transfers that are linear in household wealth/income. We use the tractability result to show that an increase in labor market (human capital) risk increases social welfare if the government adjusts the tax-and-transfer system optimally. Finally, we provide a quantitative analysis of the secular rise in job displacement risk in the US and find that the welfare cost of not adjusting the social insurance system optimally can be substantial.