Preflight Checklist
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
- Start an OTLP collector on port 4318 (any receiver that accepts
/v1/logs)
- Run interactive session:
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.
- Run headless session with identical env vars:
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.
Preflight Checklist
What's Wrong?
When running Claude Code in headless mode (
claude -p), theclaude_code.tool_decisionOTLP log event is never emitted. Onlyclaude_code.tool_resultis emitted. In interactive mode, both events are emitted as documented.What Should Happen?
Per the monitoring docs,
claude_code.tool_decisionshould be emitted when a tool permission decision is made, regardless of execution mode.Error Messages/Logs
Steps to Reproduce
Reproduction steps
/v1/logs)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'"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 emitstool_result:{ "claude_code.tool_result": 1, "claude_code.api_request": 3 }claude_code.tool_decisionis 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
http/jsonImpact
Low —
tool_resultis a superset oftool_decisiondata (includesdecision+sourcefields plusduration_ms,success,tool_parameters). Monitoring pipelines that only consumetool_resultare unaffected. Pipelines that depend ontool_decisionfor pre-execution permission auditing will miss events from headless sessions.