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: code-review completed Mar 18, 2026 in 5m 33s

2 issues

code-review: Found 2 issues (1 high, 1 medium)

High

Embeddings function incorrectly sets operation name to 'responses' instead of 'embeddings' - `sentry_sdk/integrations/openai.py:489`

In _set_embeddings_input_data, when PII is disabled or prompts are excluded, the operation name is incorrectly set to 'responses' (line 489) instead of 'embeddings'. This was likely a copy-paste error from _set_responses_api_input_data. This will result in incorrect telemetry data being reported for embedding operations.

Also found at:

  • sentry_sdk/integrations/openai.py:393

Medium

Unreachable code due to duplicate early return - `sentry_sdk/integrations/openai.py:396-402`

In _set_completions_api_input_data, the condition at lines 396-400 checks not should_send_default_pii() or not integration.include_prompts or messages is None, but the first two conditions are already checked and return early at lines 392-394. This makes the first two conditions in the second check unreachable. If messages is None was intended to be checked, it should be a separate check for just messages is None.


Duration: 5m 28s · Tokens: 733.0k in / 12.5k out · Cost: $1.60 (+extraction: $0.00, +merge: $0.00, +fix_gate: $0.00)

Annotations

Check failure on line 489 in sentry_sdk/integrations/openai.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: code-review

Embeddings function incorrectly sets operation name to 'responses' instead of 'embeddings'

In `_set_embeddings_input_data`, when PII is disabled or prompts are excluded, the operation name is incorrectly set to 'responses' (line 489) instead of 'embeddings'. This was likely a copy-paste error from `_set_responses_api_input_data`. This will result in incorrect telemetry data being reported for embedding operations.

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

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: code-review

[8XJ-QM9] Embeddings function incorrectly sets operation name to 'responses' instead of 'embeddings' (additional location)

In `_set_embeddings_input_data`, when PII is disabled or prompts are excluded, the operation name is incorrectly set to 'responses' (line 489) instead of 'embeddings'. This was likely a copy-paste error from `_set_responses_api_input_data`. This will result in incorrect telemetry data being reported for embedding operations.

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

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: code-review

Unreachable code due to duplicate early return

In `_set_completions_api_input_data`, the condition at lines 396-400 checks `not should_send_default_pii() or not integration.include_prompts or messages is None`, but the first two conditions are already checked and return early at lines 392-394. This makes the first two conditions in the second check unreachable. If `messages is None` was intended to be checked, it should be a separate check for just `messages is None`.