fix: log only on system api key failures (#13968)

Removes sentry flooding of unnecessary rubyllm logs of wrong API key.
Logs only system api key error since it would be P0.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Aakash Bakhle
2026-04-09 18:04:52 +05:30
committed by GitHub
parent f1da7b8afa
commit f13f3ba446
8 changed files with 109 additions and 20 deletions

View File

@@ -27,9 +27,9 @@ class Captain::Llm::TranslateQueryService < Captain::BaseTaskService
end
# Translation is an internal operation, not customer-initiated.
# Prefer the system key; fall back to the account's hook key for self-hosted setups without one.
def api_key
@api_key ||= system_api_key.presence || openai_hook&.settings&.dig('api_key')
# It should always use the installation key.
def llm_credential
@llm_credential ||= system_llm_credential
end
def query_in_target_language?(query)

View File

@@ -56,12 +56,10 @@ class Captain::ConversationCompletionService < Captain::BaseTaskService
{ complete: false, reason: reason }
end
# Prefer the system API key over the account's OpenAI hook key.
# This is an internal operational evaluation, not a customer-triggered feature,
# so it should not consume the customer's OpenAI credits on hosted platforms.
# Falls back to the account hook for self-hosted deployments without a system key.
def api_key
@api_key ||= system_api_key.presence || openai_hook&.settings&.dig('api_key')
# so it should always use the installation key.
def llm_credential
@llm_credential ||= system_llm_credential
end
def event_name