Skip to content

[Claimed #3422] fix(extension): keep empty response header values on HTTP/2 - #3437

Merged
shrey150 merged 2 commits into
mainfrom
external-contributor-pr-3422
Nov 10, 2026
Merged

shrey150 merged 2 commits into
mainfrom
external-contributor-pr-3422

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Mirrored from external contributor PR #3422 after approval by @shrey150.

Original author: @aryansahai22
Original PR: #3422
Approved source head SHA: 3bfc4a715f9798e2ee44ded4a9d01e2d354d88a5

@aryansahai22, please continue any follow-up discussion on this mirrored PR. When the external PR gets new commits, this same internal PR will be marked stale until the latest external commit is approved and refreshed here.

Original description

why

Fixes #3421.

Over HTTP/2, a response header sent with an empty value disappears from response.headersArray(). headerValue() then returns null and headerValues() returns [], even though headers() and allHeaders() report the header as "" on the same response. Over HTTP/1.1 all of them agree.

what changed

  • splitHeaderValues() in packages/extension/understudy/response.ts no longer filters out empty values. That was the only place the value was lost: headersArray() falls back to the header map when Chrome sends no raw header text, which is the case for HTTP/2.
  • Two regression tests in packages/extension/tests/response-rpc.test.ts:
    • one drives response.headers_array through the RPC router for a header map with an empty value, before and after extra info arrives and next to a duplicated header;
    • one asserts the header-map path and the raw-text path report the same entries.
  • Patch changeset for the extension and the TypeScript and Python SDKs, as other extension-only fixes use.

No protocol or SDK code changes. Both SDKs already return "" for a present empty value once the runtime includes it in response.headers_array.

test plan

  • vitest run packages/extension/tests packages/extension/understudy: 73 files, 1190 tests pass. Both new tests fail without the source change.
  • tsc --noEmit -p packages/extension/tsconfig.json, plus oxfmt --check and oxlint on the changed files: clean.
  • Manual check against Chrome 156 with the node:http2 fixture from the issue. Before: headerValue('x-empty') is null and the header is missing from headersArray(). After: "" and present, matching HTTP/1.1.
  • packages/sdk-ts/tests/integration/pageGotoResponse.test.ts still passes against the rebuilt extension.
  • Not run: the Python and Go checks, since I don't have uv or go installed. The change touches no generated code and no protocol schema.

One note for whoever runs just check: scripts/release/check-changesets.ts currently fails on main because of agent-discoverability-metadata.md. The changeset added here validates on its own.


Summary by cubic

Fixes HTTP/2 responses dropping headers sent with an empty value from headersArray(), which made headerValue() return null and headerValues() return [] even though headers() reported the header as "". HTTP/1.1 responses already reported the header consistently across all methods.

  • Removes the empty-value filter in splitHeaderValues(), the only place the value was lost when Chrome sends no raw header text.
  • Adds regression tests covering header-map entries with empty values, extra-info arrivals, duplicated headers, and parity between the header-map and raw-text paths.
  • Adds patch changesets for the extension, TypeScript SDK, and Python SDK.

Written for commit 3bfc4a7. Summary will update on new commits.

View guided diff

aryansahai22 and others added 2 commits November 8, 2026 20:25
splitHeaderValues() discarded empty values, so a header sent with an empty
value vanished from headersArray() whenever Chrome supplied no raw header
text, which is the case for HTTP/2. headerValue() then returned null and
headerValues() returned [] while headers() and allHeaders() still reported
the header.

Fixes #3421
@github-actions github-actions Bot added external-contributor Tracks PRs mirrored from external contributor forks. external-contributor:mirrored An internal mirrored PR currently exists for this external contributor PR. labels Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

This mirrored PR has been merged into main. The original external PR #3422 is now completed.

@changeset-bot

changeset-bot Bot commented Nov 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6a08917

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
@browserbasehq/stagehand-extension Patch
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-python Patch
browse Patch
@browserbasehq/stagehand-examples Patch
@browserbasehq/stagehand-integrations-claude-cua-sdk Patch
@browserbasehq/stagehand-integrations Patch
@browserbasehq/eve Patch
@browserbasehq/stagehand-integrations-gemini-cua-sdk Patch
@browserbasehq/stagehand-integrations-example-pi-facade Patch
@browserbasehq/stagehand-integrations-claude-agent-sdk Patch
@browserbasehq/stagehand-integrations-example-claude-code-facade Patch
@browserbasehq/stagehand-integrations-codex-sdk Patch
@browserbasehq/stagehand-integrations-example-codex-facade Patch
@browserbasehq/stagehand-integrations-cursor-sdk Patch
@browserbasehq/stagehand-integrations-example-cursor-facade Patch
@browserbasehq/stagehand-integrations-deepagents-sdk Patch
@browserbasehq/stagehand-integrations-eve-sdk Patch
@browserbasehq/stagehand-integrations-fx-sdk Patch
@browserbasehq/stagehand-integrations-mastra-sdk Patch
@browserbasehq/stagehand-integrations-example-mastra-facade Patch
@browserbasehq/stagehand-integrations-pi-sdk Patch
@browserbasehq/stagehand-integrations-example-vercel-ai-facade Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@shrey150 shrey150 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

CI green. Matches Playwright's empty-header behavior over HTTP/1.1 and HTTP/2. Thanks @aryansahai22!

@shrey150
shrey150 merged commit b290165 into main Nov 10, 2026
57 checks passed
@shrey150
shrey150 deleted the external-contributor-pr-3422 branch November 10, 2026 19:04
@github-actions github-actions Bot added external-contributor:completed The mirrored PR has been merged and the external contributor flow is complete. and removed external-contributor:mirrored An internal mirrored PR currently exists for this external contributor PR. labels Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor:completed The mirrored PR has been merged and the external contributor flow is complete. external-contributor Tracks PRs mirrored from external contributor forks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

response.headerValue() reports an empty-valued header as missing on HTTP/2 responses

2 participants