Skip to content

fix(skills): decode skill bodies as UTF-8 🤖🤖🤖 - #281

Merged
alessiodevoto merged 2 commits into
NVIDIA-NeMo:mainfrom
Sampoornnagpal:fix/skill-body-utf8
Sep 10, 2026
Merged

fix(skills): decode skill bodies as UTF-8 🤖🤖🤖#281
alessiodevoto merged 2 commits into
NVIDIA-NeMo:mainfrom
Sampoornnagpal:fix/skill-body-utf8

Conversation

@Sampoornnagpal

@Sampoornnagpal Sampoornnagpal commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Skill metadata is read as UTF-8, but _parse_skill_md() reads the body using the locale encoding. A UTF-8 skill containing 50€ → café 中文 🚀 becomes corrupted instructions on a cp1252 host. Read the body as UTF-8 too.

Add a regression that forces a legacy default even on UTF-8 hosts and checks the loaded skill's full body. The test fails before the fix.

Related issues

The parser remains in use in #161; this change is limited to its body decoding and does not alter that refactor's APIs or arbitrary-file encoding policy.

Validation

uv run pytest -q tests/unit/test_skill.py -k 'not run_script' — 19 passed, 7 Bash-dependent tests deselected.

Windows/Python 3.12 with external import-only helpers for #84/#85 (fcntl/SIGUSR2). Helpers are not included; POSIX locks/signals and Bash execution are not validated by this run.

Checklist

  • Ruff lint and formatting pass.
  • Regression and skill-loading tests pass.
  • Existing UTF-8 skill format retained.
  • Existing SPDX headers retained.

Summary by CodeRabbit

  • Bug Fixes

    • Skill files are now consistently read as UTF-8, preserving Unicode characters regardless of the platform’s default text encoding.
    • Skill descriptions continue to be parsed correctly when files contain Unicode content.
  • Tests

    • Added regression coverage for loading path-based skills with Unicode content under differing default encodings.
    • Added explanatory documentation to related test cases.

Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7e79754a-7dee-43c5-95ba-fc86e59924b8

📥 Commits

Reviewing files that changed from the base of the PR and between 5d22bf3 and fd31243.

📒 Files selected for processing (1)
  • tests/unit/test_skill.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/unit/test_skill.py

Included review availability: Your plan provides up to 12 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The skill loader now reads SKILL.md files as UTF-8. Tests verify that multilingual text, symbols, and emoji remain intact when the platform default encoding is cp1252.

Changes

Skill file encoding

Layer / File(s) Summary
Explicit UTF-8 skill loading
src/nooa/skill.py, tests/unit/test_skill.py
_parse_skill_md explicitly decodes SKILL.md as UTF-8. Regression coverage verifies Unicode preservation and documents related skill construction tests.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to fd312

Skill bodies containing multilingual text and symbols now load as UTF-8 rather than depending on the host locale. The targeted regression coverage indicates no remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: decoding skill bodies as UTF-8. The emojis add minor noise, but they do not obscure the change.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
@alessiodevoto alessiodevoto self-assigned this Sep 7, 2026

@alessiodevoto alessiodevoto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for this fix @Sampoornnagpal :)

@alessiodevoto
alessiodevoto merged commit f1c2587 into NVIDIA-NeMo:main Sep 10, 2026
9 checks passed
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.

2 participants