fix(telegram): classify inbound events from the canonical mention decision so direct mentions stop lurking#99866
Merged
Merged
Conversation
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.
Closes #99854
What Problem This Solves
Fixes an issue where a group agent with
unmentionedInbound: room_eventandmessage_tool_onlydelivery would compose answers to direct @-mentions but never post them: every inbound turn — including explicit mentions — was classifiedroom_event, so the model received the lurk directive ("default: no reply; your final text stays private") on every turn and the strongmessage(action=send)delivery hint never fired. Users tagging the bot saw silence while[source-reply/private-final]warnings accumulated.Why This Change Was Made
Two "was the bot addressed" facts were computed independently and diverged: the body layer's mention decision fed the prompt context (
ExplicitlyMentionedBot: true), while the session layer re-classified the event kind from separately-copied mention booleans and producedroom_eventfor the same message. The fix computesinboundEventKindonce inresolveTelegramInboundBody, immediately beside the mention decision and from the sameeffectiveWasMentionedfact, and carries it forward; the session layer's duplicate classifier wiring is deleted. The contradictory state is now unrepresentable by construction (per the repo rule that hot paths carry prepared facts forward rather than rediscovering them).User Impact
Tagging the bot (or replying to it) in a group now reliably classifies as a user request, so the strong delivery hint fires and the agent posts visibly via
message(action=send). Unmentioned group chatter still lurks as room events — no regression to selective-speech behavior.Evidence
expected 'room_event' to be 'user_request'; green after. Coverage: explicit @-mention →user_request; unmentioned chatter →room_event; reply-to-bot →user_request.git diff --checkclean; re-verified after rebase onto current main.