Skip to content

fix(shared): support extra header aliases in model init config#2287

Merged
quanru merged 6 commits intomainfrom
codex/fix-model-extra-headers
Apr 7, 2026
Merged

fix(shared): support extra header aliases in model init config#2287
quanru merged 6 commits intomainfrom
codex/fix-model-extra-headers

Conversation

@quanru
Copy link
Copy Markdown
Collaborator

@quanru quanru commented Apr 4, 2026

Background

The Python OpenAI SDK uses extra_headers to attach custom HTTP headers, while the Node.js OpenAI SDK uses defaultHeaders. Many model providers show Python examples in their docs, so users naturally copy extra_headers into MIDSCENE_MODEL_INIT_CONFIG_JSON. Since Midscene uses the Node.js SDK, extra_headers is silently ignored — the headers are never sent and auth fails without any error.

What this PR does

  • Adds a validateOpenaiExtraConfig step that throws a clear error when extra_headers or extraHeaders is detected, telling the user to use defaultHeaders instead.
  • No silent normalization — fail fast with actionable guidance.

Validation

  • pnpm run lint
  • npx nx test @midscene/shared

Closes #2212

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 4, 2026

Deploying midscene with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4825a4f
Status: ✅  Deploy successful!
Preview URL: https://babd94fe.midscene.pages.dev
Branch Preview URL: https://codex-fix-model-extra-header.midscene.pages.dev

View logs

@quanru quanru force-pushed the codex/fix-model-extra-headers branch from 9992fac to 4c4f0c5 Compare April 7, 2026 07:40
@quanru quanru force-pushed the codex/fix-model-extra-headers branch from 4825a4f to 6f0c9b8 Compare April 7, 2026 08:29
@quanru quanru merged commit f99a297 into main Apr 7, 2026
4 of 7 checks passed
@quanru quanru deleted the codex/fix-model-extra-headers branch April 7, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to set extra_headers?

2 participants