Skip to content

Python: [BREAKING] preserve expression results in SendActivity output - #8509

Merged
Jose Alvarez (jpalvarezl) merged 5 commits into
mainfrom
jpalvarezl-publish-sendactivity-results
Sep 18, 2026
Merged

Jose Alvarez (jpalvarezl) merged 5 commits into
mainfrom
jpalvarezl-publish-sendactivity-results

Conversation

@jpalvarezl

@jpalvarezl Jose Alvarez (jpalvarezl) commented Sep 18, 2026

Copy link
Copy Markdown
Member

Motivation & Context

SendActivity currently 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

  • What are the major changes? Select expression evaluation or template interpolation from the original authored text. Preserve the existing startswith("=") expression rule without trimming. Add a parameterized regression using the real evaluator and inert fixture values for both string activities and mappings with a text field. 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.
  • What is the impact of these changes? This is an intentional behavioral breaking change: expression results are emitted without an implicit second template pass. Authored non-expression templates retain their existing interpolation and unresolved-path behavior. Path resolution, permitted dictionary keys, guarded attribute access, and falsey/non-string output handling are unchanged. Workflows intentionally relying on interpolation of an expression result must move the template into the activity definition or construct the desired output in the authored expression. The class docstring includes examples of both supported replacements; no new rendering-mode API is introduced.
  • What do you want reviewers to focus on? The original-input classification and the intentional expression-result behavior change, together with preserved authored-template compatibility and the documented migration. On the updated upstream baseline 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 revision 7c682a0051de18ae4d1a871fec9f837c284202fc, 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 revision a90ed70edd4332e565683bd4296d2432955c2cc7 moves 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

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • 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.

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)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

@github-code-quality

github-code-quality Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Python

Python / code-coverage/python

The overall line coverage in commit a90ed70 in the jpalvarezl-publish-s... branch is 91%. Line coverage data for the main branch is not yet available.

Show a line coverage summary of the most covered files.
File main jpalvarezl-publish-s... a90ed70 +/-
packages/core/a...ework/_tools.py 96%
packages/core/a...work/_skills.py 95%
packages/openai..._chat_client.py 94%
packages/core/a.../_compaction.py 94%
packages/core/a...ework/_types.py 93%
packages/core/a...ork/_vectors.py 93%
packages/core/a...bservability.py 93%
packages/core/a...amework/_mcp.py 92%
packages/ag-ui/...i/_agent_run.py 89%
packages/core/a...ork/security.py 89%

Updated September 18, 2026 13:12 UTC

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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)): 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

@jpalvarezl Jose Alvarez (jpalvarezl) changed the title Python: preserve expression results in SendActivity output Python: [BREAKING] preserve expression results in SendActivity output Sep 18, 2026
@agent-framework-automation agent-framework-automation Bot added the breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible label Sep 18, 2026
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>
@agent-framework-automation agent-framework-automation Bot added the documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs label Sep 18, 2026
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>
@jpalvarezl
Jose Alvarez (jpalvarezl) added this pull request to the merge queue Sep 18, 2026
Merged via the queue into main with commit 57cdbf6 Sep 18, 2026
46 checks passed
@jpalvarezl
Jose Alvarez (jpalvarezl) deleted the jpalvarezl-publish-sendactivity-results branch September 18, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants