fix: cap tag related resources to event maximum - #22694
Open
vedjaw wants to merge 3 commits into
Open
Conversation
Deployments may carry more than 100 tags, but events reject more than the configured maximum related resources. Truncate tag-related resources when building events so flow-run creation no longer fails. Fixes PrefectHQ#19064 Co-authored-by: Cursor <cursoragent@cursor.com>
vedjaw
requested review from
chrisguidry,
desertaxle and
zzstoatzz
as code owners
August 1, 2026 19:44
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c6acb6bfdc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Merging this PR will not alter performance
Comparing Footnotes
|
`tags_as_related_resources()` is public, and reserving a hard-coded 10 slots meant any caller with fewer than 10 non-tag related resources silently lost tags. With the default `maximum_related_resources` of 100, a caller with no other resources got 90 tags instead of 100, so automations or filters matching a dropped tag stopped seeing those events. Take the count from the caller instead. `reserved` defaults to 0, so the helper now yields every tag that fits, and the four call sites pass `len(related)` -- the number of slots they have actually composed. The server-side cap in `_resource_data_as_related_resources` already worked this way, computing from `len(related)`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #19064
Deployments can store more than 100 tags, but flow-run state-change events
convert each tag into a related resource and enforce
server.events.maximum_related_resources(default 100). That causedruntime validation failures for otherwise-valid deployments.
Fix
_resource_data_as_related_resources,reserving one slot for provenance
tags_as_related_resourcesis capped
Test plan
Made with Cursor