Skip to content

fix(core): backfill OpenAI responses model in spans#19810

Open
meronogbai wants to merge 2 commits intogetsentry:developfrom
meronogbai:fix/openai-responses-model-backfill
Open

fix(core): backfill OpenAI responses model in spans#19810
meronogbai wants to merge 2 commits intogetsentry:developfrom
meronogbai:fix/openai-responses-model-backfill

Conversation

@meronogbai
Copy link

@meronogbai meronogbai commented Mar 14, 2026

Summary

OpenAI Responses API calls can omit model in the request payload when using stored prompts. In that case, Sentry currently records gen_ai.request.model = "unknown" even though the final OpenAI response includes the actual model.

This change keeps the existing request-time fallback behavior, but overwrites the request model from response.model once the Responses API response arrives. It also updates the span name from chat unknown to chat .

This is now handled for both:

  • non-streaming Responses API calls
  • streaming Responses API calls

Agents dashboard screenshots

In production where this change isn't applied:

image

In development where this change was applied manually:

image

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).
  • Link an issue if there is one related to your pull request. If no issue is linked, one will be auto-generated and linked.

Closes #issue_link_here

@meronogbai meronogbai marked this pull request as ready for review March 14, 2026 22:44
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@meronogbai meronogbai force-pushed the fix/openai-responses-model-backfill branch from 57deae1 to 30ee31b Compare March 14, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant