Skip to content

fix(msteams): wire blockStreaming config and onBlockReply for progressive message delivery#56134

Merged
BradGroux merged 1 commit intomainfrom
fix/msteams-block-streaming
Mar 28, 2026
Merged

fix(msteams): wire blockStreaming config and onBlockReply for progressive message delivery#56134
BradGroux merged 1 commit intomainfrom
fix/msteams-block-streaming

Conversation

@BradGroux
Copy link
Copy Markdown
Contributor

@BradGroux BradGroux commented Mar 28, 2026

Summary

  • Add blockStreaming to MSTeams config validation and typing so channels.msteams.blockStreaming is accepted.
  • Wire Teams block-streaming toggle into dispatch options via disableBlockStreaming, ensuring block streaming can be enabled/disabled from channel config.
  • Add/extend tests for schema acceptance and dispatcher option mapping.

Changes

  • src/config/zod-schema.providers-core.ts
    • Added blockStreaming: z.boolean().optional() to MSTeamsConfigSchema.
  • src/config/types.msteams.ts
    • Added blockStreaming?: boolean to MSTeamsConfig.
  • extensions/msteams/src/monitor-handler/message-handler.ts
    • Passes disableBlockStreaming through dispatch reply options.
  • extensions/msteams/src/reply-dispatcher.ts
    • Includes disableBlockStreaming in returned replyOptions.
  • extensions/msteams/src/block-streaming-config.test.ts
    • Covers blockStreaming schema acceptance/rejection cases.
  • extensions/msteams/src/reply-dispatcher.test.ts
    • Covers disableBlockStreaming mapping for blockStreaming: true | false | unset.

Testing

  • pnpm vitest run extensions/msteams/
    • 42 files passed, 438 tests passed.

Fixes #56041

Copilot AI review requested due to automatic review settings March 28, 2026 02:59
@openclaw-barnacle openclaw-barnacle bot added channel: msteams Channel integration: msteams size: S maintainer Maintainer-authored PR labels Mar 28, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 28, 2026

Greptile Summary

This PR closes the gap that prevented the blockStreaming config option from having any effect on the Microsoft Teams channel. Three root causes are addressed cleanly: the missing blockStreaming field in MSTeamsConfigSchema, the absent blockStreaming property in MSTeamsConfig, and the failure to propagate disableBlockStreaming through replyOptions to the downstream block-reply pipeline.

Key changes:

  • zod-schema.providers-core.ts: adds blockStreaming: z.boolean().optional() to MSTeamsConfigSchema, matching every other channel schema
  • types.msteams.ts: adds the corresponding blockStreaming?: boolean TypeScript property with JSDoc
  • message-handler.ts: spreads disableBlockStreaming into replyOptions using !msteamsCfg.blockStreaming when the field is explicitly boolean and undefined otherwise — identical to the Discord pattern, correctly falling through to blockStreamingDefault when unset
  • block-streaming-config.test.ts: five schema-level tests covering the expected cases

One minor style note: the test file uses a bare top-level await import(...) instead of a static import, which is unconventional compared to other tests in this extension.

Confidence Score: 5/5

Safe to merge — the fix is minimal, targeted, and mirrors the existing Discord implementation exactly.

All three root causes are properly addressed, the logic in message-handler.ts matches the Discord reference implementation, no existing behavior is altered when blockStreaming is unset (falls through to undefined), and the new tests exercise the schema correctly. The only finding is a P2 style note about the top-level await import in the test file, which does not affect correctness or runtime behaviour.

No files require special attention.

Important Files Changed

Filename Overview
extensions/msteams/src/block-streaming-config.test.ts New test file with 5 schema validation cases covering true, false, absent, coexistence with blockStreamingCoalesce, and non-boolean rejection. Uses a top-level await import which is unconventional for this codebase (minor style note), but the test logic itself is correct and comprehensive.
extensions/msteams/src/monitor-handler/message-handler.ts Adds disableBlockStreaming to the replyOptions spread, using !msteamsCfg.blockStreaming when the field is explicitly a boolean and undefined otherwise (preserving default fallback). Matches the pattern used by Discord and other channels exactly.
src/config/types.msteams.ts Adds blockStreaming?: boolean with a clear JSDoc comment, placed correctly before blockStreamingCoalesce for logical grouping.
src/config/zod-schema.providers-core.ts Adds blockStreaming: z.boolean().optional() to MSTeamsConfigSchema, closing the schema gap described in the PR. Positioned before blockStreamingCoalesce to match the TypeScript type ordering.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/msteams/src/block-streaming-config.test.ts
Line: 4

Comment:
**Prefer a static import over top-level `await import`**

The top-level `await import(...)` at module scope is unusual for this codebase — other test files use normal static imports (or `await import` inside `it()` blocks for mock-isolation purposes). Since the schema file has no side effects that need lazy loading and there's no mock isolation needed here, a regular static import is simpler and more idiomatic:

```suggestion
import { MSTeamsConfigSchema } from "../../../src/config/zod-schema.providers-core.js";
```

If there is a specific circular-dependency or import-chain reason that requires dynamic import, a `beforeAll` block would be more conventional than bare top-level await.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(msteams): wire blockStreaming config..." | Re-trigger Greptile

import { describe, expect, it } from "vitest";

// Import the schema directly to avoid cross-extension import chains
const { MSTeamsConfigSchema } = await import("../../../src/config/zod-schema.providers-core.js");
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.

P2 Prefer a static import over top-level await import

The top-level await import(...) at module scope is unusual for this codebase — other test files use normal static imports (or await import inside it() blocks for mock-isolation purposes). Since the schema file has no side effects that need lazy loading and there's no mock isolation needed here, a regular static import is simpler and more idiomatic:

Suggested change
const { MSTeamsConfigSchema } = await import("../../../src/config/zod-schema.providers-core.js");
import { MSTeamsConfigSchema } from "../../../src/config/zod-schema.providers-core.js";

If there is a specific circular-dependency or import-chain reason that requires dynamic import, a beforeAll block would be more conventional than bare top-level await.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/msteams/src/block-streaming-config.test.ts
Line: 4

Comment:
**Prefer a static import over top-level `await import`**

The top-level `await import(...)` at module scope is unusual for this codebase — other test files use normal static imports (or `await import` inside `it()` blocks for mock-isolation purposes). Since the schema file has no side effects that need lazy loading and there's no mock isolation needed here, a regular static import is simpler and more idiomatic:

```suggestion
import { MSTeamsConfigSchema } from "../../../src/config/zod-schema.providers-core.js";
```

If there is a specific circular-dependency or import-chain reason that requires dynamic import, a `beforeAll` block would be more conventional than bare top-level await.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a445b68ca1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

import { describe, expect, it } from "vitest";

// Import the schema directly to avoid cross-extension import chains
const { MSTeamsConfigSchema } = await import("../../../src/config/zod-schema.providers-core.js");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep extension tests inside extension package boundary

extensions/msteams/src/block-streaming-config.test.ts imports ../../../src/..., which escapes extensions/msteams. The repo guideline in AGENTS.md says “inside extensions/<id>/**, do not use relative imports/exports that resolve outside that same extensions/<id> package root.” This introduces a new cross-package dependency that couples the test to core internals and can break package-scoped extension workflows/checks; route this through an extension-local/public runtime barrel instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Wires the blockStreaming configuration option into the Microsoft Teams channel so progressive block-by-block reply delivery can be enabled/disabled consistently with other channels.

Changes:

  • Added blockStreaming?: boolean to the MS Teams Zod config schema.
  • Added blockStreaming?: boolean to the MSTeamsConfig TypeScript type.
  • Passed disableBlockStreaming through the MS Teams dispatch path based on channels.msteams.blockStreaming.
  • Added schema validation tests covering valid/invalid blockStreaming values.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

File Description
src/config/zod-schema.providers-core.ts Adds blockStreaming to MSTeamsConfigSchema so strict validation accepts it.
src/config/types.msteams.ts Extends MSTeamsConfig type with blockStreaming?: boolean.
extensions/msteams/src/monitor-handler/message-handler.ts Threads disableBlockStreaming into replyOptions to affect block streaming behavior at runtime.
extensions/msteams/src/block-streaming-config.test.ts Adds targeted tests ensuring the schema accepts/rejects blockStreaming correctly.

@BradGroux BradGroux force-pushed the fix/msteams-block-streaming branch 2 times, most recently from d7e23e5 to d646ddb Compare March 28, 2026 03:05
…e delivery

The MSTeams channel schema was missing the blockStreaming boolean field, causing
channels.msteams.blockStreaming config to fail strict() validation. Additionally,
the reply dispatcher never passed disableBlockStreaming through replyOptions.

Changes:
- Add blockStreaming: z.boolean().optional() to MSTeamsConfigSchema
- Add blockStreaming property to MSTeamsConfig type with JSDoc
- Wire disableBlockStreaming in reply-dispatcher replyOptions, matching the
  pattern used by Discord and other channels
- Add schema validation tests (5 tests) and reply-dispatcher tests (3 tests)

Closes #56041
@BradGroux BradGroux force-pushed the fix/msteams-block-streaming branch from d646ddb to 831fa57 Compare March 28, 2026 04:13
@BradGroux BradGroux merged commit 6b0e740 into main Mar 28, 2026
22 of 36 checks passed
@BradGroux BradGroux deleted the fix/msteams-block-streaming branch March 28, 2026 04:53
w-sss pushed a commit to w-sss/openclaw that referenced this pull request Mar 28, 2026
…nclaw#56134)

- Add blockStreaming and blockStreamingCoalesceDefaults to MSTeams channel plugin (was the only channel missing it)
- Wire disableBlockStreaming flag in reply dispatcher from config
- Flush pending messages immediately during generation when blockStreaming is enabled
- Add comprehensive tests for schema validation and progressive flush behavior

Refs openclaw#56041
alexcode-cc pushed a commit to alexcode-cc/clawdbot that referenced this pull request Mar 30, 2026
…nclaw#56134)

- Add blockStreaming and blockStreamingCoalesceDefaults to MSTeams channel plugin (was the only channel missing it)
- Wire disableBlockStreaming flag in reply dispatcher from config
- Flush pending messages immediately during generation when blockStreaming is enabled
- Add comprehensive tests for schema validation and progressive flush behavior

Refs openclaw#56041
alexjiang1 pushed a commit to alexjiang1/openclaw that referenced this pull request Mar 31, 2026
…nclaw#56134)

- Add blockStreaming and blockStreamingCoalesceDefaults to MSTeams channel plugin (was the only channel missing it)
- Wire disableBlockStreaming flag in reply dispatcher from config
- Flush pending messages immediately during generation when blockStreaming is enabled
- Add comprehensive tests for schema validation and progressive flush behavior

Refs openclaw#56041
livingghost pushed a commit to livingghost/openclaw that referenced this pull request Mar 31, 2026
…nclaw#56134)

- Add blockStreaming and blockStreamingCoalesceDefaults to MSTeams channel plugin (was the only channel missing it)
- Wire disableBlockStreaming flag in reply dispatcher from config
- Flush pending messages immediately during generation when blockStreaming is enabled
- Add comprehensive tests for schema validation and progressive flush behavior

Refs openclaw#56041
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

msteams: blockStreaming config has no effect (onBlockReply not wired)

2 participants