v2.1.78 regression: headless -p mode interrupted by tengu circuit breaker after 9-16 turns

Resolved 💬 3 comments Opened Mar 18, 2026 by JacekPietrasSpotOn Closed Mar 18, 2026

Bug Description

Claude Code v2.1.78 introduced a regression where headless (-p) mode execution is interrupted after 9-16 turns with error_during_execution. Version 2.1.77 works correctly.

Environment

  • Claude Code version: 2.1.78 (broken), 2.1.77 (works)
  • Node.js: 18
  • OS: Ubuntu (GitHub Actions runner)
  • API Provider: AWS Bedrock (CLAUDE_CODE_USE_BEDROCK=1)
  • Models: us.anthropic.claude-sonnet-4-5-20250929-v1:0 (main), us.anthropic.claude-haiku-4-5-20251001-v1:0 (subagent)

Reproduction

Run Claude Code in headless mode in CI (GitHub Actions):

claude -p "$PROMPT" --dangerously-skip-permissions --verbose --output-format stream-json

The prompt instructs Claude to scan a codebase, make improvements, run tests, and create output files — a task that typically takes 30-40+ turns.

Observed Behavior

After 9-16 successful turns (tool calls completing normally), a [Request interrupted by user] text message is injected into the conversation. This causes the internal validation function (dVB) to fail because it expects the last user message to contain only tool_result blocks, not text. The result is error_during_execution with an empty errors array.

Stream-JSON event sequence (truncated)

system/init → assistant → tool_use → tool_result → ... (9-16 turns) → user: "[Request interrupted by user]" → result: error_during_execution

Debug log evidence

The --debug-file output shows this warning before the interruption:

[WARN] auto mode disabled: tengu_auto_mode_config.enabled === "disabled" (circuit breaker)

After this warning, execution jumps from "Dynamic tool loading" straight to "LSP server manager shut down" with no API request initiated and no error logged in between.

Version Timeline

| Date | Version | Result |
|------|---------|--------|
| March 16, 22:16 UTC | 2.1.77 released | — |
| March 17, ~09:00 UTC | CI run (got 2.1.77) | SUCCESS (42 turns, 3 min) |
| March 17, 21:04 UTC | 2.1.78 released | — |
| March 18, ~09:00 UTC | CI run (got 2.1.78) | FAILURE (9-16 turns, then interrupted) |
| March 18 (manual) | Pinned to 2.1.77 | SUCCESS (42 turns, 3 min) |

What We Ruled Out

  • Not a permissions issue: Same failure with --allowedTools and --dangerously-skip-permissions
  • Not a turn limit: Same failure with --max-turns 200 (default is 100+)
  • Not a stdin issue: Same failure with < /dev/null
  • Not an API connectivity issue: Claude successfully makes 9-16 API calls before being interrupted
  • Not environment-specific: Same GitHub Actions runner, same AWS credentials, same prompt — only variable is Claude Code version

Expected Behavior

Headless -p mode should not be affected by the tengu_auto_mode_config circuit breaker. In non-interactive mode there is no user to "interrupt" the request, so the abort controller should not fire.

Workaround

Pin to version 2.1.77:

npm install -g @anthropic-ai/claude-code@2.1.77

Related Issues

  • #35738 (spontaneous interrupts)
  • #35569 (tengu_ccr_bridge)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗