
Claude Code 2.1.337: Fail-Closed CI & SDK Runs
In this episode, we cover how claude -p and Agent SDK runs now exit with code 1 when auto mode cannot check an action, plus how to use the CLAUDE_CODE_DISABLE_UNCHECKED_ACTIONS_ERROR escape hatch. We also highlight new MCP hook fields, org token guards, and plugin loading improvements.
Chapter 1
Headless Auto Mode Fail Closed Behavior in 2.1.337
Lachlan Reed
If you run Claude Code in your CI pipelines, December fourth's release might have just broken your build on purpose. This is the Claude Code Changelog, brought to you by Jellypod AI, and we're looking at version two point one point three three seven.
James Turner
Yeah, we covered the plugin and context cost updates from this release last time, but there's a huge behavioral change in headless mode and the Agent SDK that deserves its own spotlight. Specifically, claude dash p and SDK runs now end with is_error set to true and exit code one whenever auto mode cannot check an action.
Lachlan Reed
Fail closed, finally. For anyone who's ever had a silent pass in CI when a safety check timed out, this is a big deal. Previously, if auto mode couldn't reach its safety check, your automated run could just keep going or exit clean, masking the fact that an action went unchecked.
James Turner
Right, and in a cron job or a deployment pipeline, silent success is the worst kind of failure. Now, if auto mode can't verify an action, the process exits with code one and sets is_error to true. Your pipeline fails loudly, which is what you want when security checks are involved.
Lachlan Reed
You don't need any extra flags to turn this on. Just upgrading to two point one point three three seven enables it by default for claude dash p and SDK workflows. Now, if you have a pipeline that intentionally needs to keep running even when an action goes unchecked, there is an escape hatch.
James Turner
You can export CLAUDE_CODE_DISABLE_UNCHECKED_ACTIONS_ERROR equals one in your runner or shell environment. That opts you right back out of the exit code one behavior. Though, before you just slap that variable into your CI config, there's a caveat you really need to watch out for.
Lachlan Reed
Don't just mute the alarm, yeah? If you're running behind an LLM gateway, a corporate proxy, or a custom cloud provider, you might start seeing new exit code one failures after updating because auto mode's safety check can't get through.
James Turner
And Anthropic actually paired this with a really helpful error improvement in two point one point three three seven. On gateways, cloud providers, and self hosted runners, when auto mode's safety check is refused or blocked, Claude or the session error now explicitly tells you that it was blocked and identifies who can fix it. So inspect that error output first before you reach for the opt out variable.
Lachlan Reed
That's a massive time saver compared to guessing whether it's your network or the model. Now, there are a few smaller quality of life and security updates in two point one point three three seven worth noting before you wrap up your upgrade.
James Turner
First up, hook authors get a new built_in field in MCP server details. Claude Desktop sets this on its own internal servers, some of which run commands or control the computer, so your hooks can now cleanly distinguish built in servers from external ones.
Lachlan Reed
Also on the MCP front, allowedMcpServers no longer blocks Claude Code's own Artifacts server. If you still want to block Artifacts, deniedMcpServers and your organization level Artifacts settings will still do the job.
James Turner
There's also a nice org token guard. Using the left arrow or slash background now refuses a session that's using CLAUDE_CODE_OAUTH_TOKEN from your shell if your saved login belongs to a different organization. No more accidentally cross pollinating org sessions.
Lachlan Reed
And two quick workflow wins to finish off. Plugins installed via claude plugin install in another terminal, or by a SessionStart hook, can now load into an open session without you running slash reload plugins. Plus, most warnings, errors, and notices in the conversation now start with a four dot mark, so you can tell them apart from Claude's actual replies at a glance. Go check your CI logs.