Skip to content

Event can be triaged twice when every queue ingest times out #8154

Closed

Description

@senamakel

Parent: #8147

Summary

When every attempt to ingest an event into the queues times out, the event can be triaged twice: once by the caller's direct path and once by the queues if the ingest actually landed. Record the dedupe key on the direct path so the queued copy is recognized and skipped.

Steps to reproduce

  1. Make Ingest slow enough that inbound::route times out on every attempt, while the write still completes in the module.
  2. Send one Composio trigger or webhook.
  3. route returns Direct (crates/openhuman-core/src/inbound/route.rs), the caller triages it directly, and the module later delivers the stored copy too.

Expected

One triage / at most one turn for the event.

Actual

Two triages; the second is logged but not prevented.

Solution

On the ambiguous-timeout fallback, record the event's dedupe key (source:event_id) as completed (tombstone) before or alongside running the direct path, and have Deliver skip an envelope whose key is already completed.

Acceptance criteria

  • Regression test — fails today: a timed-out-but-landed ingest produces two apply_decision calls; passes with the fix: exactly one.
  • No new loss — an ingest that genuinely failed is still handled by the direct path.
  • 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)

  • Where it happens: crates/openhuman-core/src/inbound/route.rs:122-130 returns Offered::Direct after three ambiguous attempts (deadlines 60 s, 10 s and 10 s at L54-58, with 500 ms pauses at L61). It warns "the queues may also deliver it".
  • Why the host can't catch the copy: the only host-side guard is an in-memory ring of 1,024 Accepted turn ids (inbound/deliver.rs:60, 285-295). A direct-path triage never enters it, so the queued copy is not recognized.

Agent brief

Depends on: none · Blocks: none · Parallel with: senamakel#514, #8155

Research first

  • Where to record the key so that it survives a restart: the queue's ingress tombstone (via a module member, which would be an upstream change) or a host document collection keyed source:event_id.

Files to consider

  • Read: crates/openhuman-core/src/inbound/route.rs:40-163, inbound/deliver.rs:54-123,280-300
  • Change: inbound/route.rs, inbound/deliver.rs
  • Tests: inbound/route_tests.rs, inbound/deliver_tests.rs

Workflow: implementing-an-epic step.

Subagents: systematic-debugger to reproduce the double triage, then tdd-implementer (Sonnet), then code-reviewer.

Gates: cargo check --manifest-path Cargo.toml · pnpm rust:clippy · cargo test -p openhuman inbound::route inbound::deliver

Activity

  1. added
    subtask
    rust-core
    on Oct 20, 2026
  2. self-assigned this
    on Nov 9, 2026
  3. moved this from Todo to In progress in Team Openhumanon Nov 11, 2026
  4. CodeGhost21 commented on Nov 11, 2026

    @CodeGhost21
    Member

    Picking this up: draft fix in #8667. The ambiguous-timeout fallback now claims the event (source:event_id) for the direct path and records it in a host collection, inbound.direct, so Deliver skips the queued copy, after a restart too. If the queues deliver first while the offer is still retrying, the direct path is skipped instead.

  5. moved this from In progress to Done in Team Openhumanon Nov 12, 2026
  6. added a commit that references this issue on Nov 12, 2026
    117397f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugrust-coresubtask

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions