Skip to content

Code Review Bench PR #20227 - Link automation.action.* events to automation.triggered event#2

Open
tomerqodo wants to merge 7 commits intobase_pr_20227_20260125_3232from
corrupted_pr_20227_20260125_3232
Open

Code Review Bench PR #20227 - Link automation.action.* events to automation.triggered event#2
tomerqodo wants to merge 7 commits intobase_pr_20227_20260125_3232from
corrupted_pr_20227_20260125_3232

Conversation

@tomerqodo
Copy link

Code Review Bench PR PrefectHQ#20227

Original PR Title: Link automation.action.* events to automation.triggered event
Original PR Description: When an automation fires, it emits automation.triggered events, then queues
actions that emit automation.action.* events. Previously there was no way to
trace from automation.action.failed back to the automation.triggered event,
making debugging difficult.

Now automation.action.* events include a related resource with role
automation-triggered-event that links back to the state change event:

{
  "prefect.resource.id": "prefect.event.<id>",
  "prefect.resource.role": "automation-triggered-event"
}

This was requested via support to help with debugging automation failures at
higher volumes.

Port of https://github.com/PrefectHQ/nebula/pull/10911

🤖 Generated with Claude Code
Original PR URL: PrefectHQ#20227

chrisguidry and others added 7 commits January 25, 2026 12:09
When debugging automation failures at high volumes, it's difficult to trace
from an `automation.action.failed` event back to the `automation.triggered`
event that spawned it. This adds an `automation_triggered_event_id` field to
`TriggeredAction` and includes it as a related resource with role
`automation-triggered-event` on all action events (`.triggered`, `.executed`,
and `.failed`).

Port of https://github.com/PrefectHQ/nebula/pull/10911

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The triggering-event related resource should appear on all three action
event types (.triggered, .executed, .failed) to enable full traceability.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Now that automation.action.executed and automation.action.failed events include
a triggering-event related resource, update the tests to expect it in their
assertions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Build related_resources once at the start of fail() and succeed() methods and
reuse it for both the .triggered and .failed/.executed events, rather than
building separate lists with identical logic.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a brief section to the automations docs explaining the events emitted during
automation execution and the related resources (triggering-event and
automation-triggered-event) available for tracing action failures back to their
source.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants