Skip to content

agent_skills: Read SKILL.md in one shot via fs.load (#57510) (cherry-pick to preview)#57831

Merged
MartinYe1234 merged 1 commit into
v1.4.xfrom
cherry-pick-v1.4.x-a55e3e99
May 27, 2026
Merged

agent_skills: Read SKILL.md in one shot via fs.load (#57510) (cherry-pick to preview)#57831
MartinYe1234 merged 1 commit into
v1.4.xfrom
cherry-pick-v1.4.x-a55e3e99

Conversation

@rtfeldman

Copy link
Copy Markdown
Contributor

Cherry-pick of #57510 to preview


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

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
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 27, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label May 27, 2026
@MartinYe1234 MartinYe1234 merged commit e0ecfa8 into v1.4.x May 27, 2026
42 checks passed
@MartinYe1234 MartinYe1234 deleted the cherry-pick-v1.4.x-a55e3e99 branch May 27, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants