[BUG] Auto mode appears to make billed requests that emit no telemetry

Status Open
Reported on v2.1.229
Maintainer reply None cached
Activity 2 comments · opened Aug 13, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code's OpenTelemetry export was compared against the usage the API reports as
billed. In the sessions measured, about a third of the requests are missing from the
export.

In auto permission mode the client appears to send an extra request before a tool
runs — a short, non-streamed request that reads like a safety check on the tool call.
Those requests are billed, but they cannot be found in the telemetry: no
claude_code.api_request event and no claude_code.token.usage point.

The purpose of the request is a guess. What does seem clear is that the requests
exist, they are billed, and they are not reported.

Totals across three trials of each mode:

| mode | requests billed | requests reported | tokens billed | tokens reported |
|---|---|---|---|---|
| auto | 15 | 9 | 685,434 | 418,752 |
| bypassPermissions | 9 | 9 | 416,751 | 416,751 |

Every trial gave the same result. Both modes did the same work and returned the same
answer. Both reported every streamed request, and both exported the same metrics and
event types, so the export path itself appears to work.

The difference is 266,682 tokens, which matches the tokens of the 6 requests auto
made and bypassPermissions did not.

What Should Happen?

Every billed request is accounted for in the export. If these requests are expected,
could they emit the same event and metric as the others?

Steps to Reproduce

  1. Enable telemetry with the configuration below, pointed at a local OTLP receiver.
  2. Put a local HTTP proxy in front of the API using ANTHROPIC_BASE_URL, recording

every request and the usage returned with it.

  1. Run this prompt with --permission-mode auto:

``
claude -p "Use the Write tool to create the file /tmp/probe.txt containing only the word alpha. Then use the Bash tool to run \
sed -n 1p /tmp/probe.txt\. Then reply with only the word you saw." --model sonnet --permission-mode auto
``

Simpler calls (echo, ls, Read) are approved without any extra request, so
they show nothing. A path outside the working directory is always judged.

  1. Run the same prompt again with --permission-mode bypassPermissions.
  2. Compare the requests recorded at the proxy against the claude_code.api_request

events and claude_code.token.usage points received by the collector. In the
auto run two requests are billed that appear in neither.

Three trials of each mode were run, alternating them. The result was the same every
time.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Claude Code Version

2.1.229 (Claude Code). Also observed on 2.1.228.

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Non-interactive (claude -p)

Additional Information

Telemetry configuration, endpoint and headers omitted:

{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "CLAUDE_CODE_ENHANCED_TELEMETRY_BETA": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf"
  }
}

The two-session comparison used the same exporters pointed at a local receiver over
http/json.

View original on GitHub ↗

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