Skip to content

Extract channel dispatch#4

Open
PAY2109 wants to merge 3 commits into
mainfrom
feature/extract-channel-dispatch
Open

Extract channel dispatch#4
PAY2109 wants to merge 3 commits into
mainfrom
feature/extract-channel-dispatch

Conversation

@PAY2109

@PAY2109 PAY2109 commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Description

Extract communication-channel dispatch from src/channels.metta into lib_channels_ext.py, following the same direction already used for LLM provider dispatch.

This change:

  • moves channel startup / receive / send dispatch into a dedicated Python bridge
  • keeps src/channels.metta as a thin MeTTa facade
  • preserves the current runtime contract by supporting both legacy key=value argv config and environment-variable config
  • keeps backward-compatible channel parameter names such as IRC_channel, IRC_server, IRC_port, and IRC_user
  • adds explicit test -> mock channel mapping
  • removes direct channel adapter imports from lib_omegaclaw.metta to avoid split module state

Issue fixed:

  • channel selection logic was still hardcoded in MeTTa and had to be updated in multiple places for every channel change
  • the initial refactor direction risked breaking existing startup/config flows by reading only from environment variables

How Has This Been Tested?

Test scenarios used for the fix:

  1. Start/dispatch path still resolves the configured channel through the new bridge instead of the old MeTTa if chain.
  2. Legacy startup config is preserved:
    • IRC_channel=...
    • IRC_server=...
    • IRC_port=...
    • IRC_user=...
    • TG_BOT_TOKEN=...
    • SL_BOT_TOKEN=...
    • WS_URL=...
    • TEST_SERVER_IP=...
  3. Environment variables still work and take precedence over legacy argv-style config when both are present.
  4. commchannel=test resolves explicitly to the mock channel.
  5. Unknown channel names fail loudly instead of silently falling back.
  6. Python syntax check passed for the bridge and channel adapter modules.
  7. Targeted stub-based verification passed for:
    • config resolution from argv
    • env override behavior
    • IRC dispatch argument wiring
    • test -> mock mapping

Checklist

  • The code generated by LLM is reviewed by the PR creator
  • Self-review completed
  • Test scenarios above are passed with the version of the code from PR

@PAY2109 PAY2109 requested a review from sassless May 27, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant