{"version":"2.1.163","anchor":"oauth-401-recovery-for-remote-sessions","canonical_anchor":"oauth-401-recovery-for-remote-sessions","heading":"OAuth 401 Recovery for Remote Sessions","tier":null,"area":null,"scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.163\/e\/oauth-401-recovery-for-remote-sessions","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.163","markdown":"### OAuth 401 Recovery for Remote Sessions\n\n**What**\n\nRemote sessions now wait for a rotated OAuth token after receiving a 401 error, instead of immediately propagating the failure.\n\n**Details**\n\n- Wait time is controlled by `CLAUDE_CODE_OAUTH_401_WAIT_MS` (default: 60,000 ms = 60 seconds for remote sessions, 0 for local sessions).\n- If a valid, non-failed token appears within the timeout window, the request is retried automatically.\n- For remote child sessions (workers), `CLAUDE_CODE_AUTH_FAIL_EXIT_MS` (default: 600,000 ms = 10 minutes) controls how long to tolerate unrecovered 401s before exiting with a message to the runner to recycle the session with fresh credentials.\n- The \"failed access token\" (the specific token that got the 401) is tracked so a rotation to an identical token value is not treated as a recovery.\n\n**Evidence**\n\nRecovery function (search for `\"OAuth 401 recovery: waiting up to\"` and `\"OAuth 401 unrecovered past CLAUDE_CODE_AUTH_FAIL_EXIT_MS\"`)"}