Skip to content

bug(teams): message_limit hardcoded to 4096 causes unnecessary message splitting #1409

Description

@masami-agent

Summary

The Teams adapter uses a hardcoded message_limit() of 4096 characters (the Telegram limit), causing long replies to be split into multiple messages unnecessarily. Teams actually supports ~80 KB per message (~28,000 characters of markdown text).

Observed Behavior

When kiro-cli generates a reply longer than 4096 characters (e.g., listing 20 programming languages in a table), the reply is chunked into 3+ separate messages in Teams. Each chunk appears as the same content repeated with "查看更多" ("See more") truncation, creating a confusing user experience.

Pod logs confirm multiple gateway → teams sends per single dispatch:

gateway → teams conversation=19:Zpnr5IH...  (send 1)
gateway → teams conversation=19:Zpnr5IH...  (send 2)
gateway → teams conversation=19:Zpnr5IH...  (send 3)
batch dispatched ... tokens_per_event=[24]

Expected Behavior

A single reply under ~80 KB should be delivered as one Teams message, not split into multiple chunks.

Root Cause

From docs/platforms/schema/teams.toml:

[capability.message_length_limit]
max_chars = 0
note = "No fixed character count — a byte/UTF-16 budget, not a char cap. ~100 KB per bot message"

And the openab_features section:

GatewayAdapter::message_limit() returns 4096 (hardcoded 'Telegram limit', not Teams' ~100 KB / UTF-16 budget) — chunking works but the bound is generic, not Teams-tuned.

Proposed Fix

Update message_limit() for the Teams platform to return a higher value (e.g., 28000 characters) that matches Teams' actual capacity, rather than using the generic Telegram-derived 4096.

Environment

  • Chart: 0.9.0-beta.10
  • Mode: Unified
  • Bot type: Single Tenant
  • Tested: 2026-07-16

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions