Skip to content

refactor(state): extract title cluster into hermes_state_title.py (hermes_state.py slice R3-C9, epic #78647) - #80371

Closed
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:gfg/hs-r3-c9
Closed

refactor(state): extract title cluster into hermes_state_title.py (hermes_state.py slice R3-C9, epic #78647)#80371
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:gfg/hs-r3-c9

Conversation

@andrexibiza

Copy link
Copy Markdown
Contributor

What changed and why

God-file kill campaign (epic #78647): hermes_state.py slice R3-C9 — the title cluster, extracted byte-verbatim into a new mixin module.

  • Window: hermes_state.py lines 5291–5463 (class attr MAX_TITLE_LENGTH + sanitize_title, _is_compression_ancestor, _set_session_title, set_session_title, set_auto_title_if_empty, get_session_title).
  • Golden sha256 (window bytes, LF-joined, no trailing NL): bb7de39c73a6de9e8a61ab3dfd25528e980c310b6b58c25cb8f4742d115ab15b (7,619 B); with-NL variant bdec5623ae3a63e63e652c7e21f993b7804134762739db03910141a213122f05 (7,620 B) — both verified byte-exact against the pinned blob.
  • Module: hermes_state_title.py with SessionTitleMixin (house precedent; module never imports hermes_state — cycle guard).
  • Class line: class SessionDB(SessionSearchMixin, SessionSchemaMixin, SessionPortabilityMixin, SessionTitleMixin): — mixin appended last.
  • Kill-line math: 9,691 → 9,518 (−173). Reconstruction proof: pin blob − window + class-line edit == new hermes_state.py, byte-identical.
  • Zero behavior change: no global, no instance state; MAX_TITLE_LENGTH referenced only inside the window; single out-edge self._execute_write; zero from hermes_state import <name> consumers; zero patch targets on any C9 name (verified repo-wide).

Double-blind: consensus R3-CONSENSUS.md (adjudicated 2026-08-06; pass B's pick, pass A's C1+C2 rejected on live collision #71486). Implementer re-ran the collision gate (only #72149, 210 commits behind, inserts a method adjacent to the C9 tail — rebase friction, not a collision).

How to test

HERMES_PYTHON="C:/Users/andre/AppData/Local/hermes/hermes-agent/venv/Scripts/python.exe" scripts/run_tests.sh tests/test_hermes_state_title_seam.py tests/test_hermes_state.py

Expected: seam test (7/7 moved names identity, MRO mixin-first, MAX_TITLE_LENGTH == 100, sanitize behavior) + the title test matrix. Implementer ran the full title matrix: 202/202 + 37/37 green; 7 pre-existing Windows env failures proven identical at pristine origin/main.

Seam identity probe:

python -c "import sys; sys.path.insert(0,'.'); import hermes_state; import hermes_state_title as m; from hermes_state import SessionDB; assert SessionDB.set_session_title is m.SessionTitleMixin.set_session_title; assert SessionDB.get_session_title is m.SessionTitleMixin.get_session_title"

Platforms tested

Windows (dev host), venv python 3.11; git diff --check clean; LF-only.

Why this matters to users

No user-visible change — step 5 in shrinking hermes_state.py (9,691 → 9,518) toward the 2K Law ceiling. Seam identity + suite green keep the refactor invisible until the god-file is dead.

Part of #78647
Part of #78636

…rmes_state.py slice R3-C9, epic NousResearch#78647)

Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state duplicate This issue or pull request already exists labels Aug 6, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #80363: both PRs extract the same SessionDB title cluster into SessionTitleMixin with the same MRO seam. #80363 is the earlier open implementation.

@andrexibiza

Copy link
Copy Markdown
Contributor Author

FILE-LIST: title cluster collision with sibling PR. See #78636 coordination comment. Keep one, credit the other — do not double-merge hermes_state_title.py. Part of #78636 + #78647.

@andrexibiza

Copy link
Copy Markdown
Contributor Author

FILE-LIST close — title cluster DUPLICATE

Superseded by #80363 (same window 5291–5463, same golden bb7de39c…).

Keep Close
#80363 this PR #80371

#80363 carries dual-blind APPROVED receipts (Pass A + Pass B) + pyproject packaging. Credit retained for this branch's implementer work; do not double-merge hermes_state_title.py.

Part of #78636 + #78647.

@andrexibiza andrexibiza closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants