Skip to content

feat(channels): canonicalize conversation bindings - #39

Merged
Lingbou merged 1 commit into
mainfrom
codex/channel-conversation-keys
Jul 7, 2026
Merged

feat(channels): canonicalize conversation bindings#39
Lingbou merged 1 commit into
mainfrom
codex/channel-conversation-keys

Conversation

@AllenReder

Copy link
Copy Markdown
Owner

Summary

Canonicalizes channel conversation_key generation through a host-owned runtime helper and updates channel adapters to use route keys for Telegram, Slack, Mattermost, Matrix, Email, and Webhook fallback conversations.

This is an intentional breaking change for existing durable channel bindings: old key shapes such as telegram:123 are not migrated or looked up. Existing external conversations start fresh unless the operator explicitly resumes the intended session.

Behavior Changes

  • Telegram private chats now bind as telegram:dm:<chat_id>; non-private chats bind as telegram:group:<chat_id> without topic routing.
  • Slack and Mattermost channel messages bind to channel-level keys, while explicit thread roots bind to :thread:<id> route keys.
  • Matrix, Email, and Webhook fallback keys are canonicalized and URL-encode route ids; explicit Webhook conversation_key values still win.
  • Channel /resume now persists the current external conversation binding to the resumed session, so the next inbound message in that conversation continues in the resumed transcript.

Documentation

  • README or docs updated for user-facing behavior, CLI/configuration, runtime layout, provider behavior, security policy, package behavior, state/versioning behavior, or test/gate workflow changes.
  • Documentation update is not needed because:

Updated developer delivery/context docs and the channel configuration how-to, including the zh-CN site mirror.

Verification

List the commands you ran and the result.

uv run pytest tests/runtime/test_session_routing.py tests/runtime/test_session_commands.py tests/runtime/test_sessions_context.py tests/channels
# 188 passed

uv run python -m compileall demiurge/runtime demiurge/channels tests/runtime tests/channels
# passed

git diff --check -- demiurge/channels demiurge/runtime tests/channels tests/runtime docs/developer-guide/delivery-runtime.md docs/developer-guide/runner-and-context.md docs/how-to/configure-channels.md website/i18n/zh-CN/docusaurus-plugin-content-docs/current/developer-guide/delivery-runtime.md website/i18n/zh-CN/docusaurus-plugin-content-docs/current/developer-guide/runner-and-context.md website/i18n/zh-CN/docusaurus-plugin-content-docs/current/how-to/configure-channels.md
# passed

Change Checklist

  • The PR is scoped to one feature, fix, cleanup, or documentation pass.
  • Dependencies were not added or changed, or the dependency impact is explained above.
  • Breaking changes are absent, or they are called out in the summary.
  • Secrets, API keys, tokens, and private local paths are not included.
  • Generated assets are updated when source assets changed.

Introduce a host-owned canonical conversation key helper and switch gateway channels to use explicit channel scopes and encoded platform ids. Channel /resume now rebinds the current external conversation to the resumed session using the existing session.binding.rebound projection.

Validation: uv run pytest tests/runtime/test_session_routing.py tests/runtime/test_session_commands.py tests/runtime/test_sessions_context.py tests/channels; uv run python -m compileall demiurge/runtime demiurge/channels tests/runtime tests/channels
Copilot AI review requested due to automatic review settings July 7, 2026 08:25
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Lingbou
Lingbou merged commit 963f381 into main Jul 7, 2026
12 checks passed
@Lingbou
Lingbou deleted the codex/channel-conversation-keys branch July 7, 2026 08:36
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.

3 participants