Skip to content

fix(openai): Attach response model with streamed Completions API #6213

fix(openai): Attach response model with streamed Completions API

fix(openai): Attach response model with streamed Completions API #6213

Triggered via pull request March 2, 2026 14:44
Status Success
Total duration 3m 35s
Artifacts 2

test-integrations-flags.yml

on: pull_request
Matrix: Flags
All Flags tests passed
4s
All Flags tests passed
Fit to window
Zoom out
Zoom in

Annotations

24 warnings
Flags (3.10, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Flags (3.9, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Flags (3.9, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.9, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.7, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Flags (3.7, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.7, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Access to x.model outside capture_internal_exceptions block can cause runtime errors: sentry_sdk/integrations/openai.py#L615
The new `span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, x.model)` call is placed outside the `capture_internal_exceptions()` block, unlike similar operations in this same function (e.g., accessing `x.choices`). If a streaming chunk lacks the `model` attribute, an `AttributeError` will be raised and propagate to the user's code, breaking the stream iteration. The existing pattern at lines 757-758 (in the Responses API streaming function) places this same operation inside the exception handler.
Flags (3.8, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Flags (3.8, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.8, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.12, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Flags (3.12, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.12, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.14, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Flags (3.14, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.14, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Unprotected attribute access to x.model may raise exception and break iteration: sentry_sdk/integrations/openai.py#L615
The new code `span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, x.model)` directly accesses `x.model` without checking if the attribute exists, and it's placed OUTSIDE the `capture_internal_exceptions()` block. If `x.model` is missing or raises an exception (e.g., with API changes or non-standard responses), this will propagate to user code and break their stream iteration. This is inconsistent with the existing pattern at line 472 which uses `hasattr(response, "model")` before access, and with the responses API handler at line 758 which wraps similar access inside `capture_internal_exceptions()`.
Flags (3.14t, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Flags (3.14t, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.14t, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.13, ubuntu-22.04)
❌ Patch coverage check failed: 0.00% < target 80%
Flags (3.13, ubuntu-22.04)
Failed to upload coverage artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Flags (3.13, ubuntu-22.04)
Failed to upload test artifact: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run

Artifacts

Produced during runtime
Name Size Digest
codecov-coverage-results-webb-openai-add-response-model-completions-test-flags
106 KB
sha256:c6a321d1d8a4a46df21211df6712e7f35486a559e5f8b22a61499c0eca52dfc2
codecov-test-results-webb-openai-add-response-model-completions-test-flags
229 Bytes
sha256:d124226ff686da279bb2b9bfe3eaba9793289dc3077268f88bb47d3e9b3bba9c