#19962: feat(audit): config-based model traffic audit with redaction support
docs
channel: telegram
gateway
cli
agents
size: XL
Cluster:
Telegram Streaming Enhancements
## Summary
This PR adds:
1. A fully configuration-based model traffic audit system with sensitive data redaction capabilities
2. New Telegram draft stream configuration options for immediate message acknowledgment
## Part 1: Model Traffic Audit
### Features
- **Config-based activation**: `audit.modelTraffic.enabled` in `openclaw.json`
- **Sensitive data redaction**: Keys/values masked as `head****tail`
- **Granular controls**: Toggle `requestHeaders`, `requestBody`, `responseBody`, `responseHeaders`
- **Dual mode support**: Config overrides env var
### Files Added/Modified
- `src/gateway/audit-model-traffic.ts`
- `src/config/types.audit.ts`
- `src/agents/model-egress-audit.ts`
- `src/infra/fetch-egress-audit.ts`
- `docs/model-traffic-audit.md`
## Part 2: Telegram Draft Stream Improvements
### New Config Options
- `channels.telegram.draftMinInitialChars`: Minimum chars before sending initial draft (default: 30). Set to 0 for immediate send.
- `channels.telegram.initialDraftText`: Initial text to show immediately when processing starts
### Use Case
Shows "收到了 我想一想🤔……" immediately when a message is received, then updates with actual AI response. Improves perceived responsiveness.
### Files Modified
- `src/config/types.telegram.ts`
- `src/config/zod-schema.providers-core.ts`
- `src/telegram/bot-message-dispatch.ts`
- `src/telegram/draft-stream.ts`
### Usage
```json
{
"channels": {
"telegram": {
"draftMinInitialChars": 0,
"initialDraftText": "收到了 我想一想🤔……"
}
}
}
```
## Testing
- [x] Audit logs work correctly
- [x] Redaction masks sensitive fields
- [x] Telegram config validation passes
- [x] Hot reload applies config changes
- [x] Tested in group chat - initial text appears immediately
---
<!-- greptile_comment -->
Most Similar PRs
#20818: feat(telegram): add draftMinInitialChars and initialDraftText confi...
by lingzhua77 · 2026-02-19
69.4%
#19479: fix(telegram): skip redundant final edit in partial streaming mode
by v8hid · 2026-02-17
67.3%
#21051: security(gateway): audit logging + model allowlist enforcement
by richvincent · 2026-02-19
66.3%
#16708: fix(security): OC-17 add token redaction to error formatting, depre...
by aether-ai-agent · 2026-02-15
66.0%
#11208: fix(config): prevent __OPENCLAW_REDACTED__ corruption on config writes
by janckerchen · 2026-02-07
65.0%
#5764: fix(telegram): enable streaming in private chats without topics
by garnetlyx · 2026-01-31
65.0%
#19673: fix(telegram): avoid starting streaming replies with only 1-2 words
by emanuelst · 2026-02-18
64.2%
#19690: fix: security audit suppression, MoE false positive, and hook prefi...
by adityuhkapoor · 2026-02-18
64.1%
#7058: feat(telegram): add channel_post handler for broadcast channels
by waifu7498173 · 2026-02-02
63.6%
#19665: feat(telegram): native sendMessageDraft streaming (Bot API 9.3)
by edonadei · 2026-02-18
63.3%