fix(telegram): preserve safe progress previews

This commit is contained in:
Vincent Koc
2026-05-03 23:09:54 -07:00
parent 0907c60dd7
commit 51e847fb96
2 changed files with 7 additions and 3 deletions

View File

@@ -55,6 +55,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Telegram/streaming: sanitize tool-progress draft preview backticks before shared compaction, so long backtick-heavy progress text still renders inside the safe code-formatted preview instead of collapsing to an ellipsis.
- Agents/Pi: suppress persistence for synthetic mid-turn overflow continuation prompts, so transcript-retry recovery does not write the "continue from transcript" prompt as a new user turn. Thanks @vincentkoc.
- Telegram: keep reply-dispatch lazy provider runtime chunks behind stable dist names and delete `/reasoning stream` previews after final delivery so package updates and live reasoning drafts do not leave Telegram turns broken or noisy. Thanks @BunsDev.
- Exec approvals: detect `env -S` split-string command-carrier risks when `-S`/`-s` is combined with other env short options, so approval explanations do not miss split payloads hidden behind `env -iS...`. Thanks @vincentkoc.

View File

@@ -238,10 +238,13 @@ function clipProgressMarkdownText(text: string): string {
return `${text.slice(0, MAX_PROGRESS_MARKDOWN_TEXT_CHARS - 1).trimEnd()}`;
}
function sanitizeProgressMarkdownText(text: string): string {
return text.replaceAll("`", "'");
}
function formatProgressAsMarkdownCode(text: string): string {
const clipped = clipProgressMarkdownText(text);
const safe = clipped.replaceAll("`", "'");
return `\`${safe}\``;
return `\`${sanitizeProgressMarkdownText(clipped)}\``;
}
export const dispatchTelegramMessage = async ({
@@ -509,7 +512,7 @@ export const dispatchTelegramMessage = async ({
if (options?.toolName !== undefined && !isChannelProgressDraftWorkToolName(options.toolName)) {
return;
}
const normalized = line?.replace(/\s+/g, " ").trim();
const normalized = sanitizeProgressMarkdownText(line?.replace(/\s+/g, " ").trim() ?? "");
if (streamMode !== "progress") {
if (!previewToolProgressEnabled || previewToolProgressSuppressed || !normalized) {
return;