You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Align workflow DSL validation with runtime behavior by validating AgentRef::Registry against the runtime agent_registry used by WorkflowDslParser::build_with_agents.
Motivation
build_with_agents is runtime-registry-driven, but pre-build validation used definition.agents as lookup source. This could reject otherwise valid workflows before execution, causing DSL/runtime contract drift.
Changes
Updated WorkflowDslParser::validate signature to accept runtime agent_registry.
Switched registry-agent validation from definition.agents.contains_key(...) to agent_registry.contains_key(...).
Kept change minimal and localized to parser build path.
Preserved existing error type and behavior (DslError::AgentNotFound) for missing agents.
No schema changes, no new subsystem, no behavior changes outside build_with_agents.
Testing
Executed locally:
cargo test -p mofa-foundation workflow::dsl::parser::tests -- --nocapture
cargo check -p mofa-foundation --all-features
Notes:
Strict crate clippy with -D warnings currently fails due unrelated pre-existing lint violations in other files/modules; this PR does not introduce those.
This change fixes a DSL/runtime boundary inconsistency in workflow compilation.
build_with_agents resolves registry agents from the runtime agent_registry, but validation previously checked definition.agents. That made the validator stricter in the wrong place and produced false AgentNotFound failures for valid runtime
configurations.
The patch aligns validation with execution contract by using runtime registry as source of truth for AgentRef::Registry references, while preserving existing error semantics. Two regression tests lock expected behavior for both success and failure paths.
Design question for maintainers:
Should definition.agents be documented as optional metadata/inline config support only, while runtime registry remains authoritative for build_with_agents?
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
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.
Summary
Align workflow DSL validation with runtime behavior by validating
AgentRef::Registryagainst the runtimeagent_registryused byWorkflowDslParser::build_with_agents.Motivation
build_with_agentsis runtime-registry-driven, but pre-build validation useddefinition.agentsas lookup source. This could reject otherwise valid workflows before execution, causing DSL/runtime contract drift.Changes
WorkflowDslParser::validatesignature to accept runtimeagent_registry.definition.agents.contains_key(...)toagent_registry.contains_key(...).build_with_agents_accepts_runtime_registry_agents_without_dsl_agent_mapbuild_with_agents_fails_when_registry_agent_is_missing_at_runtimeDesign decisions and tradeoffs
DslError::AgentNotFound) for missing agents.build_with_agents.Testing
Executed locally:
cargo test -p mofa-foundation workflow::dsl::parser::tests -- --nocapturecargo check -p mofa-foundation --all-featuresNotes:
-D warningscurrently fails due unrelated pre-existing lint violations in other files/modules; this PR does not introduce those.Related issue
Closes #1638
Validation checklist
cargo test -p mofa-foundation workflow::dsl::parser::tests -- --nocapturepassescargo check -p mofa-foundation --all-featurespasses