#19471: fix(gateway): honor deliver param in chat.send
app: web-ui
gateway
size: S
Cluster:
Network Error Handling Improvements
## Summary
- **Problem:** `chat.send` accepts `deliver: boolean` but ignores it — replies stay local to the WebSocket client
- **Why it matters:** TUI users with `--deliver` expect replies forwarded to their session's delivery channel (e.g. Telegram)
- **What changed:** Added `deliverChatReply` that resolves the session's external channel and calls `deliverOutboundPayloads` with `bestEffort: true`
- **Scope boundary:** Only `chat.send` delivery path; no changes to agent.send, dispatcher, or session state
## Change Type
- [x] Bug fix
## Scope
- [x] Gateway / orchestration
## Notes
When TUI connects it overwrites `deliveryContext.channel` to `webchat`, so `resolveAgentDeliveryPlan` loses the original channel. `inferChannelFromTarget` works around this by extracting the channel from the `to` prefix (e.g. `telegram:123` → `telegram`) and validating it with `isDeliverableMessageChannel`.
## Testing
- [x] `pnpm build`
- [x] `pnpm check` (format + lint clean)
- [x] `pnpm test` (5683 pass, 1 pre-existing failure in `web/auth-store.ts`)
- [x] Manual: `openclaw --dev tui --session main --deliver` → reply delivered to Telegram
Most Similar PRs
#17527: fix(gateway): allow WebChat to attach to main session regardless of...
by Glucksberg · 2026-02-15
68.9%
#3182: fix(gateway): use canonical session key in chat.send
by chrisherold · 2026-01-28
67.9%
#17337: fix(delivery): keep route fields paired to channel during context m...
by Glucksberg · 2026-02-15
66.4%
#11123: Fix webchat→external channel cross-delivery
by jingkang0822 · 2026-02-07
65.9%
#19486: fix(gateway): mirror delivered agent replies into routed target ses...
by kite010kite · 2026-02-17
64.1%
#8598: fix: emit agent events for CLI agents targeting webchat
by dbottme · 2026-02-04
63.9%
#19284: fix(delivery): treat AbortErrors as failures for retry
by EdGuan · 2026-02-17
63.6%
#5391: fix(commands): prevent webchat/tui from inheriting messaging channe...
by Glucksberg · 2026-01-31
63.4%
#23048: feat(session): add `announceDeliver` option to suppress auto-delive...
by nszhsl · 2026-02-21
62.7%
#16949: fix(gateway): deliver chat:final even when sessionKey is unresolved (…
by ekleziast · 2026-02-15
62.0%