Repository navigation
Conversation
Adds error detection via isTelegramRichMessageUnsupportedError() and fallback logic in three send paths (sendTelegramText, sendChunkedText, draft-stream sendRenderedMessage/editMessageText) to retry as regular sendMessage HTML when Telegram Bot API 10.1 sendRichMessage fails with a client-compatibility error (e.g. Telegram Web). Fixes openclaw#93794
4 test suites covering detection, send fallback, delivery fallback, and draft-stream fallback for rich message unsupported errors.
…llback - [P1] chunk replay guard: only fall back to HTML when no rich chunks were already delivered; prevents visible duplication (send.ts) - [P2] durable rich edit fallback: editMessageTelegram now catches unsupported errors on rich API branch, falls through to HTML edit - [P2] narrow unsupported matcher: UNSUPPORTED -> UNSUPPORTED_MESSAGE to reject unrelated API errors - Add tests for all three fixes (313 total, +5 new) This addresses all ClawSweeper findings from review item=94405.
…back proof
Adds an integration test that verifies the rich message fallback at the HTTP
fetch level by simulating the exact Telegram Bot API error response format.
This proves the full error handling chain:
1. Telegram API returns { ok: false, error_code: 400, description: '...not supported...' }
2. Our error detection correctly classifies the grammy-wrapped error
3. The fallback to HTML sendMessage produces exactly one non-duplicated message
Tests: 4 new, 317 total
) Some tool-call extraction/serialization pipelines can produce object keys with trailing spaces (e.g. 'schedule ' instead of 'schedule'). This causes the cron add/update tool to fail with confusing validation errors like "unexpected property 'schedule '" and "must have required property 'schedule'". Defensively trim whitespace from all object keys in canonicalizeCronToolObject before any schema processing. Nested keys were unaffected per the bug report, but trimming is applied broadly for robust defense-in-depth.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as duplicate/superseded: the intended cron fix is already on current main through the merged narrower replacement, and the extra Telegram work in this branch is separately tracked in a focused open PR. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Keep the merged recognized-key cron repair from #95674 and continue any Telegram rich-message fallback review in #95626. So I’m closing this here and keeping the remaining discussion on #95674 and #95626. Review detailsBest possible solution: Keep the merged recognized-key cron repair from #95674 and continue any Telegram rich-message fallback review in #95626. Do we have a high-confidence way to reproduce the issue? No for current main: the central cron failure is no longer reproducible from source because repairPaddedCronKeys normalizes recognized padded keys before strict gateway validation. The PR-introduced broad-trimming concern is source-visible in the branch diff. Is this the best way to solve the issue? No. This branch is no longer the best fix because the merged replacement is narrower, preserves duplicate and unknown malformed keys for strict validation, and avoids the unrelated Telegram changes. Security review: Security review needs attention: The PR has a concrete security-boundary concern in the obsolete cron branch because it normalizes arbitrary object keys before strict schema validation.
AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against c0ee7a1d20f0; fix evidence: commit 3a32d2439539, main fix timestamp 2026-06-22T20:24:59Z. |
) Some tool-call extraction/serialization pipelines can produce object keys with trailing spaces (e.g. 'schedule ' instead of 'schedule'), causing validation errors like 'unexpected property schedule '. Add trimObjectKeys() to canonicalizeCronToolObject() as defense-in-depth before any schema processing. Tests: - add job keys with trailing spaces → trimmed correctly - add job keys with leading spaces → trimmed correctly - update patch keys with trailing spaces → trimmed correctly - clean keys without whitespace → preserved as-is - flat-params recovery with clean keys still works alongside mangled ones 133 tests pass (128 existing + 5 new).
|
Updated with comprehensive test coverage:
PR body has full evidence. |
Fixes #95407
Problem
When calling the
crontool'saddorupdateaction with ajobparameter, specific top-level keys (schedule,sessionTarget,payload,enabled) can arrive with trailing whitespace appended (e.g."schedule "instead of"schedule"). This causes the tool to fail with confusing validation errors:Only specific top-level keys are affected —
nameanddescriptionremain intact. Nested keys are unaffected.The trailing whitespace originates in the model provider's tool-call extraction/serialization pipeline (reported with Qwen 3.5B via llama.cpp OpenAI-compatible API). The cron tool should be resilient to this.
Fix
Added
trimObjectKeys()tocanonicalizeCronToolObject()incron-tool-canonicalize.tsthat trims whitespace from all object keys before any schema processing. This is defense-in-depth — regardless of where trailing whitespace originates, keys like"schedule "become"schedule"before reaching validation.Tests
5 new tests covering all edge cases:
trims trailing whitespace from job object keysaddaction:schedule,sessionTarget,payload,enabled→ trimmedtrims trailing whitespace from patch object keys via update actionupdateaction: patch keys with trailing spaces trimmedtrims leading whitespace from job object keystrims trailing whitespace from flat-recovered job keyspreserves keys without whitespace when trimmingAll 133 tests pass (128 existing + 5 new):
Checks
oxfmt✓oxlint✓