Repository navigation
fix(skills): skip non-UTF-8 cached skill metadata - #8169
Vidit-Ostwal merged 1 commit into
Conversation
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Strix Security ReviewWarning This pull request has 54 commits after the last Strix review ( No security issues found. Review summaryReviewed all four changed files. The production change is limited to adding Updated for Reviewed by Strix |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 49 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
5dd6e13 to
b5b0172
Compare
b5b0172 to
e5d4a89
Compare
Thanks for your first contribution to CrewAI, @Winoren!We really appreciate the time and care you put into this PR. Your work is now part of CrewAI — welcome to the contributor community. Want to share your contribution? Totally optional: Share on X · Share the PR on LinkedIn If the links don't work, feel free to copy and personalize this: If you share, we'd love to see it — tag @crewAIInc on X and CrewAI on LinkedIn. |
Related issue
Fixes #8168.
Summary
A non-UTF-8
.crewai_meta.jsoncurrently raises UnicodeDecodeError before JSON parsing, aborting both SDK and CLI cached-skill listings. Catch it alongside the existing malformed-JSON handling so one corrupt entry does not hide healthy installed skills.The fix adds the exception to the two existing handlers. Regression tests exercise actual temporary cache files through SkillCacheManager.list_cached and SkillCommand.list_cached, including an invalid-JSON control. They verify that the healthy entry remains visible and the corrupt file is left unchanged.
Verification
On Python 3.13.12 / macOS arm64 with repository-lockfile dependencies:
Tests ran with CREWAI_TELEMETRY_DISABLED=true and OTEL_SDK_DISABLED=true. No model/provider calls or registry requests. Full monorepo tests were not run. Test files follow their existing style and are excluded by the repository's Ruff configuration.
Additional context
AI assistance: Codex investigated the code, prepared the fix and regression tests, and ran the checks above.
Note
Low Risk
Narrow defensive change to local cache enumeration only; no auth, network, or data-mutation behavior beyond skipping unreadable metadata files.
Overview
Fixes cached-skill listing when a global cache entry has a corrupt
.crewai_meta.json(non-UTF-8 bytes or invalid JSON). Previouslyread_text(encoding="utf-8")could raiseUnicodeDecodeErrorbefore JSON parsing and abort the whole listing, hiding healthy skills.SkillCacheManager.list_cached(SDK) andSkillCommand.list_cached(CLI) now catchUnicodeDecodeErrorwith the existing malformed-metadata handling—skip the bad entry (CLI warns; SDK logs at debug) and continue. Corrupt files are left on disk unchanged.Regression tests cover both paths with parametrized bad metadata (invalid UTF-8 and invalid JSON) alongside a healthy cache entry.
Reviewed by Cursor Bugbot for commit b5b0172. Bugbot is set up for automated code reviews on this repo. Configure here.