Skip to content

fix(channels): ensure feature parity across all 7 channels (#1978)#2018

Merged
bug-ops merged 5 commits intomainfrom
epic-1978-channel-consistency
Mar 19, 2026
Merged

fix(channels): ensure feature parity across all 7 channels (#1978)#2018
bug-ops merged 5 commits intomainfrom
epic-1978-channel-consistency

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Mar 19, 2026

Summary

Resolves epic #1978: Channel Consistency and Feature Parity

This PR implements three fixes across all channel implementations:

  • CHAN-01 (High): AnyChannel now forwards all 16 Channel trait methods (previously 4 methods were missing: send_thinking_chunk, send_stop_hint, send_usage, send_tool_start)
  • CHAN-02 (Medium): Discord and Slack confirm() now timeout after 30s and deny (matches Telegram behavior). Remote channels no longer auto-approve destructive confirmations.
  • CHAN-05 (Low): Discord slash commands (/reset, /skills, /agent) registered at startup and are fully functional via new gateway INTERACTION_CREATE handler.

Changes

Phase 1: AnyChannel Method Forwarding

  • Added 4 missing method forwardings to both AnyChannel (any.rs) and AppChannel (src/channel.rs)
  • Added exhaustive channel method tests to prevent future method-forwarding gaps
  • No type changes, purely additive

Phase 2: Remote Channel Confirmations

  • Extracted CONFIRM_TIMEOUT constant (30s) to zeph-channels crate
  • Discord and Slack confirm() now timeout and deny on timeout
  • All fields use correct channel-specific names (Slack: .text, Discord: .content)

Phase 3: Discord Slash Commands

  • Discord gateway now handles INTERACTION_CREATE events (type 2)
  • Slash commands are ACKed with type 5 (DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE)
  • Commands are injected as text messages (/<command_name>) into the agent loop
  • Commands are registered at startup (idempotent via PUT endpoint)

Documentation & Specs

  • Updated .local/specs/007-channels/spec.md with complete feature matrix and findings
  • Updated CHANGELOG.md with [Unreleased] entry

Quality Gates

  • cargo +nightly fmt --check PASS
  • cargo clippy --workspace --all-features -- -D warnings PASS (0 warnings)
  • cargo nextest run --workspace --all-features --lib --bins PASS (5940 tests, +2 new timeout tests)

Validators

  • ✓ Tester: PASS (5940 tests, identified gaps for timeout branch coverage)
  • ✓ Security: PASS (one low suggestion for defense-in-depth)
  • ✓ Impl-critic: APPROVED (all findings resolved)
  • ✓ Reviewer: APPROVED (all standards, docs, coverage verified)

Deferred to Future PRs

  • CHAN-03: Attachment support for Discord/Slack/TUI (separate epic)
  • CHAN-06: Markdown rendering consistency (Slack mrkdwn, Discord markdown) (separate epic)

Notes

  • All changes are in zeph-channels crate (and zeph binary for AppChannel) — no changes to core agent logic
  • Backward compatible (all new methods are additions, no trait changes)
  • Deferred work tracked separately in related issues

bug-ops added 5 commits March 19, 2026 18:05
… AppChannel

AnyChannel and AppChannel were missing explicit forwardings for
send_thinking_chunk, send_stop_hint, send_usage, and send_tool_start.
These fell through to trait defaults (no-ops), silently dropping events
even when the underlying channel implements them.

Add forwarding for all 4 missing methods in both dispatchers using the
existing dispatch_channel! / dispatch_app_channel! macros. Add exhaustive
channel method tests in both any.rs and src/channel.rs to prevent future
drift. (CHAN-01, epic #1978)
…ract CONFIRM_TIMEOUT constant

Discord and Slack confirm() implementations previously blocked indefinitely
waiting for user input, diverging from the existing Telegram behavior (30s
timeout with deny-on-expiry).

Extract a shared CONFIRM_TIMEOUT constant (30s) to zeph-channels crate.
Update Telegram to reference it. Add 30s timeout to Discord and Slack
confirm() with warn-and-deny on expiry. Document the known limitation
that confirm() consumes the next message regardless of intent. (CHAN-02, epic #1978)
…pplications/{id}/commands

Discord slash commands (/reset, /skills, /agent) are now registered at
DiscordChannel startup using a fire-and-forget background task. The PUT
endpoint is idempotent — safe to call on every restart. If registration
fails, a warning is logged and the bot continues normally.

Note: Slack slash commands are configured via the Slack App Manifest and
cannot be registered via runtime API. A documentation comment explains this.
(CHAN-05, epic #1978)
…en confirm() tests

IMP-02: Discord slash commands now work end-to-end. The gateway handles
INTERACTION_CREATE events by parsing APPLICATION_COMMAND interactions (type 2),
ACKing them via POST /interactions/{id}/{token}/callback with type 5
(DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE) to prevent "This interaction failed",
and injecting the command as a /<name> text message into the existing rx
channel so the agent loop processes it uniformly.

IMP-01: Replace confirm() tests that bypassed the method entirely with:
- confirm_returns_err_without_active_channel: calls confirm() directly;
  verifies the method is invocable and propagates send() errors correctly
- confirm_timeout_logic_denies_on_timeout: uses tokio::time::pause() +
  advance() to verify the CONFIRM_TIMEOUT deadline logic in isolation

Full integration testing of confirm() (REST send + timeout) requires a
mock HTTP server and is deferred to live agent testing.
@github-actions github-actions bot added documentation Improvements or additions to documentation channels zeph-channels crate (Telegram) rust Rust code changes bug Something isn't working size/XL Extra large PR (500+ lines) labels Mar 19, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 19, 2026 17:27
@bug-ops bug-ops merged commit bf18949 into main Mar 19, 2026
22 checks passed
@bug-ops bug-ops deleted the epic-1978-channel-consistency branch March 19, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working channels zeph-channels crate (Telegram) documentation Improvements or additions to documentation rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

1 participant