fix: cross-channel message routing isolation#732
Open
f-liva wants to merge 10 commits intoRightNow-AI:mainfrom
Open
fix: cross-channel message routing isolation#732f-liva wants to merge 10 commits intoRightNow-AI:mainfrom
f-liva wants to merge 10 commits intoRightNow-AI:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ce, identity Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ipeline Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace commit SHA and run link with the commit message subject for cleaner, more informative notifications. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The previous rebuild accidentally locked Cargo.toml at 0.4.4. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Integrate TypingEvent into MessageDebouncer to pause flush timers while users are still composing, preventing premature dispatch when sending text + images in rapid succession. - Increase default debounce_ms from 3000 to 5000 for image uploads - Add on_typing() to MessageDebouncer: pauses timer on is_typing=true, restarts on is_typing=false, safety cap always enforced - Add typing_events() to ChannelAdapter trait (optional, default None) - Wire typing event stream into start_adapter() select loop - Telegram: add typing_tx/rx infrastructure, detect chat_action updates, auto-expire typing after 6s, emit is_typing=false on message arrival - WhatsApp: add TODO for Baileys presence.update integration - Add 4 unit tests for debouncer typing behavior - Add 2 Telegram typing event tests - Fix ChannelBridgeHandle mock for send_message_with_context Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix two related bugs causing agents to confuse conversations across
different channels (e.g. responding in a WhatsApp group with a message
meant for a private Telegram chat):
1. Missing ChannelContext on image retry path: dispatch_with_blocks()
called send_message_with_blocks() without channel context on agent
re-resolution, losing channel_type/sender_id/sender_name. The text
path (dispatch_message) already handled this correctly.
2. No per-channel message tagging in shared session: the canonical
session merges all channels into one context by design, but Message
structs carry no channel/sender metadata. Added tag_message_with_origin()
to prefix user messages with [via {channel}, from {sender}] so the
LLM can distinguish conversations from different channels/users.
Closes RightNow-AI#731
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jaberjaber23
requested changes
Mar 19, 2026
Member
jaberjaber23
left a comment
There was a problem hiding this comment.
This PR bundles too many unrelated changes and has critical issues. Please split into separate PRs.
Critical issues found:
- WhatsApp sendMessage JID regression — group JIDs (@g.us) are stripped and replaced with @s.whatsapp.net, breaking all group sends.
- Removal of has_any_content() guard causes unnecessary LLM retries for Thinking-only responses.
- Hot-reload drops tool_allowlist/tool_blocklist change detection (security-relevant fields).
- owner_ids settable via unauthenticated PATCH — anyone can change who gets "full access" verdicts.
- Removal of load_dotenv_files() from desktop app breaks API key loading.
- Removal of MCP env var resolution from vault breaks MCP subprocess credentials.
- WhatsApp adapter removes error checking on API responses — failed calls silently succeed.
- Hardcoded Italian strings in core runtime (invia, manda, al signore) — not appropriate for a language-agnostic agent OS.
- Default 5s debounce for ALL channels adds latency to every interaction.
- Hardcoded /tmp path instead of std::env::temp_dir().
Should be split into: (1) routing fix, (2) debouncer, (3) owner verification, (4) WhatsApp gateway, (5) Docker/CI — and each reviewed separately.
4 tasks
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
ChannelContexton image retry path indispatch_with_blocks(): the re-resolution path calledsend_message_with_blocks()without channel context, losing channel_type/sender_id/sender_name. Now usessend_message_with_blocks_and_context(), matching the text path.[via {channel}, from {sender}]so the LLM can distinguish conversations from different channels/users in the shared canonical session. Applied to both streaming and non-streaming kernel paths.Closes #731
Test plan
cargo build --workspace --libcompilescargo test -p openfang-channelspasses (9/9)cargo test -p openfang-runtime -- prompt_builderpasses (38/38)[via whatsapp, from X]/[via telegram, from Y]tags on user messages🤖 Generated with Claude Code