Skip to content
Documentation menu: Exactly-once publishing

Exactly-once publishing

Publishing a post twice is worse than pausing to ask. Honeloop separates timing from state arbitration and refuses to repeat any provider call whose outcome is uncertain.

The never-publish-again rule (recreate: false)

When posts.status reports a rendition error withrecreate: false — specificallypublish_state_unknownorpublished_with_error— the post may already be live on the social network. Neither Honeloop nor your agent may retry, duplicate or schedule that post again. Tell a human operator to check the channel directly.

Idempotency keys on every mutation#

Stage 5 of the policy gate enforces Idempotency-Key across all actand irreversible capabilities:

  • Required: posts.schedule and posts.publish_now(8 to 128 printable ASCII chars), approvals.decide,channels.disconnect and agent.run_now refuse calls without anIdempotency-Key with HTTP 400idempotency_key_required.
  • Optional (recommended): Other act calls such asposts.create and posts.update accept anIdempotency-Key (1 to 255 printable ASCII chars). @honeloop/sdkauto-generates a UUIDv7 once per logical call and reuses it across transport retries.
  • 24-hour canonical replay: Scoped to (org_id, capability, key)and fingerprinted with SHA-256 over canonicalised validated input. Replaying the same key and payload within 24 hours returns the stored 200 or 202 response verbatim withIdempotency-Replayed: true.
  • Mismatch and error release: Reusing a key with a different payload fails with HTTP 409 idempotency_mismatch. A call that fails before committing releases its claim so a corrected retry with the same key re-executes.

How the publishing pipeline prevents duplicates#

  1. Self-contained PublishIntent: At schedule or approval time, the kernel builds an immutable intent carrying parts, media checksums, settings and a SHA-256 intent_fingerprint. Workflows never re-read mutable post rows for content.
  2. Deterministic workflow ID: Each post maps to one Temporal workflow ID,publish:<post_id>, started with conflict policy FAIL (never terminate-and-restart).
  3. Atomic Postgres gate claim: When the durable timer fires, the worker executes an atomic conditional update transitioning scheduled topublishing only when both the state and intent_fingerprint match. If a cancel or reschedule raced ahead, Postgres wins and the workflow exitsskipped.
  4. Publication deduplication: Each published part inserts a row keyed by unique (rendition_id, part_index) before the activity returns to Temporal.
  5. Replay-safe cross-post links, auto-shortlinks and thread delays: Parts may include (post:<uuid>) placeholders referencing another post in the same organisation, plus per-part thread delays up to 24 hours (preserved across recurring series). When placeholders are present (behind publish-005-crosspost-urls), the workflow runs read-only resolveCrossPostUrls on the control queue immediately before publishPart to substitute each live publication URL. When an organisation enables Auto-Shorten-on-Publish (auto_shortlink_mode = "always"),autoShortenUrlsForPublish runs on control behindpublish-006-auto-shortlinks immediately before publishPart. Neither hook mutates stored post rows, breaks Temporal replay determinism or relaxes the single-attempt publish rule.
  6. Deduplicated auto-engagement plugs: Enabled channel_plugsrules (across X, LinkedIn, LinkedIn Pages, Threads and Bluesky) are evaluated every 10 minutes by plugsEvaluateWorkflow on control, which claims a unique(org_id, idempotency_key) row in plug_executions before dispatching native reply or repost actions strictly through publishWorkflowand publishPart — preserving zero-duplicate engagement and closed provider queues.

Single-attempt mutating calls and the certainty rule#

Provider activities that mutate a platform (publishPart andfinalizePart) run with maximumAttempts: 1. Honeloop retries a part inside the workflow only when the provider throws a typed error proving the platform definitively rejected or did not accept the request:

Provider outcomePipeline actionTerminal rendition errorrecreate
Typed Retryable (e.g. HTTP 429 or confirmed 503)Durable workflow sleep (platform Retry-After clamped 1 to 300 s, or 2, 4, 8, 16 s backoff), up to 5 total calls.platform_unavailable if exhaustedtrue
Typed RefreshNeededAcquires per-channel advisory lock, refreshes OAuth token (up to 5 cycles), retries part with fresh credential.channel_needs_reauth if refresh refusedtrue
Typed BadContentStops immediately; no retry.platform_rejectedtrue
Typed ChannelRevokedMarks channel needs_reauth; stops immediately.channel_needs_reauthtrue
Timeout, network drop, untyped error or exhausted pending waitStops immediately. Never retried by Temporal or the reconciliation sweep.publish_state_unknownfalse
Typed PublishedWithErrorRecords live platform_post_id and url; stops immediately.published_with_errorfalse

Handling failed renditions safely#

A failed post is terminal and never returns to scheduled orpublishing. On a multi-channel post, if any rendition fails, the post folds tostate: "failed" while successful renditions keep their published URLs.

  • When recreate: true: fix the underlying cause (edit content for platform_rejected, reconnect channel for channel_needs_reauth) and create a new draft targeting only the failed channels.
  • When recreate: false (or missing): stop and hand off to a human with the channel_id and any recorded url orplatform_post_id. Both the web application and MCPget_post_status fail closed on missing or unknown flags.

posts.status rendition with recreate: false

{
  "post_id": "0197e3b4-6f1a-7c2e-9d41-5b8e0a3c7f10",
  "state": "failed",
  "version": 4,
  "scheduled_at": "2026-11-26T09:30:00.000Z",
  "renditions": [
    {
      "channel_id": "0197e3a0-0000-7000-8000-0000000000a5",
      "state": "failed",
      "awaiting_platform": false,
      "error": {
        "code": "publish_state_unknown",
        "message": "The platform did not confirm this part before the call timed out.",
        "recreate": false
      }
    }
  ]
}

Fail-closed check for client and agent code

// Fail closed on any rendition whose outcome is not guaranteed uncreated.
function canSafelyRecreate(rendition) {
  if (rendition.state === "failed" && rendition.error && rendition.error.recreate === true) {
    const blocked =
      rendition.error.code === "publish_state_unknown" ||
      rendition.error.code === "published_with_error";
    return blocked ? false : true;
  }
  return false;
}