Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/vercel/_internal/workflow/worlds/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ async def events_create(self, run_id: str | None, data: w.Event) -> w.EventResul
return w.EventResult(event=event, run=current_run)

if data.event_type in run_terminal_events or data.event_type == "run_cancelled":
raise RuntimeError(
raise w.EntityConflictError(
f"Cannot transition run from terminal state {current_run.status}"
)

if data.event_type in ["step_created", "hook_created", "wait_created"]:
raise RuntimeError(
raise w.EntityConflictError(
f"Cannot create new entities on run in terminal state {current_run.status}"
)

Expand All @@ -291,13 +291,13 @@ async def events_create(self, run_id: str | None, data: w.Event) -> w.EventResul
raise RuntimeError(f'Step "{data.correlation_id}" not found')

if is_step_terminal(validated_step.status):
raise RuntimeError(
raise w.EntityConflictError(
f'Cannot modify step in terminal state "{validated_step.status}"'
)

if current_run and is_run_terminal(current_run.status):
if validated_step.status != "running":
raise RuntimeError(
raise w.EntityConflictError(
f"Cannot modify non-running step on run in terminal state "
f'"{current_run.status}"'
)
Expand Down