Commit 63abf6b
authored
fix(openai-adapters): extend auth header override to support x-api-key (#8779)
* fix(openai-adapters): extend auth header override to support x-api-key
Extends the fix from PR #8684 to handle x-api-key header in addition to
Authorization header.
Background:
- Continue sends duplicate auth headers where the first is malformed
- PR #8684 fixed this for Authorization header
- Same issue affects x-api-key header used by some OpenAI-compatible APIs
Changes:
- Rename function to letRequestOptionsOverrideAuthHeaders (more generic)
- Check for both Authorization AND x-api-key in requestOptions.headers
- Remove default headers if custom ones are provided
- Handles Headers object, array, and plain object formats
Impact:
- Fixes authentication with APIs that use x-api-key header
- Enables use of MITRE AIP and similar enterprise endpoints
- Maintains backward compatibility with existing configs
Related: #7047 (duplicate headers bug)
Extends: #8684 (Authorization header fix)
Tested-with: MITRE AIP endpoints using x-api-key authentication
Authored by: Aaron Lippold <lippold@gmail.com>
* test(openai-adapters): add tests for auth header override fix
Add comprehensive tests for the customFetch auth header override functionality:
- Test Authorization header override
- Test x-api-key header override
- Test Headers object handling
- Test array of tuples handling
- Test case-insensitive matching
- Test no override when requestOptions empty
All tests pass.
Related: #7047, #8684
Authored by: Aaron Lippold <lippold@gmail.com>
* test: update to structural tests per reviewer feedback
Changed from integration tests to structural/smoke tests that verify
the customFetch function behavior without complex fetch stack mocking.
Tests now verify:
- Function exports and structure
- Returns callable functions
- Handles all requestOptions variations
- Doesn't throw on edge cases
- Case-insensitive header handling
Per reviewer feedback, this avoids false confidence from incomplete
integration tests while still validating the function works correctly.
Related: Reviewer feedback on PR #8779
* ci: add GitHub Actions to publish MITRE CLI package
Automates building and publishing the patched Continue CLI:
- Builds on push to mitre branch
- Publishes to GitHub Package Registry as @mitre/continue-cli
- Creates release artifacts
- Uploads distribution tarball
Team can install via:
npm install -g @mitre/continue-cli --registry=https://npm.pkg.github.com
Or download tarball from releases.
Authored by: Aaron Lippold <lippold@gmail.com>
* chore: remove MITRE-specific workflow from upstream PR
This workflow is for MITRE fork only, not needed in upstream.
Authored by: Aaron Lippold <lippold@gmail.com>
* fix(openai-adapters): correct Responses API model detection regex
The RESPONSES_MODEL_REGEX was too broad, matching any model starting
with "o" (e.g., "openai/gpt-oss-120b"). This caused Continue to
incorrectly use the Responses API for non-reasoning models.
Changed regex from /^(?:gpt-5|gpt-5-codex|o)/i
to /^(?:gpt-5|gpt-5-codex|o[0-9])/i to only match:
- gpt-5, gpt-5-codex (GPT-5 series)
- o1, o3, o4, etc. (OpenAI O-series reasoning models)
This prevents false positives for model names like:
- openai/gpt-oss-120b (Cloudflare Workers AI model)
- ollama/... (Ollama models)
- Any other model with provider prefix starting with "o"
Tested with openai/gpt-oss-120b - now correctly uses
/v1/chat/completions instead of /v1/responses.
Authored by: Aaron Lippold <lippold@gmail.com>1 parent 2c539dd commit 63abf6b
File tree
3 files changed
+127
-21
lines changed- packages/openai-adapters/src
- apis
- test
3 files changed
+127
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
Lines changed: 89 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 162 | + | |
| 163 | + | |
171 | 164 | | |
172 | 165 | | |
173 | 166 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
184 | 201 | | |
185 | 202 | | |
186 | 203 | | |
187 | 204 | | |
188 | 205 | | |
189 | | - | |
| 206 | + | |
190 | 207 | | |
191 | 208 | | |
192 | 209 | | |
| |||
0 commit comments