Replace extra_init_kwargs with polymorphic Phase.build() factory and ResourceProvider#23889
Open
luisorofino wants to merge 2 commits into
Open
Replace extra_init_kwargs with polymorphic Phase.build() factory and ResourceProvider#23889luisorofino wants to merge 2 commits into
luisorofino wants to merge 2 commits into
Conversation
Contributor
|
This was referenced Jun 3, 2026
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3 tasks
7ff85ce to
dacf57f
Compare
Contributor
Validation ReportAll 21 validations passed. Show details
|
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.

What does this PR do?
Replaces the untyped
extra_init_kwargsdict-merge construction path with a typed, polymorphicPhase.build()factory fed by aResourceProvider. Every phase is now constructed through one uniform call —phase_cls.build(phase_id, config, deps, resources, checkpoint_manager, context)— with no dict splat, notype: ignore[override], and no orchestrator knowledge of how each phase assembles its agent or tools.Concretely:
Phase.build()— new polymorphic classmethod factory on the base class;AgenticPhaseoverrides it to source agent/tool builders from the providerResourceProvider— new class inorchestrator.pythat serves raw infrastructure (agent clients, file registry singleton, agent configs) to phases during construction; typedResourceUnavailableErroron unknown namesFlowContext— replacesFlowServices; holds only the ambient, non-resource half (variables,config_dir, callbacks, logger);checkpoint_managerandfile_registryare no longer bundled herePhaseRegistry— moved frombase.pytoorchestrator.pywhere it is exclusively usedextra_init_kwargsand itstype: ignore[override]suppression are removed entirelyThis is a construction-seam refactor only. Flow YAML schema, phase runtime behavior, and generated-integration output are unchanged.
Motivation
Tracked in AI-6918.
The old
extra_init_kwargshook was a dict bag that required the orchestrator to merge kwargs it did not understand, forced subclasses to re-declare and re-validate inputs the base class had already validated, and needed atype: ignore[override]to suppress a legitimate Mypy violation. Any new phase that needed extra resources had to either fit into the existing bag or widen the bag further.Phase.build()gives each phase class full ownership of its construction: it decides what it needs from the provider, assembles the right builders, and returns a fully-initialized instance. The orchestrator loop stays uniform and type-clean regardless of how complex a phase's construction is.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged