Skip to content

hey compose: idempotency key so a rerun does not send twice #477

Description

@heredia21

Context

A send script's only record that a message left is local. If that record is missing, or two workers compose the same recipient and subject, hey compose creates another message. There is no server-side key the CLI can pass to make the second call a no-op.

#469 (a sent listing) is the read-side check. This is the write-side guarantee, including the race where both callers search before either send exists.

No account-specific details below.

Ask

  • hey compose --idempotency-key <string> (and the same field on each hey bulk-compose row).
  • The same key, same account, and same resolved sender returns the original send instead of creating another: same thread id, envelope, and timestamp, with a flag such as replayed: true.
  • A different body or recipient with a reused key fails with a structured conflict, rather than sending.
  • Keys are remembered long enough to cover a retry of the same batch (at least 24 hours).

Why it matters

Rerunning a batch after a crash, or running it twice, should be safe. A local log is not a substitute for the server refusing the duplicate.

Related: #468, #469.

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