-
-
Notifications
You must be signed in to change notification settings - Fork 82.1k
Direct @-mentions classified as room_event: mention fact diverges between classifier and prompt context, agent lurks instead of replying #99854
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingchannel: telegramChannel integration: telegramChannel integration: telegramclawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maintainerMaintainer-authored PRMaintainer-authored PR
Description
Activity
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingchannel: telegramChannel integration: telegramChannel integration: telegramclawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maintainerMaintainer-authored PRMaintainer-authored PR
Type
Fields
Priority
None yet
What happened
On a production Telegram group deployment (
message_tool_only, always-on group activation, ambient/isolated polling ingress), the agent frequently composes a full answer to a direct @-mention but never callsmessage(action=send), so the user sees silence. Log signature per occurrence:[source-reply/private-final] agent produced a long private final reply without calling the configured delivery tool.Root cause
The per-turn delivery directive branches on
inboundEventKind(src/auto-reply/reply/prompt-prelude.ts,resolvePerTurnDeliveryDirective):user_request+message_tool_only→ strong hint (MESSAGE_TOOL_ONLY_DELIVERY_HINT,src/plugin-sdk/message-tool-delivery-hints.ts): deliver viamessage(action=send).room_event+message_tool_only→ lurk directive: "Default: no reply; most room events need no response… your final text here stays private either way."Production transcripts show every inbound turn classified
room_event—user_requestcount is zero across sessions (256:0, 73:0), including turns whose prompt context simultaneously carriedExplicitlyMentionedBot: truefor the same message. The model is told "you probably shouldn't respond visibly" on every turn, including direct mentions; a private final is it obeying.The classification chain is individually correct:
src/channels/inbound-event/classification.ts(classifyChannelInboundEvent):wasMentioned === true→user_request. Correct.src/channels/mention-gating.ts(resolveMentionDecisionCore):effectiveWasMentioned = wasMentioned || implicitMention || bypass. Correct.extensions/telegram/src/bot-message-context.session.ts:441passeseffectiveWasMentionedinto the classifier. Correct.So the defect is in the wiring for this deployment shape: the mention fact that reaches the classifier disagrees with the mention fact that reaches the prompt (
ExplicitlyMentionedBot). Two independently computed "was the bot addressed" facts diverge across the ambient/isolated-ingress path. This violates the repo rule that hot paths carry prepared facts forward instead of rediscovering them.Expected
ExplicitlyMentionedBot: trueandinboundEventKind: room_eventmust be impossible for the same message.user_request, so the strongmessage_tool_onlydelivery hint fires and the agent reliably posts viamessage(action=send).Fix shape
inboundEventKindis stamped (or defaulted) without the mention-gating facts — that divergence is the bug. Unify: classification input andExplicitlyMentionedBotmust derive from the same mention decision.room_eventlurk directive when the resolved fact says directly-addressed (belt-and-suspenders), but the primary fix is classification.inboundEventKind: user_requestand the strong delivery hint present; unmentioned group chatter →room_eventand lurk directive.Environment
main @ d0b84a9, Telegram group,
unmentionedInbound: room_eventpolicy, message_tool_only delivery, claude-cli backend.