Repository navigation
feat(msteams): add topLevel parameter for per-send reply style override (ENG-14117) - #38
Merged
Merged
Conversation
…ply style override (ENG-14117) Implements the last-mile wiring for MS Teams replyStyleOverride mechanism, exposing it to agents via a topLevel parameter on the message tool. Changes: - Add replyStyleOverride parameter through send context chain: - sendMessageMSTeams accepts replyStyleOverride - resolveMSTeamsSendContext passes it through - resolveMSTeamsProactiveReplyStyle honors override with early return - Add topLevel boolean parameter to message tool schema for send and upload-file actions - Mirrors Slack's topLevel API for cross-platform consistency - Supports bidirectional override (force top-level OR force threading) - Accepts threadId: null as equivalent to topLevel: true - Handle topLevel in action handlers: - upload-file: read topLevel param, convert to replyStyleOverride, pass to sendMessageMSTeams - send (non-presentation): explicit handler to support topLevel before outbound fallthrough - send (presentation): no change, presentation cards don't support override - Add tests for replyStyleOverride mechanism: - Test top-level override on thread-default channel - Test thread override on top-level config - Test undefined override (no behavior change) This allows scheduled cron jobs to post top-level channel messages while interactive conversations stay threaded, without changing global config. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
There was a problem hiding this comment.
1 issue found across 4 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…resentation limitation - Fix return type of createMSTeamsTopLevelActionSchema to Record<string, TSchema> - Add explicit type for schema array: ChannelMessageToolSchemaContribution[] - Add satisfies ChannelMessageActionName[] to actions arrays for type safety - Import TSchema and ChannelMessageToolSchemaContribution from channel-contract - Document that topLevel parameter only works for non-presentation sends Fixes TypeScript compilation errors in check-prod-types and check-test-types. Addresses review comment about presentation card limitation by documenting it. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Collaborator
Author
|
/cr |
|
I'll analyze this and get back to you. |
There was a problem hiding this comment.
Reviewed — LGTM, approving.
What I verified:
- Logic is sound. The presentation
sendbranch runs and returns first, so the newif (ctx.action === "send" && !presentation)block is correctly gated to text sends only — no risk oftopLevelsilently no-op'ing on a card send within the same code path. - Slack parity confirmed. The
readBooleanParam(params, "topLevel") === true || threadId === null → top-levelmapping matchesextensions/slack/src/message-action-dispatch.ts. The MS Teams version adds the bidirectionaltopLevel: false → threadcase, which is a clean superset and consistent with the documented behavior. - Override plumbing is correct.
replyStyleOverridethreads throughsendMessageMSTeams → resolveMSTeamsSendContext → resolveMSTeamsProactiveReplyStyle, and the early-return inresolveMSTeamsProactiveReplyStyleguarantees the per-send override wins over the globalreplyStylewithout mutating global config. Theundefinedcase is a proven no-op. - Tests exist and cover the right cases — top-level override on a thread-default channel, thread override on a top-level config, and undefined (no behavior change).
- CI is green on head SHA
0c6cf3d—check-prod-types,check-test-types,check-lint, and the fullchecks-node-*matrix all SUCCESS. - cubic's one P2 (presentation cards ignore
topLevel) is resolved: scoped to non-presentation sends + documented in the param description, and cubic acknowledged the resolution. Adaptive-cardreplyStyleOverrideis a reasonable follow-up, not a blocker.
Nit (non-blocking): the topLevel → replyStyleOverride mapping block is duplicated verbatim in the send and upload-file handlers. Fine as-is; a tiny local helper would DRY it up if you touch this again.
Ship it. 🧙
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

What Problem This Solves
Fixes ENG-14117: MS Teams agents can only reply in thread, cannot post top-level channel messages.
Root cause: The global
channels.msteams.replyStyle: "thread"configuration makes ALL messages threaded, including scheduled cron announcements that should be top-level.Solution: Add a
topLevelparameter to the MS Teams message tool that allows per-send override of the reply style, without changing global configuration.Why This Change Was Made
This change enables scheduled cron jobs to post top-level channel messages while keeping interactive conversations threaded. For example:
The implementation mirrors Slack's existing
topLevelparameter for cross-platform API consistency.User Impact
Before
All messages are threaded, including cron announcements.
After
Agents can explicitly control reply style per-message using topLevel parameter.
Implementation Details
Core Mechanism (from PR #20)
Last-Mile Wiring (this PR)
Design Decisions
Evidence
Files Changed
Code Statistics
4 files changed, 162 insertions(+), 16 deletions(-)
Verification
Related
Related to PR #20 which implemented the core replyStyleOverride mechanism. This PR completes the implementation by adding the last-mile wiring.
Co-Authored-By: Claude Sonnet 4.5 [email protected]
Summary by cubic
Adds a per-send reply style override for MS Teams via a
topLevelparameter so cron announcements can post as top‑level messages while conversations stay threaded. Addresses Linear ENG-14117 without changing globalchannels.msteams.replyStyle.New Features
topLevelboolean to MS Teams message tool forsendandupload-file.replyStyleOverridethroughsendMessageMSTeamsandresolveMSTeamsSendContext; honored early inresolveMSTeamsProactiveReplyStyle.topLevel: trueorthreadId: null→ top‑level;topLevel: false→ thread.Bug Fixes
topLeveland schema contributions (return type, action arrays, imports).extensions/msteams/src/channel.tswithoxfmt.Written for commit 0c6cf3d. Summary will update on new commits.