Reject an n8n execution after saving its CometAPI video task ID

An n8n execution failing and a CometAPI video task finishing are two different events. For a workflow that already saved its remote task ID, recovery should start with that ID—not automatically with another video creation request.

n8n 2.37.11’s release notes list a core fix: “Ensure running job cleanup when a workflow run rejects.” That is a useful reason to test the rejection path. It is not evidence that rejection cancels a task already submitted to an external API.

Put the failure after the durable save

The official CometAPI n8n guide provides a concrete boundary:

  • Create Video sends POST https://api.cometapi.com/v1/videos.
  • Save Video Task takes id or task_id from the response.
  • The workflow upserts that item into ai_jobs before polling.
  • A 15-second Wait precedes GET https://api.cometapi.com/v1/videos/{task_id}.

For this integration, I would use the following controlled test, with a deliberately limited test workload. This is a proposed acceptance test, not a report of observed results.

  1. Create one video task and confirm the job_id → task_id mapping is durably stored in ai_jobs.
  2. Inject a workflow error after the upsert and before the first poll.
  3. Inspect n8n’s execution and running-job state to check whether rejection leaves stale local running work. Record the deployed version and the observation; the release note alone does not prove the fix works in that deployment.
  4. In a separate recovery execution, read the saved row and query the existing CometAPI task. Do not route this recovery through Create Video again.
  5. Follow the guide’s status branches: wait again for queued or in_progress, finalize for completed, and record the error for failed or error.

The two acceptance conditions should remain separate: local running-job cleanup is observed, and the saved remote task can still be reconciled without another create request. Neither condition should be inferred from the other.

Measure duplicate creation, not assumed savings

For the recovery test, count video-create requests per logical job_id, record the recovered task_id, and measure time from rejection to the next successful status lookup. The target is one create request for that logical job across the initial run and its recovery. A second POST is additional submission activity, not proof that the first task was cancelled.

This separates duplicate-work risk from recovery latency without inventing a cost figure. Neither cited source establishes a cancellation endpoint, refund behavior, idempotent video creation, or the billing effect of rejection. Do not treat local cleanup as remote cancellation or a credit.

There is also a harder failure window outside this test: the API accepts the task, but the execution fails before its ID is durably saved. A saved-ID recovery path cannot solve that case. Keep it as a separate reconciliation problem rather than silently retrying creation and claiming exactly-once behavior.

For this CometAPI workflow, the useful upgrade check is therefore not just “did the failed n8n job disappear?” It is “can recovery continue from the persisted video task without submitting a replacement?”

The proposed split between local cleanup and remote-task reconciliation is also an important safety boundary. A rejected execution should not be treated as authorization to issue a replacement request: first require a durable record of the original task_id, the logical job identifier, and the last known state. Recovery can then be constrained to reads against that task, with an explicit stop if the identifier is missing or the provider returns an ambiguous result.

For an operational check, retain an audit record for each recovery attempt: execution ID, deployed n8n version, logical job ID, task ID, request type, and outcome. Redact prompts and media payloads, and avoid logging API keys or full response bodies. A reviewer should separately confirm (1) the rejected execution no longer leaves local running work and (2) recovery never creates a second remote task. Passing the first check must not be used as evidence for the second; the unresolved “accepted before ID persistence” window still needs its own reconciliation or manual-review policy.