Repository navigation
Python: Return empty list from Executor output_types when discovery is deferred - #9942
Conversation
…d discovery on Executor Initialize self._response_handler_specs in Executor.__init__ and safely fall back when reading response handler specs so that output_types and workflow_output_types return empty lists instead of raising AttributeError when handler discovery is deferred. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…eferred discovery Add unit test coverage verifying that Executor.output_types and Executor.workflow_output_types safely return empty lists prior to handler discovery when defer_discovery=True, and properly populate once handlers are discovered. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
|
/review |
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (2 commit(s)): b7b4656f7e5f, 120190020611
Model: gpt-5.6-sol
Overview
The PR initializes response-handler metadata during Executor construction and adds defensive fallbacks to type-introspection properties, so deferred executors report empty output types until discovery. Existing discovery appends into the preinitialized list, production deferred constructors complete both discovery phases, and the added tests cover empty-before and populated-after behavior. No Critical, High, or Medium defect was established.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
Motivation & Context
In
agent-framework(Python workflows),Executor.__init__supportsdefer_discovery=Trueto defer handler inspection until later. Whileself._handler_specsis initialized during__init__,self._response_handler_specswas only set during handler discovery inRequestInfoMixin._discover_response_handlers.As a result, prior to discovery, accessing
executor.input_typessafely returned an empty list[], but accessingexecutor.output_typesorexecutor.workflow_output_typesraised:Description & Review Guide
What are the major changes?
self._response_handler_specs: list[dict[str, Any]] = []inExecutor.__init__alongsideself._handler_specs.getattr(self, "_response_handler_specs", [])inExecutor.output_typesandExecutor.workflow_output_types.packages/core/tests/workflow/test_request_info_mixin.pyverifying thatoutput_typesandworkflow_output_typesreturn[]before discovery whendefer_discovery=True, and populate correctly once discovery runs.What is the impact of these changes?
AttributeErrorwhen inspecting deferred executors.input_types,output_types, andworkflow_output_types.Related Issue
Fixes #9939
AI Assistance
Contribution Checklist
cc Eduard van Valkenburg (@eavanvalkenburg)