Skip to content

fix(gateway): re-inject topic-bound skill after /new or /reset#18205

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-191404c2
May 1, 2026
Merged

fix(gateway): re-inject topic-bound skill after /new or /reset#18205
teknium1 merged 1 commit into
mainfrom
hermes/hermes-191404c2

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

@teknium1 teknium1 commented May 1, 2026

Summary

Topic/channel skills (group_topics, channel_skill_bindings) now re-inject on the first message after a manual /new or /reset.

Root cause: reset_session() creates a fresh SessionEntry with created_at == updated_at, but get_or_create_session() bumps updated_at on the next inbound message. The _is_new_session check in _handle_message_with_agent evaluates False → skill auto-load is silently skipped.

Fix: Add an is_fresh_reset flag on SessionEntry, set by reset_session() and consumed once by the message handler. Kept distinct from was_auto_reset because that flag also fires a "session expired due to inactivity" user-facing notice and a context-note prepend — both wrong for an explicit manual reset.

Fixes #6508. Supersedes #6521, #10839, #10856, #17096.

Changes

  • gateway/session.py: is_fresh_reset field on SessionEntry, set in reset_session(), persisted through to_dict/from_dict so it survives a gateway restart between /reset and the next message.
  • gateway/run.py: OR the flag into _is_new_session, consume it immediately so it does not leak onto subsequent messages.
  • tests/gateway/test_fresh_reset_skill_injection.py: 9 regression tests covering flag stamping, the core updated_at bump regression, flag consumption, vanilla-session non-interference, idle-reset non-interference, and persistence round-trip.
  • scripts/release.py: AUTHOR_MAP entries for warabe1122 and willy-scr (Co-authored-by credits).

Validation

Before After
/reset then message in bound topic skill skipped skill loaded
/reset then message in vanilla chat normal normal
Idle auto-reset "session expired" notice fires unchanged
Manual /reset no misleading "inactivity" notice
tests/gateway/test_fresh_reset_skill_injection.py 9/9
tests/gateway/test_session_reset_notify.py + sibling 47/47 47/47

Credit

Design and initial implementation by @ygd58 (#6521, #10856). Independent regression tests and diagnosis by @warabe1122 (#10839). Latest rebase/simpler patch attempt by @willy-scr (#17096).

reset_session() creates a fresh SessionEntry with created_at == updated_at,
but get_or_create_session() bumps updated_at on the next inbound message,
causing _is_new_session in _handle_message_with_agent to evaluate False.
The topic/channel skill auto-load gate (group_topics, channel_skill_bindings)
silently skips the first message after a manual reset.

Add an is_fresh_reset flag on SessionEntry, set by reset_session() and
consumed once by the message handler. Kept distinct from was_auto_reset
because that flag also drives a 'session expired due to inactivity'
user-facing notice and a context-note prepend — both wrong for an
explicit /new or /reset.

Persisted through to_dict/from_dict so the flag survives gateway
restart between /reset and the next message.

Fixes #6508

Co-authored-by: warabe1122 <45554392+warabe1122@users.noreply.github.com>
Co-authored-by: willy-scr <187001140+willy-scr@users.noreply.github.com>
@teknium1 teknium1 merged commit fa9fd26 into main May 1, 2026
6 of 10 checks passed
@teknium1 teknium1 deleted the hermes/hermes-191404c2 branch May 1, 2026 03:29
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels May 1, 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 P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Topic-bound skill not re-injected after /new session reset

3 participants