Skip to content

fix(skills): handle bytes content in bundle_content_hash - #2740

Closed
Mibayy wants to merge 3 commits into
NousResearch:mainfrom
Mibayy:fix/skills-update-bytes-encode
Closed

fix(skills): handle bytes content in bundle_content_hash#2740
Mibayy wants to merge 3 commits into
NousResearch:mainfrom
Mibayy:fix/skills-update-bytes-encode

Conversation

@Mibayy

@Mibayy Mibayy commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #2739

Root cause

SkillBundle.files is typed Dict[str, Union[str, bytes]] — binary files (images, compiled assets, etc.) are stored as bytes. bundle_content_hash() was calling .encode('utf-8') unconditionally, which raises AttributeError: 'bytes' object has no attribute 'encode' when any such file is present in the bundle being checked for updates.

Fix

One-line guard:

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

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

No behaviour change for text-only bundles.

Hermes added 3 commits March 23, 2026 20:30
Display a permissions label so users always know whether the agent is
running in FULL ACCESS (--yolo) or RESTRICTED ACCESS mode.

Changes:
- hermes_cli/banner.py: show 'FULL ACCESS' (red) or 'RESTRICTED ACCESS'
  (green) line in the welcome banner below the model name
- cli.py: append '⚠ FULL ACCESS' fragment to the bottom status bar when
  HERMES_YOLO_MODE is set (both the fragment renderer and the plain-text
  fallback)
- cli.py: add 'status-bar-yolo' style (#FF4444 bold) for the status bar
  fragment

Default behavior (no --yolo) is unchanged — RESTRICTED ACCESS is shown
in green as a positive confirmation. The label is visible on first
launch and persists in the status bar throughout the session.

Closes NousResearch#2663
Implements full Feishu/Lark integration following the platform checklist:

- gateway/platforms/feishu.py: WebSocket (Long Connection) adapter using
  lark-oapi SDK. App Access Token auth with auto-refresh. Text and rich-text
  (post) message parsing. Deduplication, reconnect backoff, standalone
  _send_feishu_message() for cron/tool use.

- gateway/config.py: Platform.FEISHU enum, _apply_env_overrides() block
  (FEISHU_APP_ID + FEISHU_APP_SECRET + FEISHU_HOME_CHANNEL), and
  get_connected_platforms() check for extra.app_id. Supports both
  open.feishu.cn (mainland) and open.larksuite.com (international) via
  FEISHU_USE_LARK_DOMAIN env var.

- gateway/run.py: _create_adapter() factory, FEISHU_ALLOWED_USERS and
  FEISHU_ALLOW_ALL_USERS in both authorization allowlist maps, startup
  warning, and two platform_toolsets maps (hermes-feishu).

- gateway/channel_directory.py: session-based discovery for feishu/dingtalk.

- agent/prompt_builder.py: PLATFORM_HINTS for both feishu and dingtalk.

- toolsets.py: hermes-dingtalk and hermes-feishu toolsets, both included
  in hermes-gateway composite.

- cron/scheduler.py + tools/send_message_tool.py: feishu in platform_map
  and _send_feishu() standalone async function for direct delivery.

- tools/cronjob_tools.py: feishu added to deliver parameter description.

- hermes_cli/status.py: DingTalk + Feishu in platform status display.

- hermes_cli/gateway.py: Feishu setup wizard entry with 6-step instructions.

- tests/gateway/test_feishu.py: 26 tests covering requirements, adapter
  init, platform enum, config loading, auth maps, send routing, text
  extraction, deduplication, and mocked send/error paths.

Closes NousResearch#2737
SkillBundle.files is typed Dict[str, Union[str, bytes]] but
bundle_content_hash() was calling .encode('utf-8') unconditionally,
crashing when a binary file (image, compiled asset) is included in a
skill bundle.

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

Closes NousResearch#2739
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #3751 and #13531 — same one-line isinstance guard for bytes in bundle_content_hash(). Multiple prior PRs (#13424, #12518, #14108, #18367) attempted this fix.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #3751.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks @Mibayy — same fix already landed on main via #9925 (commit 3072e5543, authored by @dodofun) back in April. Teknium followed up with additional bytes-vs-str equivalence tests in 91ea3ae4b. Current bundle_content_hash already guards with isinstance(content, bytes) — behavior is identical to your patch. Closing as redundant. Appreciate the independent diagnosis and clean writeup of the root cause.

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

Labels

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.

[Bug]: hermes skills update fails

3 participants