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.scheduleandposts.publish_now(8 to 128 printable ASCII chars),approvals.decide,channels.disconnectandagent.run_nowrefuse calls without anIdempotency-Keywith HTTP 400idempotency_key_required. - Optional (recommended): Other
actcalls such asposts.createandposts.updateaccept 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#
- Self-contained
PublishIntent: At schedule or approval time, the kernel builds an immutable intent carrying parts, media checksums, settings and a SHA-256intent_fingerprint. Workflows never re-read mutable post rows for content. - Deterministic workflow ID: Each post maps to one Temporal workflow ID,
publish:<post_id>, started with conflict policyFAIL(never terminate-and-restart). - Atomic Postgres gate claim: When the durable timer fires, the worker executes an atomic conditional update transitioning
scheduledtopublishingonly when both the state andintent_fingerprintmatch. If a cancel or reschedule raced ahead, Postgres wins and the workflow exitsskipped. - Publication deduplication: Each published part inserts a row keyed by unique
(rendition_id, part_index)before the activity returns to Temporal. - 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 (behindpublish-005-crosspost-urls), the workflow runs read-onlyresolveCrossPostUrlson thecontrolqueue immediately beforepublishPartto substitute each live publication URL. When an organisation enables Auto-Shorten-on-Publish (auto_shortlink_mode = "always"),autoShortenUrlsForPublishruns oncontrolbehindpublish-006-auto-shortlinksimmediately beforepublishPart. Neither hook mutates stored post rows, breaks Temporal replay determinism or relaxes the single-attempt publish rule. - Deduplicated auto-engagement plugs: Enabled
channel_plugsrules (across X, LinkedIn, LinkedIn Pages, Threads and Bluesky) are evaluated every 10 minutes byplugsEvaluateWorkflowoncontrol, which claims a unique(org_id, idempotency_key)row inplug_executionsbefore dispatching native reply or repost actions strictly throughpublishWorkflowandpublishPart— 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 outcome | Pipeline action | Terminal rendition error | recreate |
|---|---|---|---|
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 exhausted | true |
Typed RefreshNeeded | Acquires per-channel advisory lock, refreshes OAuth token (up to 5 cycles), retries part with fresh credential. | channel_needs_reauth if refresh refused | true |
Typed BadContent | Stops immediately; no retry. | platform_rejected | true |
Typed ChannelRevoked | Marks channel needs_reauth; stops immediately. | channel_needs_reauth | true |
| Timeout, network drop, untyped error or exhausted pending wait | Stops immediately. Never retried by Temporal or the reconciliation sweep. | publish_state_unknown | false |
Typed PublishedWithError | Records live platform_post_id and url; stops immediately. | published_with_error | false |
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 forplatform_rejected, reconnect channel forchannel_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 thechannel_idand any recordedurlorplatform_post_id. Both the web application and MCPget_post_statusfail 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;
}