Skip to content

fix(skills): handle bytes values in bundle_content_hash - #19081

Closed
shellybotmoyer wants to merge 1 commit into
NousResearch:mainfrom
shellybotmoyer:fix/bundle-content-hash-bytes
Closed

fix(skills): handle bytes values in bundle_content_hash#19081
shellybotmoyer wants to merge 1 commit into
NousResearch:mainfrom
shellybotmoyer:fix/bundle-content-hash-bytes

Conversation

@shellybotmoyer

Copy link
Copy Markdown
Contributor

Fix: Handle bytes values in bundle_content_hash

SkillBundle.files is typed as Dict[str, Union[str, bytes]] — dict values can be either str or bytes depending on how the bundle was loaded. However, bundle_content_hash() unconditionally called .encode("utf-8") on every value, causing AttributeError: 'bytes' object has no attribute 'encode' when the value was already bytes.

Before:

h.update(bundle.files[rel_path].encode("utf-8"))

After:

content = bundle.files[rel_path]
if isinstance(content, bytes):
    h.update(content)
else:
    h.update(content.encode("utf-8"))

Fixes #19073

SkillBundle.files is Dict[str, Union[str, bytes]] but bundle_content_hash

unconditionally called .encode("utf-8") on every value, causing

AttributeError when the value is already bytes.

Fix: check isinstance(content, bytes) before encoding.

FixesNousResearch/hermes-agent#19073
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/skills Skills system (list, view, manage) labels May 3, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #19079 (and #13531, #18367) — same one-line fix for bytes values in bundle_content_hash(). Multiple PRs already open for this.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #19079 (and #13531, #18367) — same one-line fix for bytes values in bundle_content_hash().

@teknium1

teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

The same bytes fix landed via #19575 (salvage of @teknium1's #19328, which was itself the canonical consolidation of five concurrent PRs — including yours). The logic you proposed is identical; thanks for catching and fixing this bug. Both contributors who implemented the same fix get credit via the commit's AUTHOR_MAP and this acknowledgement. Closing as duplicate.

@teknium1 teknium1 closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists 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.

AttributeError in bundle_content_hash when checking skill updates

3 participants