fix(ipc): solve multi-channel collision and agent staleness #533
Closed
gabi-simons wants to merge 5 commits intoqwibitai:mainfrom
Closed
fix(ipc): solve multi-channel collision and agent staleness #533gabi-simons wants to merge 5 commits intoqwibitai:mainfrom
gabi-simons wants to merge 5 commits intoqwibitai:mainfrom
Conversation
- Introduced ChannelRegistry for dynamic channel loading - Decoupled WhatsApp from core index.ts and config.ts - Updated setup wizard to support ENABLED_CHANNELS selection - Refactored IPC and group registration to be channel-aware - Verified with 359 passing tests and clean typecheck
- Tagged IPC messages and close sentinels with chatJid - Implemented JID-based filtering in agent-runner - Added per-JID close sentinels to prevent cross-channel kills - Forced agent-runner src sync on every container start - Updated tests to match new sentinel pattern - Verified 369/369 tests pass
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.
Type of Change
.claude/skills/Description
This PR builds on the modular channel architecture by implementing the necessary database migrations and fixing critical IPC routing issues discovered during multi-channel testing .
Key Changes
Folder Constraint Removal: Removed the UNIQUE constraint on the folder column in registered_groups. This allows multiple JIDs (e.g., WhatsApp, Telegram, Discord) to share the same agent session/folder.
Channel Column: Added a channel column to the database to track the platform origin of each registered JID.
Automatic Migration: Implemented migrateRegisteredGroupsSchema to handle existing databases, ensuring a smooth upgrade path for current users.
Fixed the "cross-routing" bug where messages from one channel received replies on another when sharing a folder.
JID-Tagged IPC: Every IPC message now carries a chatJid field. Containers filter incoming files and only consume messages addressed to them.
Isolated Sentinels: Replaced the global _close sentinel with JID-specific files (_close.{safeJid}) to prevent one channel's idle timeout from killing sibling containers in the same folder.
Auto-Sync Logic: Updated container-runner.ts to sync the agent-runner source on every container start, ensuring protocol fixes reach existing group sessions immediately.
Known Limitations & Technical Debt
Resource Overhead: Currently, each channel on a shared folder still runs its own Docker container. This ensures complete isolation but consumes more memory/CPU than a single multiplexed container.
Future Optimization: We have identified Approach C (Folder-aware Queue) as the long-term architectural goal to reduce resource usage, but it remains deferred to avoid breaking changes in the MCP response routing layer.