From 138840a23fae24ab67ff1a9ceba800dadb9772e8 Mon Sep 17 00:00:00 2001 From: Aakash Bakhle <48802744+aakashb95@users.noreply.github.com> Date: Tue, 17 Feb 2026 15:40:50 +0530 Subject: [PATCH] fix: typo in metadata key in captain v2 (#13558) # Pull Request Template ## Description ## Type of change typo fix ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published in downstream modules --- .../services/captain/assistant/agent_runner_service.rb | 4 ++-- .../captain/assistant/agent_runner_service_spec.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/enterprise/app/services/captain/assistant/agent_runner_service.rb b/enterprise/app/services/captain/assistant/agent_runner_service.rb index a40e096e6..c832da93e 100644 --- a/enterprise/app/services/captain/assistant/agent_runner_service.rb +++ b/enterprise/app/services/captain/assistant/agent_runner_service.rb @@ -189,8 +189,8 @@ class Captain::Assistant::AgentRunnerService root_span = context_wrapper&.context&.dig(:__otel_tracing, :root_span) return unless root_span - credits_used = !context_wrapper.context[:captain_v2_handoff_tool_called] - root_span.set_attribute(format(ATTR_LANGFUSE_METADATA, 'credits_used'), credits_used) + credit_used = !context_wrapper.context[:captain_v2_handoff_tool_called] + root_span.set_attribute(format(ATTR_LANGFUSE_METADATA, 'credit_used'), credit_used.to_s) end def add_agent_thinking_callback(runner) diff --git a/spec/enterprise/services/captain/assistant/agent_runner_service_spec.rb b/spec/enterprise/services/captain/assistant/agent_runner_service_spec.rb index 04fa0f967..bbf712622 100644 --- a/spec/enterprise/services/captain/assistant/agent_runner_service_spec.rb +++ b/spec/enterprise/services/captain/assistant/agent_runner_service_spec.rb @@ -308,7 +308,7 @@ RSpec.describe Captain::Assistant::AgentRunnerService do end describe '#add_usage_metadata_callback' do - it 'sets credits_used=false when handoff tool is used' do + it 'sets credit_used=false when handoff tool is used' do service = described_class.new(assistant: assistant, conversation: conversation) runner = instance_double(Agents::AgentRunner) tool_complete_callback = nil @@ -333,11 +333,11 @@ RSpec.describe Captain::Assistant::AgentRunnerService do tool_complete_callback.call(Captain::Tools::HandoffTool.new(assistant).name, 'ok', context_wrapper) - expect(root_span).to receive(:set_attribute).with('langfuse.trace.metadata.credits_used', false) + expect(root_span).to receive(:set_attribute).with('langfuse.trace.metadata.credit_used', 'false') run_complete_callback.call('assistant', nil, context_wrapper) end - it 'sets credits_used=true when handoff tool is not used' do + it 'sets credit_used=true when handoff tool is not used' do service = described_class.new(assistant: assistant, conversation: conversation) runner = instance_double(Agents::AgentRunner) run_complete_callback = nil @@ -356,7 +356,7 @@ RSpec.describe Captain::Assistant::AgentRunnerService do service.send(:add_usage_metadata_callback, runner) - expect(root_span).to receive(:set_attribute).with('langfuse.trace.metadata.credits_used', true) + expect(root_span).to receive(:set_attribute).with('langfuse.trace.metadata.credit_used', 'true') run_complete_callback.call('assistant', nil, context_wrapper) end end