Skip to content

Conversation

@ssncferreira
Copy link
Contributor

@ssncferreira ssncferreira commented Jan 28, 2026

Description

Adds support for forwarding extra headers to the upstream provider when using OpenAI's /responses endpoint. This mirrors the existing functionality in the chat completions endpoint, ensuring Copilot-required headers (like Editor-Version and Copilot-Integration-Id) are properly forwarded.

Changes

  • Added ExtraHeaders iteration in responsesInterceptionBase.newResponsesService() to append configured headers to outgoing requests
  • Added integration test Responses_ForwardsHeadersToUpstream to verify Copilot headers are forwarded and non-Copilot headers are filtered

Follow-up from: #137
Related to: coder/internal#1235

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ssncferreira ssncferreira marked this pull request as ready for review January 28, 2026 09:48
Copy link
Collaborator

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

LGTM

assert.Contains(t, err.Error(), "unmarshal responses request body")
})

t.Run("Responses_ForwardsHeadersToUpstream", func(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: since there's common behaviour I'd expect a common test.
This is fine for now but in general I'd like to support the same tests (using impl-specific fixtures) across both impls where it's simply input/output behaviour being tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, agree! Also thought about it, but wanted to keep the PR simple. I can address this in a follow-up PR 👍

@ssncferreira ssncferreira merged commit d6d1e1e into main Jan 28, 2026
5 checks passed
@ssncferreira ssncferreira deleted the ssncf/feat-responses-extra-headers branch January 28, 2026 10:58
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.

3 participants