astrid-runtime/astrid · error

own agent.v1.* event delivered (subtree match)

Error message

own agent.v1.* event delivered (subtree match)

What it means

This is a test assertion panic in the gateway stream feed test: the test subscribes a feed and waits up to 2 seconds for an event on the `agent.v1.*` topic subtree, but none was delivered. The `expect` message fires when `feed_rx.recv` returns `None` (channel closed) or times out before a matching event arrives. It guards the invariant that the feed delivers the process's own agent events via subtree topic matching.

Solutions

  1. Check that the feed subscription uses subtree/prefix matching for `agent.v1.*`, not exact topic equality.
  2. Verify the test actually publishes a delta with topic `agent.v1.stream.delta` before calling recv.
  3. Confirm the event carries the expected principal (`Some(me)`); a principal-scoped feed filter may drop it.
  4. Increase the recv timeout if failures only occur on slow CI runners.

Example fix

// before
let event = feed_rx.recv(Some(Duration::from_secs(2))).await.expect("own agent.v1.* event delivered (subtree match)");
// after
let event = feed_rx
    .recv(Some(Duration::from_secs(5)))
    .await
    .unwrap_or_else(|| panic!("no agent.v1.* event within timeout; topic sent: {sent_topic:?}"));
Defensive patterns

Strategy: validation

Validate before calling

// Rust (test): verify the subscription filter covers the topic before waiting
assert!(subtree_matches("agent.v1.*", "agent.v1.stream.delta"), "topic must be within agent.v1 subtree");

Type guard

fn as_ipc(event: &AstridEvent) -> Option<&IpcMessage> {
    if let AstridEvent::Ipc { message, .. } = event { Some(message) } else { None }
}

Prevention

When it happens

Trigger: Calling `feed_rx.recv(Some(Duration::from_secs(2)))` in `scoped_feed_delivers_own_agent_events` when no `AstridEvent::Ipc` message with topic `agent.v1.stream.delta` was published to the feed within the 2s timeout, or the feed channel closed without delivering.

Common situations: A regression in the feed's topic-subtree subscription filter (e.g. exact-match instead of `agent.v1.*` prefix match), the delta event published under a different topic, the publishing side never emitting the chunk, or an overloaded/slow CI machine exceeding the 2s timeout.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/0fbf0b311ee15ff5. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-gateway/src/routes/stream.rs:365

        let me = "alice";
        let mut feed_rx = bus.subscribe_topic_routed_scoped(
            Uuid::new_v4(),
            TOPIC_AGENT_EVENTS,
            "gateway",
            "gateway::agent_stream",
            Some(Some(me.to_string())),
        );

        bus.publish(ipc_event(
            "agent.v1.stream.delta",
            me,
            serde_json::json!({ "text": "chunk" }),
        ));

        let event = feed_rx
            .recv(Some(Duration::from_secs(2)))
            .await
            .expect("own agent.v1.* event delivered (subtree match)");
        let AstridEvent::Ipc { message, .. } = &*event else {
            panic!("expected IPC");
        };
        assert_eq!(message.topic, "agent.v1.stream.delta");
        assert_eq!(message.principal.as_deref(), Some(me));
    }
}

View on GitHub (pinned to affd8760f4)