Skip to content

feat(msteams): per-send replyStyle override so cron can post top-level (ENG-14117) - #20

Closed
jerhinesmith wants to merge 1 commit into
boonfrom
jerhinesmith/eng-14117-msteams-replystyle-override
Closed

jerhinesmith wants to merge 1 commit into
boonfrom
jerhinesmith/eng-14117-msteams-replystyle-override

Conversation

@jerhinesmith

@jerhinesmith jerhinesmith commented Jun 18, 2026 •

Copy link
Copy Markdown

What

Adds an opt-in replyStyleOverride that wins over the resolved/global MS Teams replyStyle for a single send — so a scheduled cron can post a new top-level channel message while interactive conversations stay threaded. Global channels.msteams.replyStyle is unchanged.

Threaded through three layers:

  • resolveMSTeamsProactiveReplyStyle({ …, replyStyleOverride }) — returns the override when set, else unchanged.
  • resolveMSTeamsSendContext({ …, replyStyleOverride }) — passes it through.
  • sendMessageMSTeams({ …, replyStyleOverride }) — accepts it.

Why (confirmed with Arief + live host)

Arguijo's surface is Teams (ticket was filed as Slack — corrected). Arief confirmed the goal: "each daily scheduled run posts a new top-level message, conversations stay threaded… boon-agent never posts top-level in teams."

On boon-agent10-pilot (read-only SSM): channels.msteams.replyStyle: "thread" (global). The Daily Email Summary cron posts via the message tool / msteams:send proactive path (confirmed: "name":"msteams:send" "sent proactive message"), which inherits the channel's resolved replyStyle → always threads. A global flip to "top-level" would also break conversational threading (extensions/msteams/src/policy.ts, send-context.ts), so a per-send override is the correct mechanism (mirrors Slack's existing topLevel).

Tests

extensions/msteams/src/send-context.test.ts +3 cases: top-level override on a thread-default channel; thread override on a top-level config; undefined override = no change. Full send-context/send/outbound/policy suites green (39). tsc -p tsconfig.extensions.json clean (0 errors).

⚠️ Open item for reviewer — last-mile wiring NOT included

This PR implements + tests the core override mechanism but does not yet expose it to the agent. Two follow-ups, deliberately left for review because they cross shared interfaces:

  1. Surface it as a tool param. Add a topLevel: true (or replyStyle) param to the msteams message tool (channel.ts) and map it to replyStyleOverride. This mirrors Slack's topLevel. The agent-facing send currently routes through the generic outbound.sendText contract (outbound.ts:142, {cfg,to,text,deps}) which has no style field — extending that shared interface is the cross-cutting part I didn't want to do speculatively.
  2. Or: per-cron delivery field. Alternatively wire CronDelivery.replyStyle (src/cron/types.ts) → cron delivery dispatch, so it's set on the job rather than per tool-call.

Which surface do we want — a message-tool param (works for any agent-initiated top-level post) or a cron-delivery field (cron-only)? Happy to complete whichever you prefer.

Scope / verification caveats

  • Draft, opened for @ariefrahman's review of the approach + the open-item decision above. Not the full fix until the last-mile wiring lands.
  • Not yet canary-verified end-to-end (canary arief-openclaw-test has Teams live but no top-level cron configured; I can verify once the tool-param/delivery surface is chosen).
  • Then per Arief: fleetwide sweep + AMI bake.

🤖 Generated with Claude Code


Summary by cubic

Adds a per-send replyStyleOverride to MS Teams so scheduled runs can post a new top‑level channel message while interactive conversations stay threaded. Addresses ENG-14117 without changing the global channels.msteams.replyStyle.

  • New Features

    • Added optional replyStyleOverride to sendMessageMSTeams, threaded through resolveMSTeamsSendContext and honored by resolveMSTeamsProactiveReplyStyle.
    • Override wins for a single send ("top-level" or "thread"). Omitted = existing behavior.
    • Tests: 3 cases covering top‑level override, thread override, and undefined override.
  • Migration

    • No config changes. To use, pass replyStyleOverride: "top-level" for cron posts.
    • Follow-up: expose via a message tool param (e.g., topLevel) or a cron delivery field. Please confirm preferred surface.

Written for commit 4e47310. Summary will update on new commits.

Review in cubic

…l (ENG-14117)

Arguijo (Teams) needs scheduled cron runs to post a NEW top-level channel
message while back-and-forth conversations stay threaded. Today everything
threads because channels.msteams.replyStyle resolves to the global "thread"
default (confirmed on host: the Daily Email Summary cron posts via the message
tool / msteams:send proactive path, which inherits the channel's resolved
replyStyle). There is no per-message override, so a global flip to "top-level"
would also break conversational threading.

Add an optional replyStyleOverride that wins over the resolved/global replyStyle
for a single send:
- resolveMSTeamsProactiveReplyStyle({ ..., replyStyleOverride }) returns the
  override when set (else unchanged).
- resolveMSTeamsSendContext({ ..., replyStyleOverride }) threads it through.
- sendMessageMSTeams({ ..., replyStyleOverride }) accepts it.

Global default unchanged → conversations stay threaded; opt-in only.

Tests: 3 new send-context cases (top-level override on a thread-default channel;
thread override on a top-level config; undefined override = no change). Full
msteams send/outbound/policy suites green (39); tsc -p tsconfig.extensions.json
clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@jerhinesmith
jerhinesmith marked this pull request as ready for review June 18, 2026 18:36

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

@jerhinesmith

Copy link
Copy Markdown
Author

CI note — security-fast failure is pre-existing and out of scope for this PR (head 4e47310).

The failing step is pnpm audit --audit-level=high, reporting 13 high/critical advisories in transitive production dependencies (@vitest/browser, baileys, @grpc/grpc-js, form-data, hono, protobufjs, undici, vite, ws). This PR changes no dependencies — it's a per-send replyStyle override in extensions/msteams/src. The advisories exist on boon independent of this branch and would need a separate dependency-bump PR to clear.

security-fast is not a required check (gh pr checks --required reports none), so it does not block merge. All other checks pass; cubic found no issues. Flagging rather than scope-creeping a 13-package upgrade into this fix.

@augusteo

Copy link
Copy Markdown

@jerhinesmith @insomnius @convyusboy
this is what my claude says about this PR. ok to close?


Is PR #20 helpful? — It was the seed, but it's now superseded and should be closed.

PR #20 (jerhinesmith/eng-14117-msteams-replystyle-override, open draft from 2026-06-18) added only the core mechanism and explicitly left the last-mile
wiring — "expose as a tool param" or "wire CronDelivery.replyStyle" — as an open reviewer decision.

Both of those follow-ups have since landed on boon as separate merged PRs, making #20's own diff redundant:

So the answer to #20's own open question ("which surface do we want — tool param or cron-delivery field?") was resolved by shipping both. The current boon
branch already has replyStyleOverride in send-context.ts:75-78, deliveryReplyStyleSchema in cron-tool.ts:111, and the topLevel param in channel.ts:390. PR
#20 is stale — it should be closed as superseded by #38 + #45 (I won't touch it without your say-so)

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.

2 participants