What
During shutdown, Claude Code already waited for an OAuth token refresh to finish before exiting. OAuth is the sign-in system that keeps Claude Code logged in, and a refresh renews the login token. That wait used to be a fixed length. It can now be shortened.
- On a normal exit (exit code 0),
waitForHeldOAuthRefreshnow takes its wait length from a calculation instead of a fixed value, and widens the shutdown safety timer by the same amount. - It installs
shortenOAuthRefreshWait. When shutdown is requested again while Claude Code is already shutting down, a further internal step runs and thenshortenOAuthRefreshWaitis called, which cuts the wait short. - Shutdown now also checks an extra condition alongside
waitForHeldOAuthRefresh. When that condition holds, the wait for the refresh is skipped entirely.
Why
If a token refresh is slow, pressing Ctrl-C a second time or asking to exit again should no longer leave Claude Code hanging while it waits for the refresh.