Skip to content

Python: fix(devui): discover entities exported with an annotated assignment - #9128

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 3 commits into
microsoft:mainfrom
anishmehta24:fix/devui-discover-annotated-export
Oct 15, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 3 commits into
microsoft:mainfrom
anishmehta24:fix/devui-discover-annotated-export

Conversation

@anishmehta24

@anishmehta24 Anish Mehta (anishmehta24) commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Motivation & Context

DevUI directory discovery only checked ast.Assign nodes for a module-level agent / workflow, so a file that declares it with a type annotation (agent: Agent = Agent(...), an ast.AnnAssign) was never listed.

Description & Review Guide

  • What are the major changes? _has_entity_exports also accepts an annotated assignment that has a value. A bare declaration (agent: Agent) is still ignored.
  • What is the impact of these changes? Typed entity files show up in DevUI. Files that were discovered before are unchanged.
  • What do you want reviewers to focus on? Nothing special.

Tests: test_discover_file_entity_with_annotated_export in tests/devui/test_discovery.py (an annotated export is discovered, a bare declaration is not); it fails on main. test_discovery.py passes, ruff check and format clean.

Related Issue

Fixes #9127

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: issue analysis, implementation, tests and this description.

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 links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • 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.

🤖 Generated with Claude Code

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): f1fc502470be
Model: gpt-5.6-sol

Overview

The change correctly distinguishes initialized annotated exports from declaration-only annotations, preserves lazy discovery, and adds focused positive and negative coverage. However, the existing whole-tree traversal causes the new AnnAssign branch to treat function- or class-local annotations as module exports, creating invalid entities that fail when loaded.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: python/packages/devui/agent_framework_devui/_discovery.py

Comment thread python/packages/devui/agent_framework_devui/_discovery.py
@eavanvalkenburg

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 2

Result: Findings reported
Scope: 1 net-new commit(s): da92d0e51f9b
Model: gpt-5.6-sol

Overview

The change replaces the broad AST walk with explicit traversal that skips function and class bodies, resolving the reported nested-scope false positives while retaining module-level conditional exports. The focused test covers initialized and bare annotations, module-level control flow, and nested function/class names, while lazy loading still validates the resulting module attribute and entity protocol. However, the blanket scope skip also removes runtime-valid module exports created by called factories that explicitly assign a global, causing a compatibility regression for previously discoverable files.

Reviewed the supplied incremental change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: python/packages/devui/agent_framework_devui/_discovery.py

Comment thread python/packages/devui/agent_framework_devui/_discovery.py
Merged via the queue into microsoft:main with commit 5478864 Oct 15, 2026
52 checks passed
Eduard van Valkenburg (eavanvalkenburg) added a commit to eavanvalkenburg/agent-framework that referenced this pull request Oct 15, 2026
Document the annotated-assignment entity discovery fix merged in microsoft#9128 and bring the release scope to 77 merged Python pull requests.
westey (westey-m) pushed a commit to westey-m/agent-framework that referenced this pull request Oct 15, 2026
* Bump Python package versions for 1.22.0 release

Update all published Python packages because Python 3.15 metadata changed across the workspace. Apply minor bumps to stable packages with breaking or additive API work, patch Orchestrations, stamp alpha and beta packages with 261015, refresh the core[all] release cohort, raise Core floors only for packages that require the coordinated content-identity contract, and update release notes and lockfiles.

* Address Python 1.22 release review feedback

Align all Hosting adapters on the co-released Hosting version, remove the intentionally unpublished Lab package from the release cohort, document the mixed-version persisted-state constraint, and add the merged Message string fix to the changelog.

* Add merged DevUI fix to Python 1.22 notes

Document the annotated-assignment entity discovery fix merged in microsoft#9128 and bring the release scope to 77 merged Python pull requests.

* Clarify Python 1.22 persisted-state warning

Move the mixed-version warning to the top of the release notes and distinguish affected serialized histories, snapshots, sessions, and checkpoint state from unaffected plain metadata.

* Relax DevUI orchestration dev extra

Allow DevUI development installs to resolve any compatible 1.x Orchestrations release, avoiding the stale RC1 exact pin and remaining compatible with the 1.22 release cohort.

This branch was successfully deployed

1 active deployment
github-app-auth — 3ca6c309 Deployed Oct 14, 2026 by anishmehta24 via add_label #25392
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: [Bug]: DevUI discovery skips files that export agent with a type annotation

3 participants