Python: [BREAKING] preserve expression results in SendActivity output - #8509
Conversation
Emit evaluated expressions as data while retaining authored-template interpolation. Add regression coverage for string and mapping activity forms. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Emit evaluated expressions as data while retaining authored-template interpolation. Add regression coverage for string and mapping activity forms. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> (cherry picked from commit e52b5c7)
There was a problem hiding this comment.
🟡 Changes recommended
The stable behavioral change needs the repository-required issue discussion and breaking-change designation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Prevents SendActivity expression results from undergoing unintended template interpolation.
Changes:
- Classifies authored text as expressions or templates before evaluation.
- Adds regression coverage for string and mapping activities.
File summaries
| File | Description |
|---|---|
python/packages/declarative/tests/test_graph_coverage.py |
Tests preservation of template-shaped expression results. |
python/packages/declarative/agent_framework_declarative/_workflows/_executors_basic.py |
Separates expression evaluation from template interpolation. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
Code Coverage OverviewLanguages: Python Python / code-coverage/pythonThe overall line coverage in commit a90ed70 in the Show a line coverage summary of the most covered files.
Updated |
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): d4a5af0716a4
Model: gpt-5.6-sol-fast
Overview
The change cleanly separates authored expressions from authored templates and adds regression coverage for both supported activity shapes. Existing template behavior, expression evaluation, path-safety guards, and workflow continuation remain intact. However, the new branch silently changes the output of existing stable-package workflows that relied on the previous expression-then-interpolation behavior, without a compatibility mechanism or migration path.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: python/packages/declarative/agent_framework_declarative/_workflows/_executors_basic.py
Preserve the existing implementation checkpoint while continuing from the published source tree. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Cover authored templates and explicit expressions in both activity forms, and document the intentional single-pass expression output contract. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move the concise migration examples into the class documentation and remove the detailed package README section. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Motivation & Context
SendActivitycurrently evaluates an authored expression and then applies template interpolation to the returned text. This can change an otherwise ordinary expression result containing template-shaped text. Expression results should be emitted as data, while templates written directly in the activity definition should continue to resolve normally.Description & Review Guide
startswith("=")expression rule without trimming. Add a parameterized regression using the real evaluator and inert fixture values for both string activities and mappings with atextfield. Document the distinction and concise migration examples in the executor's class docstring. Test directly authored templates and explicit string-building expressions in both activity forms.b0437908a2df93271296dd388b0747363811a42f, temporarily restoring the old second-pass behavior made both regression cases fail while all four migration cases passed. Restoring the fix made all six focused cases pass. At revision7c682a0051de18ae4d1a871fec9f837c284202fc, all 438 selected graph, executor, workflow, and state-safety tests passed with Python 3.13.15 and PowerFx 0.0.34; source/test type checks and applicable commit hooks, including formatting and markdown checks, also passed. The subsequent documentation-only revisiona90ed70edd4332e565683bd4296d2432955c2cc7moves the guidance into the class docstring and restores the package README; executable code and tests are unchanged, and applicable hooks passed. These results do not represent a full-repository test run or completed CI for the latest revision.Related Issue
No public issue is linked.
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.