fix(gateway): re-inject topic-bound skill after /new or /reset#18205
Merged
Conversation
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>
This was referenced May 1, 2026
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Topic/channel skills (
group_topics,channel_skill_bindings) now re-inject on the first message after a manual/newor/reset.Root cause:
reset_session()creates a freshSessionEntrywithcreated_at == updated_at, butget_or_create_session()bumpsupdated_aton the next inbound message. The_is_new_sessioncheck in_handle_message_with_agentevaluates False → skill auto-load is silently skipped.Fix: Add an
is_fresh_resetflag onSessionEntry, set byreset_session()and consumed once by the message handler. Kept distinct fromwas_auto_resetbecause 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_resetfield onSessionEntry, set inreset_session(), persisted throughto_dict/from_dictso it survives a gateway restart between/resetand 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 coreupdated_atbump regression, flag consumption, vanilla-session non-interference, idle-reset non-interference, and persistence round-trip.scripts/release.py: AUTHOR_MAP entries forwarabe1122andwilly-scr(Co-authored-by credits).Validation
/resetthen message in bound topic/resetthen message in vanilla chat/resettests/gateway/test_fresh_reset_skill_injection.pytests/gateway/test_session_reset_notify.py+ siblingCredit
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).