Skip to content

workflow: add hook conflict inspection - #328

Draft
fantix wants to merge 1 commit into
mainfrom
fantix/hook-get-conflict
Draft

workflow: add hook conflict inspection#328
fantix wants to merge 1 commit into
mainfrom
fantix/hook-get-conflict

Conversation

@fantix

@fantix fantix commented Aug 25, 2026

Copy link
Copy Markdown
Member

This PR adds support for a workflow to check whether a hook token is already in use without waiting for someone to send data to the hook.

New public API: HookEvent.get_conflict() -> Run[Any] | None. Calling it claims the token for this hook if the token is free. It returns None in that case, or the owning Run if another hook already uses the token.

hook = Approval.wait(token=f"order:{order_id}")

conflict = await hook.get_conflict()
if conflict is not None:
    return {"status": "already-running", "run_id": conflict.run_id}

approval = await hook
return {"status": "approved", "by": approval.user_id}

  • Keep the owner run ID when a hook token conflicts.
  • Add HookEvent.get_conflict() to claim a token without waiting for hook data.
  • Continue the workflow as soon as that token claim succeeds.
  • Return the same owning Run from repeated conflict checks.
  • Materialize lazy Vercel hook conflict events so the runtime can inspect them.

@fantix
fantix force-pushed the fantix/hook-get-conflict branch from 88d3e27 to a5b4ca3 Compare August 25, 2026 20:14
@fantix
fantix force-pushed the fantix/hook-get-conflict branch from a5b4ca3 to eee3310 Compare August 26, 2026 18:40
@fantix
fantix force-pushed the fantix/hook-get-conflict branch from eee3310 to 349a832 Compare August 27, 2026 01:44
Base automatically changed from fantix/hook-conflict-replay to main August 27, 2026 18:44
@fantix
fantix force-pushed the fantix/hook-get-conflict branch from 349a832 to a6b0d8f Compare August 27, 2026 18:48
* Preserve the owner run ID on hook conflict events.
* Add get_conflict() to check token ownership without consuming payload.
* Materialize lazy Vercel hook conflict events so the runtime can inspect them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant