Skip to content

CLI backend (claude-cli) does not stream text deltas to Telegram preview — only native API path is wired #76869

@kai-jar

Description

@kai-jar

Summary

When using cliBackends.claude-cli (Anthropic Max plan via OAuth) as the agent backend, Telegram channel shows no live text-streaming preview during model response generation. The same agent on the native API path (anthropic/claude-*-4-6 direct) streams correctly.

Environment

  • OpenClaw: 2026.5.2 (also reproduced on 2026.4.29)
  • Node: 20.x
  • Channel: Telegram
  • Model backend: claude-cli/claude-opus-4-6 via ~/.local/bin/claude -p --output-format stream-json --include-partial-messages

Expected

Token-by-token text preview appears in Telegram while the model generates a response (same UX as native API path).

Actual

No preview. Only the final assembled message is delivered. Tool-progress indicators and the typing-action cue still work — just no text deltas.

Root cause (suspected)

  • Native API path: onPartialReplysignalTextDelta → Telegram draft stream ✅
  • CLI backend path: only fires emitAgentEvent({stream:"assistant"}) → not wired to the Telegram draft-stream sink ❌

The CLI subprocess is producing partial deltas (visible via --output-format stream-json --include-partial-messages), and the dialect parser handles them as assistant events, but they never reach the channel preview pipeline.

Config (relevant excerpt)

"cliBackends": {
  "claude-cli": {
    "command": "/home/ubuntu/.local/bin/claude",
    "args": ["-p", "--output-format", "stream-json", "--include-partial-messages"],
    "input": "arg",
    "output": "jsonl",
    "jsonlDialect": "claude-stream-json",
    "serialize": true,
    "sessionMode": "existing"
  }
}

Reproduction

  1. Configure agents.defaults.model.primary = "claude-cli/claude-opus-4-6" in openclaw.json
  2. Send a message via Telegram that triggers a long response
  3. Observe: typing indicator shows, no text preview updates until response is complete

Why it matters

Anthropic Max plan users are forced through the CLI backend (no API token access), so this affects all Max plan users on Telegram. Workaround would be to fall back to pay-per-use API, defeating the point of the Max subscription.

Suggested fix area

Wire the CLI backend's emitAgentEvent({stream:"assistant"}) deltas into the same sink the native path uses for signalTextDelta → channel draft stream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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