Skip to content

fix(packaging): add 4 hermes_state_* modules to pyproject.toml py-modules - #74412

Closed
webtecnica wants to merge 2 commits into
NousResearch:mainfrom
webtecnica:fix/74287-pyproject-missing-state-modules
Closed

fix(packaging): add 4 hermes_state_* modules to pyproject.toml py-modules#74412
webtecnica wants to merge 2 commits into
NousResearch:mainfrom
webtecnica:fix/74287-pyproject-missing-state-modules

Conversation

@webtecnica

Copy link
Copy Markdown
Contributor

Summary

Fixes #74287 — four hermes_state_* top-level modules split out of hermes_state.py were missing from [tool.setuptools] py-modules in pyproject.toml, causing every wheel-based install (pip, uv, nix, distro packaging) to silently drop them. The SQLite session store then fails to import with ModuleNotFoundError: No module named 'hermes_state_common', and Hermes runs with persistence disabled.

Root cause

Commit 21c7ae8 refactored hermes_state.py into four focused modules:

  • hermes_state_common — shared constants extracted to break import cycles
  • hermes_state_portability — SessionPortabilityMixin (WAL handling, DB lifecycle)
  • hermes_state_schema — SessionSchemaMixin (DDL, migrations, FTS5 setup)
  • hermes_state_search — SessionSearchMixin (FTS5 queries, filters)

The pyproject.toml py-modules list was not updated to include these four new top-level modules. Git-based installs worked because the files exist in the repo tree, but wheel packaging relies exclusively on the py-modules list for single-file modules at the package root.

Changes

pyproject.toml — add hermes_state_common, hermes_state_portability, hermes_state_schema, hermes_state_search to the [tool.setuptools] py-modules list, grouped after hermes_state.

Verification

All four modules import correctly after the fix:

  • from hermes_state_common import _PREVIEW_HEAD_CHARS, SCHEMA_SQL, FTS_SQL
  • from hermes_state_portability import SessionPortabilityMixin
  • from hermes_state_schema import SessionSchemaMixin
  • from hermes_state_search import SessionSearchMixin
  • import hermes_state (full re-export chain)

teknium1 and others added 2 commits July 29, 2026 19:19
…anical move, ~2.9K LOC out of hermes_state.py)
…ules

hermes_state.py was refactored into four top-level modules:
- hermes_state_common (shared constants)
- hermes_state_portability (SessionPortabilityMixin)
- hermes_state_schema (SessionSchemaMixin)
- hermes_state_search (SessionSearchMixin)

These modules were missing from [tool.setuptools] py-modules, so any
wheel-based install (pip, uv, nix, distro packaging) silently shipped
without them, disabling the SQLite session store entirely.

Fixes NousResearch#74287
@webtecnica
webtecnica requested a review from a team July 29, 2026 22:20
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint area/sessions Session lifecycle, resume, persistence, history area/install-update Installer, updater, packaging, wheels, doctor sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades duplicate This issue or pull request already exists labels Jul 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #74393 — it covers the same four missing py-modules entries with focused build-artifact guards; this PR also carries a large unrelated state-module extraction.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for identifying the missing setuptools entries. The packaging hunk is needed: current hermes_state.py:45-72 imports the four split root modules, while current pyproject.toml:349 still omits all four from py-modules.

Problems

  • The PR includes the large SessionDB extraction already present on current main through ancestor commit 21c7ae8563; only the pyproject.toml change remains to salvage.
  • No regression test covers wheel contents. tests/test_packaging_build_guard.py:64-72 verifies that a permitted artifact exists, but not that it contains these required root modules.

Suggested changes

  • Salvage the focused packaging commit bcfd7ccafe1a109de2a54fb56427487829918f8f only.
  • Add a built-wheel member assertion for the four hermes_state_*.py modules.

Automated hermes-sweeper review.

Comment thread pyproject.toml
# Top-level single-file modules (not packages). Without this, uv2nix's
# sealed venv is missing hermes_constants, run_agent, etc.
py-modules = ["run_agent", "model_tools", "toolsets", "batch_runner", "trajectory_compressor", "toolset_distributions", "cli", "hermes_bootstrap", "hermes_constants", "hermes_state", "hermes_time", "hermes_logging", "utils", "mcp_serve"]
py-modules = ["run_agent", "model_tools", "toolsets", "batch_runner", "trajectory_compressor", "toolset_distributions", "cli", "hermes_bootstrap", "hermes_constants", "hermes_state", "hermes_state_common", "hermes_state_portability", "hermes_state_schema", "hermes_state_search", "hermes_time", "hermes_logging", "utils", "mcp_serve"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This metadata repair is correct, but please add a behavioral regression test that inspects a permitted Nix-built wheel for these four files. The existing artifact test only asserts that an artifact was created, so it cannot detect a missing py-module.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Jul 30, 2026
@ethernet8023

Copy link
Copy Markdown
Collaborator

already fixed in 74362

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

Labels

area/install-update Installer, updater, packaging, wheels, doctor area/sessions Session lifecycle, resume, persistence, history comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P1 High — major feature broken, no workaround sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pyproject.toml py-modules omits four hermes_state_* modules — session store silently disabled in every wheel-based install (found on NixOS)

4 participants