Repository navigation
fix(telegram): inline-button taps are timestamped with the card's send time instead of the tap - #170210
Conversation
…e card's send time Telegram callback queries carry no timestamp, and callback-built inbound messages inherited the date of the message that carries the buttons, so a tap made 20 minutes after a card was recorded as happening when the card was sent. Record the durable spool receipt time when an update is deserialized and use it (falling back to now) as the date for generic callback and interactive submit messages. Closes openclaw#169881
|
Codex review: needs maintainer review before merge. What this changesCallback-generated agent messages use the update’s receipt time instead of the original Telegram card’s send time. Example: A card sent at Unix time 1736380800 receives a button tap 20 minutes later.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current Telegram timestamp bug with a focused patch and real Telegram proof; no actionable introduced defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherTelegram durable ingress stores updates and receipt times; the callback routers build synthetic messages whose dates become agent context timestamps. flowchart LR
A[Telegram button tap] --> B[Durable ingress queue]
B --> C[Drain deserialization]
C --> D[Update receipt metadata]
D --> E[Callback message builder]
E --> F[Agent context]
Technical reviewBest possible solution: Land this receipt-based correction through the existing Telegram ingress and callback owners. Do we have a high-confidence way to reproduce the issue? Current-main source shows card-date inheritance into agent timestamps, and the supplied matched-baseline Telegram run observes it; this review executed no target code. Is this the best way to solve the issue? The patch corrects the synthetic-message producer, reuses durable receipt metadata, and covers sibling submission paths without changing routing or persistence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d08d23228ab2. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +26, Tests +61, Docs +2. Total +89 across 7 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 13, 2026, 6:46 PM ET / 22:46 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @obviyus for the review, the Telegram Test Server verification, and landing this! |
…d time instead of the tap (openclaw#170210) fix(telegram): stamp callback turns with the button-press time A Telegram inline-button click produced a turn timestamped with the original card message's time, not the time the user pressed the button. Callback updates now carry their receipt time, keyed by update, so generic, single-select and multiselect callbacks report when the press happened. Raw updates and ordinary message timestamps are unchanged. Proof: Telegram Test Server with a real TDLib user clicking generic, single-select and multiselect buttons on a built Gateway. On main, generic and multiselect callbacks kept the card's old time; with this change the provider timestamp matches the click receipt time. Thanks @maliv2, and @Irish-Joseph for the parallel fix in openclaw#170957. Co-authored-by: Muhammet Ali Aydın <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #169881
What Problem This Solves
Fixes Telegram button clicks appearing to the agent as old events when the button belongs to an older message.
User Impact
Generic button clicks, single-select and multi-select submissions, and plugin text submissions use the click's receipt time instead of the card's original send time. Ordinary message timestamps are unchanged.
Why This Change Was Made
The durable ingress queue already records receipt time. Keep that value in update-keyed metadata and use it when constructing callback-generated messages. This leaves Telegram update objects and the persisted payload format unchanged, and preserves the original receipt time when queued updates are replayed.
Retains @maliv2's implementation and adds typed regression fixtures, sibling submission coverage, and a queue close/reopen check. Thanks to @zori7 for the report and @Irish-Joseph for the related work in #170957.
No overlap with Pash/Sarah changes.
Evidence
An isolated built Gateway received real Telegram Test Server callbacks from the TDLib userbot; no human clicks were used. Read-only observation captured the completed agent context.
Candidate:
dd59024bab2(the final change after the runtime build is documentation-only). The matched baseline used the same runtime with the four changed Telegram production modules restored fromb5176e33011.ProviderMessageTimestamp(Unix ms)Candidate ingress receipt times were respectively
1791930773712,1791930778879, and1791930783825ms. Each context timestamp equals that receipt rounded down to Telegram's seconds precision. Serialization of each raw update was unchanged by metadata registration. The ordinary-message control retained its Telegram timestamp,1791930788000ms. All three candidate clicks and the ordinary send completed; baseline callbacks were also acknowledged, though the single-select context was not captured there.submitText, and real SQLite queue close/reopen receipt/identity handling.openai/gpt-5.4-mini: returnedP170957_LIVE_OK, one assistant turn, not aborted.Merge Danger
Two-way door: a revert restores the prior callback timestamp behavior. No configuration or storage migration is introduced. Blast radius is Telegram callback-generated agent messages; ordinary inbound messages and other channels are unchanged.