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
Fix inconsistent input validation in declarative workflow control-flow actions. Decision settings should follow the same value-validation contract as other action inputs, while preserving ordinary expressions and existing defaults.
Description & Review Guide
What are the major changes? Apply existing validation helpers to condition and loop inputs, question settings, tool approval and automatic sending settings, agent external-loop conditions, HTTP timeouts, message selection, and variable-scope selection. Validate tool automatic-send settings before dispatch and preserve each invocation's evaluated setting across responses, approval, and checkpoint restoration, including replacement MCP approvals. Evaluate function automatic-send settings only for result processing, so restored approval denials complete without evaluating an unrelated setting. Register function automatic-send checkpoint state in the source-generated JSON context and cover real JSON save/resume with fresh workflows. Validate restored loop inputs, update the checked-in condition and all three foreach workflow fixtures, compile those loop fixtures for behavioral regression tests, and clarify the expression-evaluation contract.
What is the impact of these changes? Invalid decision inputs raise DeclarativeActionException instead of being consumed without validation; invalid automatic-send settings do not dispatch tool requests. Pending invocations retain their original automatic-send behavior even when workflow state changes, including JSON checkpoints with reflection-based serialization disabled. Older approval denials clear pending state and record the denial; approved older requests still validate settings before invoking a function. Non-sensitive expressions, literal defaults, and metadata-preserving assignments keep their existing behavior. Add focused executor, checkpoint, generated-loop, and end-to-end regression tests, and keep configuration-loading tests focused on loading and assignment.
What do you want reviewers to focus on? Consistency with the existing input-validation helpers, per-request response correlation, backward-compatible and source-generated JSON checkpoint restoration, default-value behavior, generated-loop parity, and ensuring invalid conditions do not execute either branch.
Validation from dotnet:
dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-method '*RejectsSensitive*': failed as expected before the implementation fix (23 regression cases).
dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-method '*ClearVariablesRejectsSensitiveScopeAsync': failed as expected before the corresponding implementation fix (1 regression case).
dotnet build src\Microsoft.Agents.AI.Workflows.Declarative\Microsoft.Agents.AI.Workflows.Declarative.csproj --no-restore --tl:off: passed for all five target frameworks, with zero warnings and errors.
dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-class '*InvokeMcpToolExecutorTest': failed before the reapproval repair (6 regression cases); passed afterward (88 tests).
dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-class '*ForeachExecutorTest': failed before the remaining fixture repairs (2 restore regression cases); passed afterward (26 tests).
dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore: failed before the initial review repairs (16 behavior regressions and 1 test-fixture failure); passed after all repairs and formatting (1,088 tests).
dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore -p:JsonSerializerIsReflectionEnabledByDefault=false --filter-method '*AutoSendSnapshotSurvivesJsonCheckpointAsync' --no-progress: failed before the JSON registration repair (4 cases with missing dictionary type information); passed afterward (4 tests).
dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-method '*LegacyApprovalResponseValidatesAutoSendOnlyWhenApprovedAsync' --no-progress: failed before the denial repair (2 denial cases); passed afterward (4 denial/approved validation cases).
dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --no-progress: passed after all repairs and formatting (1,096 tests).
dotnet format src\Microsoft.Agents.AI.Workflows.Declarative\Microsoft.Agents.AI.Workflows.Declarative.csproj --no-restore: passed.
dotnet format tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj --no-restore: passed.
Related Issue
N/A - maintainer-requested bugfix tracked internally; no public issue was opened. No competing open PR for this fix was found.
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: GitHub Copilot assisted with implementation, regression tests, documentation, and this PR description.
Contribution Checklist
The code builds clean without any errors or warnings
All unit tests pass, and I have added new tests where possible
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.
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)): 6f46cb8f2295 Model:gpt-5.6-sol
Overview
The review found 3 verified inline finding(s).
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
3 verified findings remained after source verification (2 high, 1 medium) across 3 files. Details are attached to the affected lines below.
Equivalent generated foreach fixtures are still stale: Workflows/LoopBreak.cs:75-91,132-146 and Workflows/LoopContinue.cs:75-91,132-146 retain this same loop implementation without either sensitivity check. Since these files are checked-in generated baselines, equivalent foreach workflows now encode different validation contracts and the claimed generated-loop parity is incomplete. Regenerate/update all foreach baselines (and the generating template, if maintained here), not only LoopEach.cs.
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
documentationUsage: [Issues, PRs], Target: documentation in the code base and learn docs.NETUsage: [Issues, PRs], Target: .NetworkflowsUsage: [Issues, PRs], Target: Workflows
3 participants
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.
Motivation & Context
Fix inconsistent input validation in declarative workflow control-flow actions. Decision settings should follow the same value-validation contract as other action inputs, while preserving ordinary expressions and existing defaults.
Description & Review Guide
DeclarativeActionExceptioninstead of being consumed without validation; invalid automatic-send settings do not dispatch tool requests. Pending invocations retain their original automatic-send behavior even when workflow state changes, including JSON checkpoints with reflection-based serialization disabled. Older approval denials clear pending state and record the denial; approved older requests still validate settings before invoking a function. Non-sensitive expressions, literal defaults, and metadata-preserving assignments keep their existing behavior. Add focused executor, checkpoint, generated-loop, and end-to-end regression tests, and keep configuration-loading tests focused on loading and assignment.Validation from
dotnet:dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-method '*RejectsSensitive*': failed as expected before the implementation fix (23 regression cases).dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-method '*ClearVariablesRejectsSensitiveScopeAsync': failed as expected before the corresponding implementation fix (1 regression case).dotnet build src\Microsoft.Agents.AI.Workflows.Declarative\Microsoft.Agents.AI.Workflows.Declarative.csproj --no-restore --tl:off: passed for all five target frameworks, with zero warnings and errors.dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-class '*InvokeMcpToolExecutorTest': failed before the reapproval repair (6 regression cases); passed afterward (88 tests).dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-class '*ForeachExecutorTest': failed before the remaining fixture repairs (2 restore regression cases); passed afterward (26 tests).dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore: failed before the initial review repairs (16 behavior regressions and 1 test-fixture failure); passed after all repairs and formatting (1,088 tests).dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore -p:JsonSerializerIsReflectionEnabledByDefault=false --filter-method '*AutoSendSnapshotSurvivesJsonCheckpointAsync' --no-progress: failed before the JSON registration repair (4 cases with missing dictionary type information); passed afterward (4 tests).dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --filter-method '*LegacyApprovalResponseValidatesAutoSendOnlyWhenApprovedAsync' --no-progress: failed before the denial repair (2 denial cases); passed afterward (4 denial/approved validation cases).dotnet test --project tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests -f net10.0 --no-restore --no-progress: passed after all repairs and formatting (1,096 tests).dotnet format src\Microsoft.Agents.AI.Workflows.Declarative\Microsoft.Agents.AI.Workflows.Declarative.csproj --no-restore: passed.dotnet format tests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests\Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj --no-restore: passed.Related Issue
N/A - maintainer-requested bugfix tracked internally; no public issue was opened. No competing open PR for this fix was found.
AI Assistance
AI assistance details: GitHub Copilot assisted with implementation, regression tests, documentation, and this PR description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.