Skip to content

fix(core): convert XHTML in webfetch - #63889

Closed
Wang-Zephyr wants to merge 1 commit into
anomalyco:devfrom
Wang-Zephyr:webfetch-xhtml
Closed

Wang-Zephyr wants to merge 1 commit into
anomalyco:devfrom
Wang-Zephyr:webfetch-xhtml

Conversation

@Wang-Zephyr

@Wang-Zephyr Wang-Zephyr commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Fixes #63888

Type of change

  • Bug fix

What does this PR do?

Use the normalized response MIME type so webfetch converts application/xhtml+xml through the existing HTML converter. The html format still returns the raw body.

How did you verify your code works?

bun test ./test/tool-webfetch.test.ts in packages/core (92 passed). The new registered-tool test returned raw XHTML on f0089856 and now checks markdown, text, and HTML with a mocked HTTP response. Core typecheck, Prettier, and oxlint passed.

Screenshots / recordings

Backend tool output.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

OpenAI Codex assisted with the fix and regression test.


Added by the opencode bot (AI-generated).

Fixes #49322

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. I ran the new test against the base, where it fails, and with this change all 92 tests in tool-webfetch.test.ts pass. typecheck:tsc passes for packages/core.

Because convert() now uses the lowercased media type without its parameters, this also fixes mixed-case headers like Text/HTML; Charset=UTF-8. I checked that with the reproduction from #49322: it fails on the base and passes here.

The only behaviour change is exact matching instead of a substring match, which is correct for media types. The public API is unchanged. No concerns.

Fixes #49322

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.

webfetch skips HTML conversion for mixed-case media types WebFetch returns raw XHTML in Markdown and text modes

1 participant