Skip to content

Relaycast agent-events HTTP endpoint has no server-side idempotency key, so hosted agent_exited delivery is at-least-once not exactly-once #1752

Description

@khaliqgant

Follow-up from PR #1750 review (issue #1603).

The broker's hosted agent_exited durable outbox (crates/broker/src/runtime/event_loop.rs) now carries a deterministic dedupe_key (agent_name::generation) into the JSON payload it POSTs to Relaycast's /v1/agents/:name/events endpoint, and only marks its own on-disk crash record Delivered after that HTTP call is confirmed successful (with a small bounded in-process retry on timeout/5xx, and full broker-restart replay as the fallback for anything that outlives those retries).

That gives the client a stable idempotency key a consumer could use to discard a duplicate, but EmitSessionEventRequest (the external Relaycast SDK request type consumed via RelayCast::emit_agent_event, out of this repo) has no idempotency-key parameter, and Relaycast's HTTP API has no documented server-side dedupe behavior keyed on any field in the payload today.

This means:

  • A broker restart can legitimately replay an already-delivered exit (if the success write raced a crash) and Relaycast will durably record it twice, since nothing on the server discards it.
  • Any hosted consumer reading Relaycast's agent-event log must dedupe using payload.dedupe_key itself; the delivery guarantee is at-least-once, not exactly-once, until Relaycast's API gains real server-side idempotency.

Ask: either (a) extend the Relaycast HTTP API / SDK request type to accept and honor an idempotency key on POST /v1/agents/:name/events, or (b) explicitly document today's at-least-once contract for hosted agent_exited consumers so none of them assume exactly-once today.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions