[BUG] `claude_code.tool_decision` OTLP event not emitted in headless (`-p`) mode

Resolved 💬 1 comment Opened Feb 16, 2026 by mrmaxsteel Closed Feb 16, 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?

When running Claude Code in headless mode (claude -p), the claude_code.tool_decision OTLP log event is never emitted. Only claude_code.tool_result is emitted. In interactive mode, both events are emitted as documented.

What Should Happen?

Per the monitoring docs, claude_code.tool_decision should be emitted when a tool permission decision is made, regardless of execution mode.

Error Messages/Logs

Steps to Reproduce

Reproduction steps

  1. Start an OTLP collector on port 4318 (any receiver that accepts /v1/logs)
  2. Run interactive session:

``bash
CLAUDE_CODE_ENABLE_TELEMETRY=1 OTEL_METRICS_EXPORTER=otlp OTEL_LOGS_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/json OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \
claude
``
Trigger a tool call (e.g. "Search the web for 'hello'"). Observe OTLP events received.

  1. Run headless session with identical env vars:

``bash
CLAUDE_CODE_ENABLE_TELEMETRY=1 OTEL_METRICS_EXPORTER=otlp OTEL_LOGS_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/json OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \
claude -p "Search the web for 'hello'"
``
Observe OTLP events received.

Observed results

Interactive mode emits both events:

{
    "claude_code.tool_decision": 1,
    "claude_code.tool_result": 2,
    "claude_code.api_request": 7
}

Headless (-p) mode only emits tool_result:

{
    "claude_code.tool_result": 1,
    "claude_code.api_request": 3
}

claude_code.tool_decision is completely absent from headless output.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v2.1.42

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Environment

  • Claude Code v2.1.42
  • macOS Darwin 25.2.0
  • OTLP protocol: http/json

Impact

Low — tool_result is a superset of tool_decision data (includes decision + source fields plus duration_ms, success, tool_parameters). Monitoring pipelines that only consume tool_result are unaffected. Pipelines that depend on tool_decision for pre-execution permission auditing will miss events from headless sessions.

View original on GitHub ↗

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