Skip to content

fix(telegram): reject zero and negative replyToMessageId values - #68306

Closed
1aifanatic wants to merge 2 commits into
openclaw:mainfrom
1aifanatic:fix/telegram-reply-id-validation
Closed

1aifanatic wants to merge 2 commits into
openclaw:mainfrom
1aifanatic:fix/telegram-reply-id-validation

Conversation

@1aifanatic

Copy link
Copy Markdown

Summary

  • normalizeTelegramReplyToMessageId now rejects 0 and negative values in addition to non-numeric inputs
  • Telegram message IDs are always positive integers; passing 0 or a negative value would result in a 400 Bad Request from the Telegram API
  • Both the numeric branch (typeof value === "number") and the string branch now enforce > 0

Test plan

  • normalizeTelegramReplyToMessageId(0) returns undefined
  • normalizeTelegramReplyToMessageId(-1) returns undefined
  • normalizeTelegramReplyToMessageId("0") returns undefined
  • normalizeTelegramReplyToMessageId("-5") returns undefined
  • normalizeTelegramReplyToMessageId(42) returns 42
  • normalizeTelegramReplyToMessageId("99") returns 99
  • UUID strings return undefined
  • Existing parseTelegramThreadId behaviour is unchanged

Telegram message IDs must be positive integers. The previous
normalizeTelegramReplyToMessageId allowed zero and negative values to
pass through, which would produce a 400 reply-not-found error from the
Telegram API. Add a > 0 guard for both the numeric and string code
paths so invalid values are treated as absent rather than forwarded.
@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S labels Apr 17, 2026
@greptile-apps

greptile-apps Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a > 0 guard to both the numeric and string branches of normalizeTelegramReplyToMessageId, and updates parseTelegramReplyToMessageId (which simply delegates to it) so that 0 and negative message IDs are rejected. The change is correct, the test coverage is comprehensive, and parseTelegramThreadId is intentionally left unchanged since thread IDs have different semantics.

Confidence Score: 5/5

Safe to merge — the fix is a narrow, correct validation tightening with full test coverage and no regressions.

Both changed code paths are straightforward and correct: the numeric branch truncates then guards with > 0, the string branch parses then guards with > 0. All edge cases (NaN, Infinity, "0", "-5", UUIDs, null, objects) are exercised by the new tests. No P0 or P1 issues found.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(telegram): reject zero and negative ..." | Re-trigger Greptile

@clawsweeper

clawsweeper Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open, but the patch is not merge-ready: the remaining Telegram reply-id bug still exists on current main and the latest release, while this stale branch reintroduces fractional-ID truncation and has no real Telegram proof.

Root-cause cluster
Relationship: canonical
Canonical: #68306
Summary: This PR is the only open same-repo item found for the remaining zero/negative Telegram reply-id validation gap; older related reports are closed or merged for overlapping invalid-ID cases.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection: current main still accepts 0 and negative integers through normalizeTelegramReplyToMessageId, and buildTelegramThreadReplyParams forwards accepted values into Telegram reply parameters. I did not run a live Telegram API repro in this read-only review.

Is this the best way to solve the issue?

No as submitted. The shared normalizer is the right layer, but the branch must preserve current strict integer parsing while adding the positive-only guard.

Security review:

Security review cleared: No concrete security or supply-chain concern found; the diff touches Telegram validation, colocated tests, and changelog text only.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-17T22:36:09Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is missing and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • hydro13: Merged fix(telegram): validate replyToMessageId before sending to Telegram API #56587, which added the shared Telegram reply-id normalizer and applied it to outbound send sinks for non-numeric and NaN values. (role: introduced adjacent validation behavior; confidence: high; commits: 865160e57292, 876919cb037f; files: extensions/telegram/src/outbound-params.ts, extensions/telegram/src/send.ts, extensions/telegram/src/draft-stream.ts)
  • Dallin Romney: Current blame on the central parser, reply-parameter builder, and strict helper import points to the recent current-main commit that moved this surface to shared strict integer helpers. (role: recent current-main contributor; confidence: medium; commits: 39e1be080ca0; files: extensions/telegram/src/outbound-params.ts, extensions/telegram/src/reply-parameters.ts, packages/normalization-core/src/number-coercion.ts)
  • Vincent Koc: The latest release tag points at the changelog refresh commit, relevant because this PR edits release-owned CHANGELOG.md. (role: recent release-note area contributor; confidence: medium; commits: aa69b12d0086; files: CHANGELOG.md)

Codex review notes: model internal, reasoning high; reviewed against db2786bde105.

@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes:

This PR updates Telegram reply-to message ID normalization to reject zero and negative numeric or string values and adds focused outbound-parameter tests while preserving thread ID parsing.

Maintainer follow-up before merge:

This is already a focused implementation PR with no discrete repair needed; the remaining action is maintainer review, CI, and merge or requested revision.

Review details

Best possible solution:

Land the narrow Telegram plugin validation fix: require reply-to message IDs to be positive integers in the shared normalizer, keep negative group/thread ID parsing unchanged, and keep the regression coverage focused on reply-id normalization rather than broader Telegram send behavior.

Acceptance criteria:

  • pnpm test extensions/telegram/src/outbound-params.test.ts extensions/telegram/src/send.test.ts
  • pnpm check:changed

What I checked:

Likely related people:

  • steipete: Local blame and git log --all --follow for the Telegram reply-id normalizer, reply-parameter builder, and colocated tests point to Peter Steinberger in the preserved current-main history; the history appears compressed around recent full-file additions, so this is best treated as routing context rather than sole authorship. (role: recent maintainer and current-main line owner; confidence: medium; commits: a2cf05c4fb8c, be8c24633aaa; files: extensions/telegram/src/outbound-params.ts, extensions/telegram/src/outbound-params.test.ts, extensions/telegram/src/reply-parameters.ts)

Remaining risk / open question:

  • This was a read-only review, so I did not execute the new tests or changed gate; CI or maintainer validation should cover that before merge.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 3215ab6de5db.

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 7, 2026
@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels May 13, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 6, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels Jun 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 7, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 7, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 14, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Jun 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 29, 2026
@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 29, 2026

This branch had an error being deployed

1 failed deployment
qa-live-shared — 5ebdeac6 Deployed Jun 7, 2026 by clawsweeper[bot] via Run agentic native Telegram proof #135844
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant