Skip to content

TikTok Direct Post can duplicate posts after ambiguous retries #586

Description

@iamkiayun

Bug

TikTok Direct Post tasks can create more than one public post when a transient failure occurs after TikTok has accepted the publish request but before AiToEarn persists the returned publish_id.

Failure sequence

  1. AiToEarn calls TikTok's Direct Post initialization endpoint.
  2. TikTok creates the publish operation and returns a publish_id.
  3. The upload or local persistence path fails.
  4. The task is treated as retryable and returns to the publish queue.
  5. The retry initializes a second TikTok publish operation for the same task.

An ambiguous timeout during initialization has the same risk because the client cannot know whether TikTok accepted the request.

Expected behavior

  • Persist publish_id before any upload or follow-up work.
  • After a remote checkpoint exists, reconcile status instead of calling Direct Post initialization again.
  • Do not automatically retry ambiguous TikTok publish-init failures.
  • If TikTok reports multiple public post IDs for one publish_id, preserve the first canonical ID and retain all IDs for incident diagnosis.

Validation

A patch with focused regression tests is ready. It covers the checkpoint-before-upload sequence, credential-refresh re-entry, disabled ambiguous retries, reconciliation after checkpointed failures, and multiple public post IDs.

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