test(session-hygiene): include user_id on the synthetic MessageEvent - #10907
Closed
luigileap wants to merge 1 commit into
Closed
test(session-hygiene): include user_id on the synthetic MessageEvent#10907luigileap wants to merge 1 commit into
luigileap wants to merge 1 commit into
Conversation
PR NousResearch#8280 (commit cac6178, "fix(gateway): propagate user identity through process watcher pipeline") added an early-return guard in `GatewayRunner._handle_message`: elif source.user_id is None: logger.debug("Ignoring message with no user_id from %s", ...) return None This catches Telegram service messages, channel forwards, and anonymous admin actions that previously triggered spurious pairing flows. `test_session_hygiene_messages_stay_in_originating_topic` built a `SessionSource` without `user_id`, so after the guard landed the handler returned `None` before reaching `_run_agent`, and the assertion `assert result == "ok"` failed. Set `user_id="795544298"` on the synthetic source — matching the same numeric user already used as `TELEGRAM_HOME_CHANNEL` elsewhere in the test — so the event looks like a normal authorised message and the handler runs the agent path the test is meant to cover.
Contributor
|
Thanks @luigileap! A |
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.
Problem
Root cause
PR #8280 (commit cac6178, "fix(gateway): propagate user identity
through process watcher pipeline") added an early-return guard at the
top of
GatewayRunner._handle_message:Real-world motivation: Telegram service messages, channel forwards, and
anonymous admin actions arrive without a
from_userand weretriggering spurious pairing flows with
user_id=None. The guard dropsthem before any auth or agent work happens.
test_session_hygiene_messages_stay_in_originating_topicbuilds asynthetic
MessageEventwhoseSessionSourcehaschat_id="-1001",thread_id="17585", and nouser_id. After the guard landed, thehandler returns
Nonebefore reaching the mocked_run_agent(whichreturns
"ok"), so the assertion fails.Fix
Set
user_id="795544298"on the syntheticSessionSource— the samenumeric user the test already uses as
TELEGRAM_HOME_CHANNEL. With avalid user_id the handler clears the guard and reaches the agent path
the test is meant to exercise (session-hygiene message stays in its
originating topic).
Verification