agent_skills: Read SKILL.md in one shot via fs.load (#57510) (cherry-pick to preview)#57831
Merged
Merged
Conversation
Follow-up to #57466 simplifying `load_skill_frontmatter` rather than fixing a separate bug. the frontmatter boundary, preventing `str::from_utf8` from failing on a multi-byte grapheme split across chunks. That fix is correct, but the chunked read it's working around isn't pulling its weight: `MAX_SKILL_FILE_SIZE` is 100KB and there's already a metadata pre-check, so "stop reading early once we've seen the closing `---`" saves at most ~25 pages per file while forcing the use of `open_sync`, a hand-rolled loop, and a long comment about `smol::unblock` vs the GPUI test scheduler. This PR: - replaces the chunked `open_sync` + read loop with a single `fs.load(...)` call (the same primitive `read_skill_body` already uses); - deletes `closing_delimiter_end`, `SKILL_READ_CHUNK_SIZE`, the `std::io::{self, Read}` import, and the `Parking forbidden` paragraph; - tightens the metadata pre-check so a metadata error (permissions, I/O, etc.) bails out instead of silently falling through to a blind read; - removes the now-obsolete `test_load_skill_frontmatter_with_emoji_at_chunk_boundary` test — by construction, a single full read can't split a UTF-8 sequence at any boundary. Closes AI-303 Release Notes: - N/A
bennetbo
approved these changes
May 27, 2026
This was referenced May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #57510 to preview
Follow-up to #57466 simplifying
load_skill_frontmatterrather thanfixing a separate bug.
the frontmatter boundary, preventing
str::from_utf8from failing on amulti-byte grapheme split across chunks. That fix is correct, but the
chunked read it's working around isn't pulling its weight:
MAX_SKILL_FILE_SIZEis 100KB and there's already a metadata pre-check,so "stop reading early once we've seen the closing
---" saves at most~25 pages per file while forcing the use of
open_sync, a hand-rolledloop, and a long comment about
smol::unblockvs the GPUI testscheduler.
This PR:
open_sync+ read loop with a singlefs.load(...)call (the same primitiveread_skill_bodyalready uses);closing_delimiter_end,SKILL_READ_CHUNK_SIZE, thestd::io::{self, Read}import, and theParking forbiddenparagraph;etc.) bails out instead of silently falling through to a blind read;
test_load_skill_frontmatter_with_emoji_at_chunk_boundarytest — byconstruction, a single full read can't split a UTF-8 sequence at any
boundary.
Closes AI-303
Release Notes: