Skip to content

Post Plan completion to the reply chain in 1:1 threads - #722

Merged
Corina (corinagum) merged 3 commits into
mainfrom
cg/glowing-guacamole
Nov 5, 2026
Merged

Corina (corinagum) merged 3 commits into
mainfrom
cg/glowing-guacamole

Conversation

@corinagum

Copy link
Copy Markdown
Collaborator

Summary

Plan.CompleteAsync now lands in the thread of the message the user acted on in a 1:1 chat, the same place ctx.send puts it.
Before, Plan sent every activity to POST /v3/conversations/{id}/activities. A bare 1:1 conversation.id carries no thread, so the completion landed at the top level of the chat. Channels were not affected, because the channel conversation.id already carries ;messageid={root}.

Plan.CreateFromContext now reads the inbound reply chain placement from channelData and stores it on the Plan as ReplyChain, for chats only. A standalone CompleteAsync then calls CreateReplyChainActivityAsync. The SDK does not read or modify conversation.id.

A Plan rebuilt from saved PlanOptions keeps its placement. ReplyChain is omitted from JSON when null, so previously saved shapes load and re-serialize unchanged. The PlanBot sample's proactive flow now saves ReplyChain along with the two IDs.

Typing updates (start, update, stop, error) stay on the conversation. ReplyToId is still set on every Plan activity.

Public API change

New optional ReplyChain on PlanOptions and Plan, and a new PlanReplyChain type (ChatOrChannelId, ReplyChainId). Both are under the existing ExperimentalTeamsPlan attribute.

Testing

Unit tests cover a rebuilt Plan completing in its chain, typing staying on the conversation, a saved shape without a chain, and the CreateFromContext fill for a 1:1 thread, a top-level message and a channel thread.

No integration test was added, because the integration suite has no existing Plan coverage.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 01:50
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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.

🟢 Approval recommended

No active review issues were identified for the change to keep plan completions in the originating chat reply chain.

No open issues 🎉

What changed in this PR

Updates Plan.CompleteAsync to post in the originating reply chain for threaded 1:1 chats, matching ctx.send placement while preserving conversation routing for typing updates and channels.

Changes:

  • Adds optional, serializable reply-chain placement to Plan and PlanOptions.
  • Preserves placement when rebuilding a Plan, including in the proactive PlanBot sample.
  • Adds tests for completion routing, typing routing, and compatibility with saved options lacking a reply chain.
File Description
test/​Microsoft.Teams.Apps.UnitTests/​PlanTests.cs Tests restored placement, typing routing, and saved-shape compatibility.
test/​Microsoft.Teams.Apps.UnitTests/​ContextReplyChainPlacementTests.cs Tests context-derived routing for chat threads, top-level chats, and channels.
src/​Microsoft.Teams.Apps/​PlanOptions.cs Adds optional ReplyChain and the experimental PlanReplyChain type.
src/​Microsoft.Teams.Apps/​Plan.cs Captures and validates placement, routing completions into chat reply chains.
samples/​PlanBot/​PlanDemo.cs Saves reply-chain placement for delayed completion.

Review effort: Balanced

Corina (corinagum) and others added 2 commits November 4, 2026 17:53
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 17:13

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.

🟢 Approval recommended

The review identifies no active issues with the reply-chain routing and persistence changes.

No open issues 🎉

Review effort: Balanced

@corinagum
Corina (corinagum) added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 1276d91 Nov 5, 2026
7 checks passed
@corinagum
Corina (corinagum) deleted the cg/glowing-guacamole branch November 5, 2026 18:52
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.

3 participants