fix(telegram): fail DM topic sends without threadless retry#78575
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. Source inspection shows current main builds DM topic sends with Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the fail-closed Telegram plugin change once redacted live proof shows rejected DM topic IDs no longer fall back to plain DMs and accepted topic sends still stay in the intended topic. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main builds DM topic sends with Is this the best way to solve the issue? Yes for the current PR direction, with proof still missing. Failing direct/private topic sends loudly while preserving What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 2bdb77472624. |
539ba19 to
7badb8f
Compare
a4aaffa to
dbec502
Compare
dbec502 to
4af08d1
Compare
|
Landed via rebase onto main.
Thanks @tmimmanuel! |
Summary
400: Bad Request: message thread not found, but OpenClaw used to retry without the thread id and report success after sending into the plain DM instead of the intended topic.message thread not founderror instead of silently retrying threadless. Quote/formatting fallback behavior remains separate.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
dbec502085(fix/78463-stale-running-tasks), Telegram bot@tmimmanuel_openclaw_bot, target chat7116088418, topic id42159.dbec502085in/home/ubuntu/codes/tmimmanuel/openclaw-pr-78575.pnpm install --frozen-lockfile.pnpm start gateway run --verbose.pnpm start message send \ --channel telegram \ --target 7116088418 \ --thread-id 42159 \ --message '[openclaw #79455 PR78575 retest 2026-05-09T03:30Z] no threadless fallback expected' \ --json --verbosemessage.actionafter dropping the topic id. The CLI exits non-zero and exposes Telegram'smessage thread not founderror, so OpenClaw does not silently send into the plain DM.message_thread_idfor this bot/topic during the live test. A separate Telegram server/API fix or a reliable direct-topic parameter would be needed for successful topic delivery.50898c4a72, the same target/topic returned success after fallback while logging the same Telegram rejection:Root Cause (if applicable)
message_thread_idfailure as recoverable and retried without thread parameters, which converted a topic send into a plain DM send while still returning success.message_thread_idfor this bot/topic, anddirect_messages_topic_idhas been reported to return HTTP 200 without reliable topic placement.Regression Test Plan (if applicable)
extensions/telegram/src/bot/delivery.test.ts,extensions/telegram/src/send.test.ts,extensions/telegram/src/draft-stream.test.ts.User-visible / Behavior Changes
Telegram DM-topic send failures are now visible to users instead of being masked by a plain-DM fallback. A send to an affected topic may fail with Telegram's
message thread not founderror until Telegram accepts a valid topic parameter for that chat.Diagram (if applicable)
Security Impact (required)
NoNoNoNoNoYes, explain risk + mitigation: N/ARepro + Verification
Environment
@tmimmanuel_openclaw_bot7116088418, topic id42159Steps
7116088418with--thread-id 42159.message thread not foundbut still returns success after fallback.dbec502085and send the same command.message.actionfailure and CLI exit code 1 instead of silently retrying without topic.Expected
Actual
50898c4a72: returned success withmessageId: 15while logging400: Bad Request: message thread not found.dbec502085: returnedGatewayClientRequestErrorand exit code 1 with the same Telegram rejection.Evidence
Attach at least one:
Supplemental checks:
pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/telegram/src/bot/delivery.send.ts extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/draft-stream.ts extensions/telegram/src/draft-stream.test.ts extensions/telegram/src/send.ts extensions/telegram/src/send.test.tspnpm test extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/draft-stream.test.ts extensions/telegram/src/send.test.ts -- --reporter=verbosepnpm tsgo:extensionspnpm check:changedHuman Verification (required)
What you personally verified (not just CI), and how:
message thread not foundand returns success after fallback; live Telegram DM-topic send on PR head returns failure instead of masked success; gateway logs showmessage.actionchanges from success on main to failure on PR.Review Conversations
Compatibility / Migration
YesNoNoRisks and Mitigations