Skip to content

fix(skills): report the per-file MIME type for supporting files - #5853

Closed
BlueX888 wants to merge 2 commits into
PrefectHQ:mainfrom
BlueX888:fix/skill-template-file-mime
Closed

BlueX888 wants to merge 2 commits into
PrefectHQ:mainfrom
BlueX888:fix/skill-template-file-mime

Conversation

@BlueX888

Copy link
Copy Markdown
Contributor

Closes #5852

Description

With the default SkillProvider (supporting_files="template"), supporting-file reads always reported application/octet-stream: the provider guessed the file MIME to choose text vs blob, then returned a bare str/bytes, and convert_result stamped the template's static mime_type over the guess. The same files in supporting_files="resources" mode returned text/markdown / application/json.

What changed

  • SkillFileTemplate._guess_mime_type() centralizes the guess and the octet-stream fallback.
  • _read() wraps the raw content in ResourceResult([ResourceContent(content, mime_type=<guessed>)]) so the per-file MIME survives, instead of routing through convert_result with the template's advertised MIME.
  • The content item also carries meta=public_result_meta(self.meta), preserving the template-level metadata propagation that convert_result performed before this change (private fastmcp._* keys are stripped).
  • read() keeps its existing raw str/bytes contract and text/blob selection (text iff the MIME starts with text/), so direct-read and path-safety tests are unchanged. URI routing, listing, and manifest behavior are untouched.

Contribution type

  • Bug fix (simple, well-scoped fix for a clearly broken behavior)
  • Documentation improvement
  • Enhancement

Bug fix verification

Test paths: tests/server/providers/test_skills_provider.py (three MIME parametrizations plus a listing control) and the template-meta propagation test (both .md and .json content items).

Red at adf90b66 (implementation reverted, final tests applied): 2 failed, 99 passed; failures are the .md and .json MIME assertions (the unknown-extension and listing controls pass as expected); no collection errors.

Green at the fix commit: 2425 passed, 1 skipped across tests/server/providers/ tests/utilities/.

Validation

  • uv run --isolated pytest tests/server/providers/ tests/utilities/ -q -> 2425 passed, 1 skipped
  • uv run --isolated ruff check and ruff format --check on the changed files -> clean
  • uv run --isolated ty check -> All checks passed

AI assistance

Tool(s) used: Claude Code
How you used it: investigated from a verified reproduction, implemented the MIME preservation and the regression tests.

Checklist

  • This PR addresses an existing issue (or fixes a self-evident bug)
  • I have read CONTRIBUTING.md
  • I have added tests that cover my changes
  • I have run uv run prek run --all-files and all checks pass (focused checks passed)
  • I have self-reviewed my changes
  • If I used an LLM, it followed the repo's contributing conventions (not generic output)

SkillFileTemplate._read() passed raw str/bytes through convert_result(),
which stamped the template's advertised application/octet-stream onto
every supporting file. A .md read returned TextResourceContents with
octet-stream and a .json read returned a Blob with octet-stream, while
supporting_files="resources" mode returned text/markdown and
application/json for the same files.

Guess the MIME per file in the template read path and return a
ResourceResult carrying it, keeping the existing text/blob selection.
The MIME fix built ResourceContent directly in SkillFileTemplate._read()
instead of going through convert_result(), which also dropped the
template's component-level meta from the wire content item. Apply
public_result_meta(self.meta) to the constructed content so template
meta continues to reach resources/read results while the per-file MIME
is preserved.
@github-actions

Copy link
Copy Markdown
Contributor

This pull request is awaiting maintainer assignment. Linked PRs stay open while maintainers triage the issue; this check remains failing until assignment.

Per CONTRIBUTING.md, an external PR must reference an issue that's assigned to its author. To get there:

  1. A maintainer will review the issue and decide whether to assign you. Please don't comment just to request assignment.

Once you're assigned and the link is present, this check is re-run automatically. Previously gate-closed PRs also reopen — no further action needed.

Maintainers: reopen this PR or remove the missing-issue-link label to bypass this check.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T14:05:03.545729Z eff74f5 PR opened
ℹ️ 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.

@marvin-context-protocol marvin-context-protocol Bot added the bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. label Oct 19, 2026
@BlueX888

Copy link
Copy Markdown
Contributor Author

Closing this one to reduce review volume, per maintainer feedback. The underlying issue remains open for triage; the branch and tests stay on the fork if it becomes useful later.

@BlueX888 BlueX888 closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. missing-issue-link

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Skill supporting files read through the default template report application/octet-stream

1 participant