fix(telegram): validate reply message IDs - #72937
Conversation
|
Thanks for the focused routing fix. The premise is verified on current No blocking correctness or design-fit issue was identified in the PR diff. This is an automated hermes-sweeper review. |
SummaryOne PR addresses #72934. #72937 replaces duplicated, unguarded Telegram reply-ID conversions with bounded normalization, metadata-anchor fallback, and fail-closed private DM-topic routing across text, rich, control, and attachment paths. Related pull requests
Suggested consolidationKeep #72937 open with a salvage path: retain the shared reply-ID normalizer, metadata-anchor fallback, fail-closed DM-topic routing, and associated regression coverage as one focused fix for #72934. There are no competing or duplicate PRs to close. Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I72934(["issue #72934 (open)"])
P72937["PR #72937 (open)"]
P72937 -->|best fix| I72934
class I72934 open
class P72937 open
class P72937 best
class P72937 target
click I72934 "https://github.com/NousResearch/hermes-agent/issues/72934"
click P72937 "https://github.com/NousResearch/hermes-agent/pull/72937"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 16 kB of PR diffs, 6 kB of issue/PR text, 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
|
Composition heads-up from the adapter decomposition campaign (epic #78791): PR #78949 (slice A1) moves the DM-topic cluster — including Merge order so nothing is lost: merge #78949 first, then rebase this PR onto main — your hunks then apply to the mixin file cleanly (your base's parents are ancestors of A1's base, verified). Your fix is a good complement; the extraction deliberately preserves your seam. |
What does this PR do?
Validates Telegram reply-message IDs before any outbound routing path uses
them.
The adapter now accepts only positive 32-bit message IDs, falls back to a
valid DM-topic metadata anchor when an explicit value is malformed, and
refuses an unroutable private-topic send instead of raising or sending outside
the requested lane.
The behavior is aligned across legacy text, rich text, control prompts, voice,
images, documents, and other attachment paths. Existing
reply_to_mode: offtext/rich behavior remains intact.Related Issue
Fixes #72934
Type of Change
Changes Made
plugins/platforms/telegram/adapter.py:1..2147483647message-ID range;tests/gateway/test_telegram_reply_mode.py: cover malformed, oversized,boundary-value, metadata-fallback, control, document, and legacy sends.
tests/gateway/test_telegram_rich_messages.py: cover metadata fallback,non-retryable missing anchors, and
reply_to_mode: offon the rich path.How to Test
Run each routing group in an isolated pytest process:
Validation on rebased
dbc18c6d:65 passed.51 passed.119 passed.235 passed.git diff --check: passed.Checklist
Code
pytest tests/ -qsuite; focused tests are listedabove.
Documentation & Housekeeping
Screenshots / Logs
Before:
After: