Repository navigation
Python: Deduplicate fan-out selection results so each target runs once - #8739
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit intoSep 28, 2026
Conversation
FanOutEdgeRunner validated that every ID returned by a selection function is a target, then delivered once per entry, so a target named twice ran twice on the same message. Drop repeats after validation, keeping the order in which the selection function first names each target.
Ruiqi Wang (RachelWanggg)
temporarily deployed
to
github-app-auth
September 24, 2026 21:28 — with
GitHub Actions
Inactive
Ruiqi Wang (RachelWanggg)
temporarily deployed
to
github-app-auth
September 24, 2026 21:29 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Sep 28, 2026
This was referenced Oct 15, 2026
.NET: [Bug]: Fan-out edge runs a target twice when the target selector returns its index twice
#9431
Closed
This branch was previously deployed
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.
Motivation & Context
A selection function that names a target more than once gets that target run once per entry.
FanOutEdgeRunner.send_messagevalidates that every selected ID is a target, then appends one deliverable edge per entry and gathers them, so["billing_team", "billing_team"]runsbilling_teamtwice on the same message. Routing by tags hits this whenever two tags map to the same executor. With anAgentExecutortarget that is a second model call and a duplicated response.Description & Review Guide
FanOutEdgeRunner.send_messagedrops repeated IDs from the selection result after validation, keeping the order in which the selection function first names them. It useslist(dict.fromkeys(...))rather thanset(...)so delivery order stays deterministic.Verification
test_edge.py, both failing onmain: a target selected twice runs once (real executors, counting handler calls), and deduplicated targets are delivered in the order they are first named.target_idsorder fails the order test.set()fails the order test whenever the hash seed changes the order.uv run poe test -P core: 7689 passed, 20 skipped, 2 xfailed.uv run poe syntax -P core,uv run poe pyright -P coreanduv run poe test-typing -P core(pyrefly, ty, zuban, pyright, mypy) pass.Related Issue
Fixes #8738
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix). A workflow keeps the label and title prefix in sync automatically.