fix(telegram): reply to latest queued follow-up - #66027
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment
Small fix (64 lines). Telegram queued reply target fix.
Checked diff — no security concerns, no hardcoded secrets.
Looks good. No blocking issues.
Reviewed by Hermes Agent
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary (Re-review)
Verdict: LGTM / Comment
Fix ensures Telegram bot replies to the latest queued follow-up rather than an earlier one. Prior COMMENT review confirmed. No issues found.
1b0f132 to
e421bb1
Compare
|
Thanks for tracing the queued-event and Telegram ingress paths. The premise is confirmed on current main: Suggested changes
Automated hermes-sweeper review. |
SummaryFour PRs were reviewed: #46459 and #63298 directly address #45560, while #31496 fixes a separate three-sender delivery-loss path and #66027 fixes stale Telegram trigger/reply metadata after merging. #46459 adds visible boundaries while still collapsing canonical turns; #63298 preserves FIFO, history, and SessionDB boundaries and merges only the provider copy. Related pull requests
Duplicates#46459 and #63298 overlap on #45560 and explicit provider-visible boundary markers; #46459 is the narrower implementation and can be closed as a duplicate superseded by #63298. #31496 and #66027 address separate gateway defects and are not duplicates of them. Suggested consolidationKeep #63298 open with the salvage path centered on its FIFO, canonical-history/SessionDB boundary preservation, stable source IDs, and wire-only alternation repair; require the current head to retain the restored Cross-PR triage: Reviewed 4 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 186 kB of PR diffs, 10 kB of issue/PR text, 12 kB of discussion (16 comments), 3 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Bug Description
When multiple Telegram follow-ups arrive while a session is busy—or are coalesced by Telegram ingress batching—Hermes can combine their text but visibly reply to an older message or inject stale quoted-message context into the model.
Root Cause
Merged events appended newer content while retaining parts of the first event's trigger tuple. The production queue-mode debounce path, Telegram text batching, photo batching, and album/media-group batching could bypass or partially apply the original metadata refresh.
That produced mixed events such as a newest
message_idpaired with an olderreply_to_text, author, raw update, timestamp, or trust provenance. An internal event could also leave a merged user event marked internal.Fix
internal=Trueonly when every constituent event was internal, preventing privilege escalation.Test Plan
origin/main(7cb2d2cd4).54 passed.9462 passed, 13 skipped, 15 failed.origin/mainunder the same environment:9449 passed, 13 skipped, 15 failed.5 passed.git diff --checkand Ruff pass.Risk Assessment
Low-to-moderate. Accumulated content and media behavior are unchanged; only the identity, reply context, provenance, and trust state of an already-merged event are made coherent with its newest constituent.