Skip to content

fix(server): send skill text with NUL bytes as a blob - #1439

Open
DaleSeo wants to merge 1 commit into
mainfrom
DaleSeo/skills-fs-nul-text
Open

DaleSeo wants to merge 1 commit into
mainfrom
DaleSeo/skills-fs-nul-text

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Motivation and Context

Following up on #1409 (review), send a skill file with a textual MIME type as a blob if its contents include a NUL byte. This handles the UTF-16LE XML case.

Files with a textual MIME type are sent as text when their bytes are valid UTF-8. UTF-16 with a BOM already fails this check and is sent as a blob. But UTF-16LE without a BOM can pass, since each ASCII character is followed by 0x00, and NUL is valid UTF-8. As a result, the host receives text interspersed with NULs instead of the original document.

How Has This Been Tested?

Added tests

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-handler Handler implementation changes labels Nov 8, 2026
@github-actions
github-actions Bot requested a review from jamadeo November 8, 2026 15:48
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

@jamadeo is on triage rotation this week and is the reviewer for this one.

Labels come from the PR labeler. Please review the change.

Automated triage. Labels are a first pass and the assigned maintainer has the final say.

Base automatically changed from DaleSeo/skills-fs to main November 8, 2026 15:48
.then(|| std::str::from_utf8(&file.bytes).ok())
.flatten();
.flatten()
.filter(|text| !text.contains('\0'));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I went with a NUL check instead of trying to detect the charset from a BOM or XML declaration. We still don't transcode, and readable text shouldn't contain \0, so treating it as a blob is the safer fallback.

@DaleSeo
DaleSeo force-pushed the DaleSeo/skills-fs-nul-text branch from d3e926a to 24536b0 Compare November 8, 2026 16:43
@DaleSeo
DaleSeo marked this pull request as ready for review November 8, 2026 16:48
@DaleSeo
DaleSeo requested a review from a team as a code owner November 8, 2026 16:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T16:49:42.756080Z 24536b0 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-08T16:51:03.153922Z 24536b0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-handler Handler implementation changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant