Skip to content

Batch desktop notifications and task sources through the event queues #8150

Open

Description

@senamakel

Parent: #8147

Summary

Route desktop notifications and task sources through tinyeventqueues on a scheduled cadence, so a notification storm becomes a few batched turns rather than one triage per notification.

Problem

desktop/notifications/ triages each notification individually and in memory. Notifications are the noisiest input we have; they need batching, habituation (repeated near-identical notifications decay) and a budget, which the pipeline already provides.

Solution

  • Ingest notifications with source = notification:<app>, defaulting to a scheduled cadence (e.g. every(10m)) with an ingestion budget; overflow folds into the digest lane.
  • Salience can promote an urgent notification to instant.
  • Same for task sources that currently push straight into triage.

Acceptance criteria

  • Batched — regression test with a fake clock: 1,000 notifications in one window produce at most the configured budget of turns per tick, the rest folded into the next tick or the digest.
  • Promotion — an urgent notification is delivered without waiting for the tick.
  • No silent loss — every notification ends delivered / context / digest / dead / dropped-with-reason, visible in inbound.stats.
  • 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)

There are two direct triage callers. Each drops a Deferred with only a log line:

  • Notifications: crates/openhuman-core/src/desktop/notifications/rpc.rs:38 handle_ingest. It persists via store::insert_if_not_recent (60 s content dedupe, L70), spawns triage (L92), calls run_triage (L112) and apply_decision (L187), and drops a Deferred at L217-231.
  • Task sources: integrations/task_sources/route.rs:84,93 (route_enriched, called from task_sources/pipeline.rs:189). It has a per-source (source, external_id, content_hash) ledger (task_sources/store.rs:176).

Other direct callers: skills/webhooks/ops.rs:159,174 (trigger_agent RPC) and agent_runs/schemas.rs:423,438 (triage_evaluate RPC, an explicit evaluation, so it stays direct).

Open PR #8113 touches the task-source dedupe ledger; land it first or fold it in.

Agent brief

Depends on: senamakel#514, senamakel/tinyeventqueues#4 · Blocks: senamakel#515 · Parallel with: #8148, #8149, #8151

Research first

Files to consider

  • Read: crates/openhuman-core/src/desktop/notifications/rpc.rs:38-235, desktop/notifications/store_documents.rs:56,197-330, integrations/task_sources/route.rs:60-110, task_sources/pipeline.rs:150-200
  • Change: those callers (ingest via inbound::route), inbound/events.rs (notification: and task: envelopes), the handlers in inbound/deliver/
  • Tests: desktop/notifications/*_tests.rs, integrations/task_sources/*_tests.rs

Workflow: implementing-an-epic step.

Subagents: tdd-implementer (Sonnet), then code-reviewer.

Gates: cargo check --manifest-path Cargo.toml · pnpm rust:clippy · cargo test -p openhuman notifications task_sources inbound · pnpm rust:layout

Activity

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

    @M3gA-Mind
    Collaborator

    Re-checked on current main: not done yet. Each desktop notification is still triaged on its own (desktop/notifications/rpc.rs), and there's no notification: source on the event queues. 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

    featurenotificationsrust-coresubtask

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions