[BUG] After updating to v2.1.220, stale process loops OTel metric exports — same cumulative counters re-sent every 60s, inflating token/cost dashboards; logout/login fixes it

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 1 comment · opened Jul 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Environment

  • Claude Code version: 2.1.220 (issue appeared for multiple users after updating to this version)
  • Platform: macOS
  • Auth: Claude subscription
  • Telemetry: using managed settings
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "****",
    "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE": "cumulative",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORT_INTERVAL": "5000",
    "OTEL_LOG_ASSISTANT_RESPONSES": "0",
    "OTEL_LOG_RAW_API_BODIES": "0",
    "OTEL_LOG_TOOL_CONTENT": "0",
    "OTEL_LOG_TOOL_DETAILS": "0",
    "OTEL_LOG_USER_PROMPTS": "0",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_METRICS_INCLUDE_ACCOUNT_UUID": "true",
    "OTEL_METRICS_INCLUDE_ENTRYPOINT": "true",
    "OTEL_METRICS_INCLUDE_SESSION_ID": "false",
    "OTEL_METRICS_INCLUDE_VERSION": "false",
    "OTEL_METRIC_EXPORT_INTERVAL": "60000",
    "OTEL_RESOURCE_ATTRIBUTES": "****"
  }
  • Metric export interval: default (60s)

Bug description

After our engineers updated to v2.1.220, OTel metrics for some users started looping: a process keeps re-exporting the same claude_code.token.usage and claude_code.cost.usage values every export interval (60s), for hours, with no actual activity in the session.

On dashboards this shows up as impossible sustained usage — e.g. a single user at a constant ~440M cache tokens/h and ~$1.2K/h.

Evidence it's a telemetry loop, not real usage

  • Perfectly flat plateau with dips exactly every ~60s (= OTEL_METRIC_EXPORT_INTERVAL), for hours — no organic step pattern of a real session
  • type=cacheRead and type=input/output both flat; input/output tokens do not grow at all during the plateau
  • Same session.id emitting the whole time
  • The user was not actively working ("wasn't doing much")

<img width="832" height="285" alt="Image" src="https://github.com/user-attachments/assets/59e63e4c-d329-4c32-bc8b-48212de42890" />

Workaround

/logout + /login immediately stops the loop (see the cliff at the right edge of the graph). Killing the stale process presumably has the same effect — this looks like a long-lived process (IDE extension host or background daemon) stuck re-flushing the same counters, possibly after an OAuth token rotation (similar in nature to the heartbeat-retry-loop fixed in 2.1.218).

Expected behavior

A process should not re-export identical counter snapshots indefinitely with no activity; a rejected/stale export should back off and stop, not loop.

Impact

Org-wide usage/cost dashboards become unusable — affected users appear to burn ~100M+ tokens/day. Multiple users affected simultaneously after the 2.1.220 rollout.

What Should Happen?

A process should not re-export identical counter snapshots indefinitely with no activity; a rejected/stale export should back off and stop, not loop.

Error Messages/Logs

Steps to Reproduce

  1. update to v2.1.220
  2. do something
  3. metrics is growing

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

v2.1.220

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗