Skip to content

[Bug]: channel draft streaming is post-hoc chunking; run_tool_call_loop does not consume provider streaming #2721

@Lemonawa

Description

@Lemonawa

Summary

Channel draft streaming (Telegram stream_mode=partial/on) appears progressive, but run_tool_call_loop does not consume upstream provider streaming APIs.

Affected component

channel

Severity

S2 - degraded behavior

Current behavior

  • run_tool_call_loop sends requests via provider.chat(...) instead of streaming APIs.
  • Final answer text is chunked and forwarded through on_delta only after completion.
  • This produces post-hoc chunking UX rather than true upstream token streaming.

Evidence on latest main (82b71530):

  • src/agent/loop_.rs:1509 uses provider.chat(...).
  • src/agent/loop_.rs:1978 starts chunking final text to on_delta after final response is ready.
  • src/channels/mod.rs:3672 streaming decision is based on channel draft support, not provider streaming path.
  • src/gateway/mod.rs:1478 already uses provider.stream_chat_with_history(...) (control path).

Expected behavior

When channel draft streaming is enabled and provider supports streaming, channel responses should consume upstream provider deltas progressively during generation, while preserving existing tool-call loop semantics and fallback behavior.

Steps to reproduce

# On latest main
rg -n "provider\.chat\(" src/agent/loop_.rs
rg -n "split_inclusive\(char::is_whitespace\)" src/agent/loop_.rs
rg -n "supports_draft_updates\(\)" src/channels/mod.rs
rg -n "stream_chat_with_history\(" src/gateway/mod.rs

Impact

Affected users: Telegram and other channels using draft updates.
Frequency: always on this path.
Consequence: degraded perceived responsiveness; "streaming" is not upstream-real-time.

Logs / stack traces

N/A (source-level deterministic reproduction)

ZeroClaw version

82b7153

Rust version

rustc 1.93.1 (01f6ddf75 2026-02-11)

Operating system

Darwin 25.3.0 arm64

Regression?

Unknown

Pre-flight checks

  • I reproduced this on the latest main branch or latest release.
  • I redacted secrets/tokens from logs.
  • I removed personal identifiers and replaced identity-specific data with neutral placeholders.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions