Skip to content

bug: build_skills_system_prompt() TypeError with compact_categories on Windows post-upgrade #45473

Closed as not planned

Description

@kuangxiangth-ops

Bug Report

After upgrading from f222bd2 to 0a7a818 (284 commits) on Windows, the Hermes Gateway email handler crashes with:

TypeError: build_skills_system_prompt() got an unexpected keyword argument "compact_categories"

Reproduction

  1. Run hermes update on Windows (0.16.0 baseline)
  2. Gateway restarts automatically
  3. Email handler processes incoming mail
  4. Crashes on build_skills_system_prompt(compact_categories=...) call

Expected

The parameter compact_categories exists in agent/prompt_builder.py (line 1121), and tests in tests/agent/test_prompt_builder.py exercise it. It should work.

Suspected Cause

Stale .pyc cache after pip upgrade — the old bytecode may not include the compact_categories parameter that was added in a recent commit. pip install --upgrade does not always clear __pycache__.

Workaround

Clear __pycache__ directories and restart:

find ~/.hermes/hermes-agent -name __pycache__ -exec rm -rf {} +
hermes gateway restart

Environment

  • OS: Windows (Hermes 不二)
  • Hermes: v0.16.0, commit 0a7a818
  • Upgrade delta: 284 commits

Activity

  1. added
    type/bugSomething isn't working
    comp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint
    P2Medium — degraded but workaround exists
    on Jun 13, 2026
  2. szzhoujiarui-sketch commented on Jun 14, 2026

    @szzhoujiarui-sketch

    I can take a look at this one. I’ll first verify whether this is indeed caused by stale bytecode after upgrade, then trace the Windows update/restart path and propose the smallest fix that prevents the gateway from loading an old implementation. I’ll avoid changing prompt-building behavior unless the code path shows that is actually necessary.

  3. szzhoujiarui-sketch commented on Jun 14, 2026

    @szzhoujiarui-sketch

    Small correction to my previous comment: the missing function name is build_skills_system_prompt in agent/prompt_builder.py. I’ll verify that specific stale-bytecode premise before proposing a fix.

  4. teknium1 commented on Jul 14, 2026

    @teknium1
    Collaborator

    Thanks for the detailed Windows upgrade report. This is already addressed on current main; automated hermes-sweeper review verified both the API contract and update-path mitigation.

    • agent/prompt_builder.py:1445-1449 accepts compact_categories, and agent/system_prompt.py:314-318 passes that keyword through the live prompt-building path.
    • hermes_cli/main.py:4469-4494 removes stale __pycache__ directories; the normal git update path invokes it at hermes_cli/main.py:9898-9905 (the ZIP path does so at 6355-6360).
    • The update mitigation was introduced by c4cf20f56469f49058791388f68d25fe75fe7c79 (fix: clear __pycache__ during update to prevent stale bytecode ImportError (#3819)), which is contained in release tag v2026.3.30.
    • tests/agent/test_prompt_builder.py:429-475 covers the compact_categories argument directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpointsweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions