Skip to content

Auto-send buffered stream output in group scope conversations#578

Draft
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-group-scope-message-sending
Draft

Auto-send buffered stream output in group scope conversations#578
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-group-scope-message-sending

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

Streaming currently requires app authors to branch on activity.conversation.isGroup and switch from stream.emit(...) to send(...) manually. This change moves that behavior into the framework: in group scope, streamed chunks are buffered and emitted as one final message.

  • Behavior change in HttpStream for group scope

    • Detects group conversations from ConversationReference (conversation.isGroup).
    • Suppresses intermediate streaming activity sends in group scope (no typing/stream update chunk creates).
    • On close(), sends a single normal message activity with the accumulated text/attachments/entities.
    • Removes channelData.streamType from the final group-scope send so it is not treated as a stream-final payload.
  • Non-group streaming behavior remains unchanged

    • Existing chunk/update + stream-final close flow is preserved for non-group conversations.
    • Added defensive close-path guard to avoid emitting stream-final without a stream id in non-group scope.
  • Focused coverage for new behavior

    • Added HttpStream spec validating that group-scope streaming:
      • buffers during emit/update,
      • performs no intermediate creates,
      • sends one final normal message on close.
// Before (app code had to branch)
if (activity.conversation.isGroup) {
  await send(new MessageActivity(response.content));
} else {
  await prompt.send(query, { onChunk: (chunk) => stream.emit(chunk) });
}

// After
await prompt.send(query, { onChunk: (chunk) => stream.emit(chunk) });
// group-scope now auto-buffers and sends on stream.close()

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • incoming-service.botframework.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js /sh sh tool�� tsup (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js modules/.bin/sh node .ts/�� ./dist/index.d.mts git s/node_modules/.bin/node get --local .ts/packages/apps/node_modules/.git status --porcelain --ignore-submodules | head -n 10 sh /.bi�� tsup git .ts/packages/node_modules/.bin/sh ec.ts src/app.prsh credential.helpe-c p/bin/bash sh (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js k/teams.ts/teamsjest sh -c tsup git e_modules/.bin/node HEAD (dns block)
  • service-1.botframework.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js /sh sh tool�� tsup (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js modules/.bin/sh node .ts/�� ./dist/index.d.mts git s/node_modules/.bin/node get --local .ts/packages/apps/node_modules/.git status --porcelain --ignore-submodules | head -n 10 sh /.bi�� tsup git .ts/packages/node_modules/.bin/sh ec.ts src/app.prsh credential.helpe-c p/bin/bash sh (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js k/teams.ts/teamsjest sh -c tsup git e_modules/.bin/node HEAD (dns block)
  • service-2.botframework.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js /sh sh tool�� tsup (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js modules/.bin/sh node .ts/�� ./dist/index.d.mts git s/node_modules/.bin/node get --local .ts/packages/apps/node_modules/.git status --porcelain --ignore-submodules | head -n 10 sh /.bi�� tsup git .ts/packages/node_modules/.bin/sh ec.ts src/app.prsh credential.helpe-c p/bin/bash sh (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js k/teams.ts/teamsjest sh -c tsup git e_modules/.bin/node HEAD (dns block)
  • token.botframework.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js /sh sh tool�� tsup (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js modules/.bin/sh node .ts/�� ./dist/index.d.mts git s/node_modules/.bin/node get --local .ts/packages/apps/node_modules/.git status --porcelain --ignore-submodules | head -n 10 sh /.bi�� tsup git .ts/packages/node_modules/.bin/sh ec.ts src/app.prsh credential.helpe-c p/bin/bash sh (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/teams.ts/teams.ts/node_modules/jest-worker/build/workers/processChild.js k/teams.ts/teamsjest sh -c tsup git e_modules/.bin/node HEAD (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI and others added 4 commits May 15, 2026 05:24
Agent-Logs-Url: https://github.com/microsoft/teams.ts/sessions/9987b20f-6ce2-450a-b7fe-67eec7f00efb

Co-authored-by: heyitsaamir <48929123+heyitsaamir@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/teams.ts/sessions/9987b20f-6ce2-450a-b7fe-67eec7f00efb

Co-authored-by: heyitsaamir <48929123+heyitsaamir@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/teams.ts/sessions/9987b20f-6ce2-450a-b7fe-67eec7f00efb

Co-authored-by: heyitsaamir <48929123+heyitsaamir@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix message sending for group scopes Auto-send buffered stream output in group scope conversations May 15, 2026
Copilot AI requested a review from heyitsaamir May 15, 2026 05:28
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.

[ai] Automatically just send streamed messages if in group-scope

2 participants