Skip to content

fix(s07, s15): skip unreadable skill manifests during startup scan - #671

Open
shuhuNB515 wants to merge 1 commit into
shareAI-lab:mainfrom
shuhuNB515:fix/skill-scan-unreadable-manifest
Open

shuhuNB515 wants to merge 1 commit into
shareAI-lab:mainfrom
shuhuNB515:fix/skill-scan-unreadable-manifest

Conversation

@shuhuNB515

Copy link
Copy Markdown

Fixes #669

Problem

SkillLoader.scan() (s07) and scan_skills() (s15) read every skills/*/SKILL.md at import time without error handling. A single manifest with invalid UTF-8 bytes, or an OSError from permissions/a race with a removed file, raised out of module import: neither agent could start and none of the otherwise valid skills were catalogued.

Fix

Wrap only the read_text() call in try/except (OSError, UnicodeError), print a short warning and skip that manifest. Applied to both implementations. Updated the s07 scan() code block in all three READMEs (en/zh/ja) and regenerated the embedded copies in web/src/data/generated/docs.json and versions.json; verified each snapshot matches its source byte-for-byte.

Verification (real modules)

case before after
one good skill + one invalid-UTF-8 SKILL.md both s07 and s15 imports crash with UnicodeDecodeError warning printed, good skill catalogued
symlink outside skills root skipped unchanged
normal UTF-8 manifests catalogued unchanged

python3 -m pytest tests -q: 503 passed, 118 subtests passed.


Disclosed AI assistance: found and fixed during an AI-assisted review; failures were reproduced against both real modules before and after the change.

SkillLoader.scan and scan_skills call read_text directly while walking
skills/*/SKILL.md at import time. One bad manifest (invalid UTF-8,
unreadable permissions/race with a removed file) aborts module import, so
the whole agent cannot start and no skill is catalogued. Skip such files
with a warning, as the store loaders in other chapters already do for
corrupt entries. Keep the s07 README code block in all three languages
and the generated web snapshots in sync.

Disclosed AI assistance: found during an AI-assisted review.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

s07/s15: one unreadable SKILL.md aborts the skill scan at import time

1 participant