diff --git a/crates/openab-core/src/gateway.rs b/crates/openab-core/src/gateway.rs index caac2441e..1b7575317 100644 --- a/crates/openab-core/src/gateway.rs +++ b/crates/openab-core/src/gateway.rs @@ -499,7 +499,10 @@ impl ChatAdapter for GatewayAdapter { } fn message_limit(&self) -> usize { - 4096 // Telegram limit + match self.platform_name { + "teams" => 20000, // Teams ~80 KB UTF-16; 20000 BMP chars ≈ 40 KB (safe margin) + _ => 4096, // Telegram / generic limit + } } async fn send_message(&self, channel: &ChannelRef, content: &str) -> Result { diff --git a/docs/platforms/schema/teams.toml b/docs/platforms/schema/teams.toml index 42a325e85..364c4398c 100644 --- a/docs/platforms/schema/teams.toml +++ b/docs/platforms/schema/teams.toml @@ -126,7 +126,8 @@ pr = "" [[openab_features]] feature = "message_split" status = "partial" -note = "Core splits via `split_delivery`; `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." +pr = "#1410" +note = "Core splits via `split_delivery`; standalone `GatewayAdapter` returns 20000 for Teams (BMP-char budget ≈ 40 KB UTF-16). Unified Mode remains at 4096 (shared with LINE/Telegram) pending a channel-aware `message_limit_for()` API." source = ["crates/openab-core/src/adapter.rs#message_limit", "crates/openab-core/src/gateway.rs"] pr = "" diff --git a/src/unified_adapter.rs b/src/unified_adapter.rs index d04d1ba7a..5e7f6c157 100644 --- a/src/unified_adapter.rs +++ b/src/unified_adapter.rs @@ -130,7 +130,11 @@ impl ChatAdapter for UnifiedGatewayAdapter { } fn message_limit(&self) -> usize { - 4096 // conservative limit across platforms + // Unified Mode serves multiple platforms (Teams, LINE, Telegram, etc.) + // with different limits. Use the most conservative (LINE = 5000, + // Telegram = 4096). Platform-specific budgets require a future + // channel-aware message_limit_for() API. + 4096 } async fn send_message(&self, channel: &ChannelRef, content: &str) -> Result {