The Claude Code Changelog
All Episodes
Preventing Silent Auth Expirations in Claude Code 2.1.318

Preventing Silent Auth Expirations in Claude Code 2.1.318

0:00|0:00

Learn how Claude Code 2.1.318 prevents unattended CI and headless runs from failing silently due to expired logins. We cover new expiration fields in claude auth status, warnings in claude -p, and switching to setup-token for permanent machine credentials.


Chapter 1

Claude Code 2.1.318 Ends Silent Login Expiry

Lachlan Reed

Picture this. It's Monday morning, you grab a coffee, and you find out your nightly test fixer has been signed out since Friday. Nobody got an error, nothing paged anyone. This is The Claude Code Changelog, brought to you by Jellypod AI, and today's release is aimed squarely at that problem. Claude Code 2.1.318 shipped on November 4, 2026, and the headline is that your login no longer expires in silence.

James Turner

And this connects to what we covered in 2.1.317, with the headless Agent SDK hooks and keeping unattended runs resilient. That was about jobs surviving failures. This one targets another big failure mode in CI: a stored claude.ai login reaching its fixed time limit. Here's what changed. First, `claude auth status` now includes a field called `loginExpiresAt`, the end date of your stored claude.ai sign-in. Second, `claude -p` with `--output-format json` now returns `credential_expires_at` in its results. Third, starting ten days before a stored sign-in ends, `claude -p` in text mode prints a one line warning to stderr.

Lachlan Reed

And there's a related fix. Before, when a stored login hit its time limit, sign-in just failed without explaining itself. Now it says it. Interactive sessions show, quote, "Login reached its time limit, please run /login." In `claude -p`, the message says the login reached its time limit and cannot be renewed, and it names two ways out: `claude auth login`, or `claude setup-token` with `CLAUDE_CODE_OAUTH_TOKEN` set for unattended jobs. The important bit is "cannot be renewed." Claude Code refreshes your login in the background while you work, but that refresh doesn't push the end date back. Only a new sign-in does.

James Turner

So here's how you use it. Simplest is a health check. `claude auth status` prints JSON, and it exits 0 when you're logged in and 1 when you're not. Add `--text` if you want it human readable. In a scheduled job, parse `loginExpiresAt`, compare it to today, and alert your team when it's inside, say, two weeks. For headless runs, read `credential_expires_at` from the JSON output of your `claude -p` call and push it to whatever monitoring you already have. And for permanent CI, the real fix is a machine credential. Run `claude setup-token` once, store the result as a secret, and export it as `CLAUDE_CODE_OAUTH_TOKEN` in the runner. Then the job doesn't depend on a browser login that will eventually run out.

Lachlan Reed

A few caveats. That warning goes to stderr, so if you've got a brittle script that fails on any non empty stderr, the ten day warning could break it, ironically. Fix that before you upgrade. Also, `loginExpiresAt` only covers stored claude.ai logins. If you authenticate with `ANTHROPIC_API_KEY` or a cloud provider like Bedrock or Vertex, it comes back null. And one thing the docs don't state is how long a claude.ai login actually lasts, so check your own date rather than guessing.

James Turner

Now the smaller stuff. Mods get an `effort` option on `$.model.fork`, so a quick side job can run at `low` whatever the session's effort is. Started from an IDE terminal, Claude Code no longer installs or updates the IDE extension, so use `/ide` from an outside terminal or your editor's extensions view. A long list of fixes covers network home directories, where `~/.claude.json`, settings files, and the stored login were less likely to be wiped or replaced by an older copy. And `--continue` no longer loses earlier conversation after a malformed tool call runs out of retries. That was a regression from 2.1.314.

Lachlan Reed

So the takeaway: run `claude auth status` on your CI box today, note the date, and put a reminder ten days before it. Or just set up `setup-token` and be done. Either way, no more surprise Mondays.