Skip to content

fix(skills): use profile-aware skills dir in skill_utils normalization - #60231

Closed
isheng-eqi wants to merge 6 commits into
NousResearch:mainfrom
isheng-eqi:fix/skill-utils-profile-aware-skills-dir
Closed

fix(skills): use profile-aware skills dir in skill_utils normalization#60231
isheng-eqi wants to merge 6 commits into
NousResearch:mainfrom
isheng-eqi:fix/skill-utils-profile-aware-skills-dir

Conversation

@isheng-eqi

@isheng-eqi isheng-eqi commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

agent/skill_utils.py still references the module-level SKILLS_DIR constant, while #60180 added _skills_dir() for call-time resolution. Skill path normalization in long-lived multi-profile runtimes uses the wrong profile's skills directory.

Related Issue

Fixes sibling path of #60180 (profile-aware skills resolution, #40677).

Type of Change

  • Bug fix

Changes Made

  • agent/skill_utils.py: Replace _skills_tool.SKILLS_DIR with _skills_tool._skills_dir() in normalize_skill_identifier()

The gateway already strips stale dangerous-confirmation text from
replayed history (NousResearch#60110, NousResearch#60117 — fix for NousResearch#59607). The TUI gateway
has two session resume paths that sanitize replay history but do not
strip stale dangerous confirmations, leaving the same vulnerability
unaddressed in TUI sessions.

Add strip_stale_dangerous_confirmations() after sanitize_replay_history()
in both TUI resume paths (resume_session and the WebUI resume path).

Refs: NousResearch#59607, NousResearch#60110, NousResearch#60117
The recent Discord resource-bounding pass (NousResearch#60122, NousResearch#60112, NousResearch#60113)
added limits for REST JSON/error response bodies and component label
UTF-16 lengths. Four HTTP response reads for image/animation/attachment
downloads were left unbounded — an oversized response from a CDN or
external URL could OOM the bot.

Add _DISCORD_IMAGE_DOWNLOAD_MAX_BYTES (50 MB) and
_DISCORD_ATTACHMENT_DOWNLOAD_MAX_BYTES (100 MB) constants, a shared
_read_response_bytes_bounded() helper, and apply bounds to:
- Batch image download (adapter.py ~2467)
- Single image download (adapter.py ~3555)
- Animation/GIF download (adapter.py ~3634)
- Attachment download (adapter.py ~5799)

Refs: NousResearch#60122, NousResearch#60112
The profile-aware skills resolution fix (NousResearch#60180) added _skills_dir() to
tools/skills_tool.py and tools/skill_manager_tool.py so that long-lived
multi-profile runtimes always resolve the live profile-scoped HERMES_HOME.
agent/skill_utils.py still referenced the module-level SKILLS_DIR constant,
which would return stale import-time paths in the same long-lived runtimes.

Replace _skills_tool.SKILLS_DIR with _skills_tool._skills_dir() in the
normalize_skill_identifier() path, matching the pattern established in
NousResearch#60180. Tests that patch SKILLS_DIR are unaffected — _skills_dir() falls
back to the patched value when it differs from _SKILLS_DIR_AT_IMPORT.

Refs: NousResearch#60180, NousResearch#40677
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/skills Skills system (list, view, manage) P3 Low — cosmetic, nice to have labels Jul 7, 2026
@isheng-eqi

Copy link
Copy Markdown
Contributor Author

Consolidating into one comprehensive profile-awareness fix.

@isheng-eqi isheng-eqi closed this Jul 7, 2026
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 P3 Low — cosmetic, nice to have 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.

2 participants