Skip to content

Python: Avoid generated executor ID collisions in declarative workflows - #9087

Draft
LI (ktz03) wants to merge 2 commits into
microsoft:mainfrom
ktz03:fix/declarative-internal-ids
Draft

LI (ktz03) wants to merge 2 commits into
microsoft:mainfrom
ktz03:fix/declarative-internal-ids

Conversation

@ktz03

@ktz03 LI (ktz03) commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Motivation & Context

Valid Python declarative action definitions fail to build when an unnamed action or a control-flow helper generates the same executor ID as an authored action. For example, an unnamed first SendActivity and a later action explicitly named SendActivity_0 raise a duplicate executor error.

Description & Review Guide

  • What are the major changes? Reserve authored IDs that create real executors throughout supported nested actions before constructing the graph, and allocate deterministic unused IDs for real generated executors. Add public factory/execution regressions for action order, nested actions, suffix collisions, If/ConditionGroup helpers, Foreach nodes, Goto targets, and loop-control references.
  • What is the impact of these changes? Previously rejected collision definitions build and execute while retaining authored IDs. Existing noncolliding executor IDs, virtual control prefixes, skipped actions, nullable inactive branches, the reserved entry ID rule, and explicit duplicate-ID rejection remain unchanged. This is a construction fix adjacent to Python: Review and standardize agent and workflow identity semantics #8161's broader identity design review; it does not change agent names or workflow identity policy.
  • What do you want reviewers to focus on? Complete reservation of nested authored IDs, allocation only for real generated nodes, references to allocated loop nodes, and compatibility of ordinary generated IDs. The 44 focused regressions were 23 failures/21 passing controls on exact main and 44 passing after the fix. Independent public-entry compatibility checks matched main for 22 normal/rejected cases. The complete declarative suite, including restored exact main sample fixtures, passed 1391 tests with zero failures/skips and 93% coverage on Windows/Python 3.12.14. Syntax, strict Pyright, all five typing checks, applicable pre-commit hooks, and wheel/sdist builds pass. No external service, checkpoint migration deployment, model inference, or performance validation was run.

Related Issue

Fixes #9086

Related design review: #8161 (the broader review is not closed by this change).

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 20:58
@ktz03
LI (ktz03) deployed to github-app-auth October 5, 2026 20:58 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused allocation changes and regression coverage support the fix, with no identified blocking issues.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes generated executor ID collisions in Python declarative workflows while preserving authored IDs and existing noncolliding IDs.

Changes:

  • Reserve nested authored executor IDs before graph construction.
  • Allocate deterministic unused IDs for generated actions and control-flow helpers.
  • Add regressions for collisions, routing, loop references, and compatibility.
File Description
python/​packages/​declarative/​tests/​test_workflow_generated_ids.py Adds collision and compatibility regression tests.
python/​packages/​declarative/​agent_framework_declarative/​_workflows/​_declarative_builder.py Reserves authored IDs and allocates collision-free generated IDs.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Oct 5, 2026

This branch was successfully deployed

1 active deployment
github-app-auth — 05e1c061 Deployed Oct 5, 2026 by ktz03 via add_label #24492
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: Generated declarative executor IDs collide with authored action IDs

2 participants