Skip to content

Route native channel messages through the event queues #8149

Open

Description

@senamakel

Parent: #8147

Summary

Route native channel messages through tinyeventqueues instead of the in-memory mpsc::channel(100), so a restart or a full channel no longer loses inbound messages.

Problem

Native channels feed ChannelHostCallbacks::deliver_inbound (channels/runtime/startup/callback.rs, ~L67) into a bounded mpsc::channel(100) (channels/runtime/startup/start_channels.rs, ~L164). Anything in flight is lost on restart, and a burst beyond 100 back-pressures or drops. Nothing is triaged.

Solution

  • deliver_inbound ingests into the queues via inbound::route and returns only after the durable write, so the platform ack / poll cursor advance follows persistence.
  • Replace the mpsc dispatcher with the module's Deliver callback; keep it as the direct path when the queues are unavailable.
  • Same envelope rules as hosted channels (dedupe on platform message id; group chatter as context).

Acceptance criteria

  • Restart-safe — regression test: core stopped with pending native messages; after restart they are delivered exactly once as turns.
  • Burst-safe — more than 100 messages in a burst are all accounted for (delivered / context / dropped-with-reason), none silently lost.
  • Ack after persist — the channel's ack/cursor advances only after Ingest returns.
  • Fallback intact — with the component off, the current path still works.
  • Diff coverage ≥ 80% — the implementing PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by .github/workflows/ci-fast.yml).

Related

Part of #8147. Builds on #8136 (inbound domain, tinyeventqueues v0.1.2) and tinyhumansai/tinyeventqueues#6.

Audit findings (2026-10-20)

Agent brief

Depends on: senamakel#514, senamakel/tinychannels#84, senamakel/tinyeventqueues#2 · Blocks: #8152, senamakel#515 · Parallel with: #8148, #8150, #8151

Research first

Files to consider

  • Read: crates/openhuman-core/src/channels/runtime/startup/callback.rs:60-100, startup/start_channels.rs:150-310, dispatch/processor.rs:80-105, dispatch/processor/turn.rs
  • Change: startup/callback.rs (ingest via inbound::route, return after the durable write), startup/start_channels.rs (the mpsc becomes the direct path only), the channel: handler in inbound/deliver/, the vendor/tinychannels gitlink
  • Tests: channels/runtime/startup_tests.rs, dispatch/*_tests.rs

Workflow: implementing-an-epic step.

Subagents: tdd-implementer (Sonnet), merge-conflict-resolver if #8130 lands first, then code-reviewer.

Gates: cargo check --manifest-path Cargo.toml · pnpm rust:clippy · cargo test -p openhuman channels::runtime inbound · pnpm rust:layout · node scripts/modules/pin-status.mjs

Activity

  1. added
    subtask
    feature
    rust-core
    channels
    on Oct 20, 2026
  2. M3gA-Mind commented on Nov 16, 2026

    @M3gA-Mind
    Collaborator

    Re-checked on current main: not done yet. deliver_inbound still feeds a bounded in-memory mpsc::channel(100), so in-flight messages are still lost on a restart. A keyed debouncer was added on this path (#8130), but it's in memory too. Keeping this open as part of #8147.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    channelsfeaturerust-coresubtask

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions