Skip to content

.

1f6149e
Select commit
Loading
Failed to load commit list.
Draft

ref(openai): Move input handling code into API-specific functions #5687

.
1f6149e
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Mar 18, 2026 in 8m 24s

2 issues

find-bugs: Found 2 issues (1 medium, 1 low)

Medium

Completions API sets incorrect operation name 'responses' instead of 'chat' - `sentry_sdk/integrations/openai.py:393`

In _set_completions_api_input_data, when PII is not enabled or prompts are not included, the span's operation name is incorrectly set to 'responses' instead of 'chat'. This causes incorrect telemetry data, as the completions API operations will be mislabeled as responses API operations.

Also found at:

  • sentry_sdk/integrations/openai.py:489-490

Low

Redundant duplicate conditions create dead code in _set_completions_api_input_data - `sentry_sdk/integrations/openai.py:396-402`

Lines 396-402 check not should_send_default_pii() or not integration.include_prompts again immediately after lines 392-394 already checked the same conditions and returned. The first two conditions in the second check are unreachable dead code. Only messages is None can trigger this block.

Also found at:

  • sentry_sdk/integrations/openai.py:492-499

Duration: 8m 20s · Tokens: 1.7M in / 22.0k out · Cost: $3.73 (+extraction: $0.02, +merge: $0.00, +fix_gate: $0.00)

Annotations

Check warning on line 393 in sentry_sdk/integrations/openai.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

Completions API sets incorrect operation name 'responses' instead of 'chat'

In `_set_completions_api_input_data`, when PII is not enabled or prompts are not included, the span's operation name is incorrectly set to 'responses' instead of 'chat'. This causes incorrect telemetry data, as the completions API operations will be mislabeled as responses API operations.

Check warning on line 490 in sentry_sdk/integrations/openai.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

[DBV-8E9] Completions API sets incorrect operation name 'responses' instead of 'chat' (additional location)

In `_set_completions_api_input_data`, when PII is not enabled or prompts are not included, the span's operation name is incorrectly set to 'responses' instead of 'chat'. This causes incorrect telemetry data, as the completions API operations will be mislabeled as responses API operations.