From 1e8fc8fe8b18cb501f1d382f9191ef8dade45666 Mon Sep 17 00:00:00 2001 From: AnnatarHe Date: Fri, 26 Dec 2025 00:33:13 +0800 Subject: [PATCH] fix(daemon): handle bool values sent as strings in OTEL processor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude Code sends some boolean values as strings. Added getBoolFromValue helper function to properly parse both bool and string representations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- daemon/ccotel_processor.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/daemon/ccotel_processor.go b/daemon/ccotel_processor.go index d44300c..308f2b0 100644 --- a/daemon/ccotel_processor.go +++ b/daemon/ccotel_processor.go @@ -408,9 +408,15 @@ func (p *CCOtelProcessor) parseLogRecord(lr *logsv1.LogRecord, resourceAttrs *mo case "tool_name": event.ToolName = value.GetStringValue() case "success": - event.Success = value.GetBoolValue() + event.Success = getBoolFromValue(value) case "decision": event.Decision = value.GetStringValue() + // case "decision_source": + // event.DecisionSource = value.GetStringValue() + // case "decision_type": + // event.DecisionType = value.GetStringValue() + // case "tool_result_size_bytes": + // event.ToolResultSizeBytes = getIntFromValue(value) case "source": event.Source = value.GetStringValue() case "error": @@ -530,6 +536,20 @@ func getIntFromValue(value *commonv1.AnyValue) int { return 0 } +func getBoolFromValue(value *commonv1.AnyValue) bool { + // First try to get as bool + if boolVal := value.GetBoolValue(); boolVal { + return boolVal + } + // Try to parse from string (Claude Code sends some values as strings) + if strVal := value.GetStringValue(); strVal != "" { + if parsed, err := strconv.ParseBool(strVal); err == nil { + return parsed + } + } + return false +} + // getFloatFromValue extracts a float64 from an OTEL value, handling both double and string formats func getFloatFromValue(value *commonv1.AnyValue) float64 { // First try to get as double