Skip to content

fix(foundation): validate DSL registry agents against runtime registry - #1639

Open
Bhanudahiyaa wants to merge 1 commit into
mofa-org:mainfrom
Bhanudahiyaa:fix/workflow-dsl-runtime-agent-registry-parity
Open

fix(foundation): validate DSL registry agents against runtime registry#1639
Bhanudahiyaa wants to merge 1 commit into
mofa-org:mainfrom
Bhanudahiyaa:fix/workflow-dsl-runtime-agent-registry-parity

Conversation

@Bhanudahiyaa

Copy link
Copy Markdown
Contributor

Summary

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(...).
  • Added focused parser regression tests:
    • build_with_agents_accepts_runtime_registry_agents_without_dsl_agent_map
    • build_with_agents_fails_when_registry_agent_is_missing_at_runtime

Design decisions and tradeoffs

  • 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.

Related issue

Closes #1638

Validation checklist

  • Focused, single-concern change
  • Added regression tests for boundary behavior
  • cargo test -p mofa-foundation workflow::dsl::parser::tests -- --nocapture passes
  • cargo check -p mofa-foundation --all-features passes

@Bhanudahiyaa

Copy link
Copy Markdown
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(workflow-dsl): align registry-agent validation with runtime agent registry in build path

1 participant