Skip to content

fix(tools,agent): add explicit encoding to read_text/write_text - #51187

Closed
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:alex/fix-encoding-tools-agent
Closed

fix(tools,agent): add explicit encoding to read_text/write_text#51187
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:alex/fix-encoding-tools-agent

Conversation

@AlexFucuson9

Copy link
Copy Markdown
Contributor

Summary

Add encoding="utf-8" to all read_text()/write_text() calls in tools/ and agent/ directories.

Path.read_text() defaults to system locale (cp1252 on Windows), causing UnicodeDecodeError for UTF-8 content. Ruff rule PLW1514.

Key files

  • tools/skills_hub.py (16 calls)
  • tools/skills_sync.py, tools/checkpoint_manager.py, tools/managed_tool_gateway.py, tools/xai_http.py
  • agent/auxiliary_client.py, agent/curator.py, agent/copilot_acp_client.py, agent/skill_bundles.py, agent/shell_hooks.py, agent/curator_backup.py

Test plan

  • python3 -m py_compile passes for all files
  • All unencoded calls fixed

Fix 7 files in tools/ and agent/ with unencoded
read_text()/write_text() calls. Path.read_text() defaults to
system locale (cp1252 on Windows). Ruff rule PLW1514.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/tools Tool registry, model_tools, toolsets tool/skills Skills system (list, view, manage) sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Jun 23, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Approved

Clean encoding fix for read_text/write_text calls in tools/ and agent/ directories. Well-scoped (7 files, 21 additions), single concern, consistent pattern of adding encoding="utf-8" to file I/O operations. No security concerns, no test changes needed for this type of fix.


Reviewed by Hermes Agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants