Skip to content

Retry failed plugin webhook writes with backoff #4104

Done

Description

@sentry-junior

A plugin webhook route did its writes inside the request. When one write failed, the work was either lost or retried only by a path that the plugin built itself. Junior had no general way for a plugin route to hand failed work to a durable retry with backoff. Raised by @BYK in review of #4102.

Retry paths before

  • Webhook redelivery: a thrown error makes the route fail. GitHub does not send a failed delivery again by itself. A person must redeliver it by hand.
  • Daily reconcile: the GitHub plugin heartbeat claims one repository a day and reads its stale open pull requests again. Work that has no stored open row, such as a lost issue close or a failed chip write, has no retry.
  • Plugin tasks already ran on Vercel Queues, but core started them only after a Turn completed. A route could not start one.

What shipped (#4109)

Vercel Queues through plugin tasks, with no table and no heartbeat recovery.

  • A plugin declares a started task with a payload schema in its tasks. A route or a heartbeat starts it with ctx.tasks.start({ name, key, payload }).
  • Core parses the payload with the task's schema, then sends it in a signed message on the plugin task topic. Core stores nothing in Postgres.
  • The queue idempotency key is a hash of the plugin and its key, because Vercel Queues accepts at most 256 characters. A second start with the same key does nothing while the queue keeps the message, which is 1 h.
  • Each attempt parses the payload again and runs the handler. A failed attempt throws, and the queue runs it again with a fixed backoff of 30, 60, 120, then 240 s. After the 5th delivery, core logs plugin.task.failed and acknowledges the message.
  • A handler must be safe to run again after a partial run.

Answers to the open questions

  • Retry delay: one fixed backoff in core for every task.
  • Terminal failure: logs only, as plugin.task.failed.

Not built

  • The durable task table, row claims, leases, and the heartbeat recovery of lost deliveries.

Follow-up

  • The GitHub plugin's pull request cache patch moves from its heartbeat list to a delayed started task.

via @BYK.

--

View Session [Sentry]

Activity

  1. sentry-junior commented on Nov 23, 2026

    @sentry-junior
    ContributorAuthor

    PR: #4109

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions