Skip to content

fix(telegram): inline-button taps are timestamped with the card's send time instead of the tap - #170210

Merged
obviyus merged 5 commits into
openclaw:mainfrom
maliv2:fix/telegram-callback-tap-timestamp
Oct 13, 2026
Merged

obviyus merged 5 commits into
openclaw:mainfrom
maliv2:fix/telegram-callback-tap-timestamp

Conversation

@maliv2

@maliv2 maliv2 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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 from b5176e33011.

Run and action Card send time (Unix ms) ProviderMessageTimestamp (Unix ms)
Baseline: generic callback 1791930964000 1791930964000
Baseline: multi-select 1791930964000 1791930964000
Candidate: generic callback 1791930743000 1791930773000
Candidate: single-select 1791930743000 1791930778000
Candidate: multi-select 1791930744000 1791930783000

Candidate ingress receipt times were respectively 1791930773712, 1791930778879, and 1791930783825 ms. 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, 1791930788000 ms. All three candidate clicks and the ordinary send completed; baseline callbacks were also acknowledged, though the single-select context was not captured there.

  • Eight focused regressions passed across the bot and ingress-drain suites (77.02 seconds): live/durable receipt timestamps, unchanged raw update, managed select/multiselect, plugin submitText, and real SQLite queue close/reopen receipt/identity handling.
  • Changed TypeScript files: formatting passed; lint reported zero warnings and errors. Updated documentation formatting passed.
  • Real-provider smoke on openai/gpt-5.4-mini: returned P170957_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.

…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
@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. 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. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Callback-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.

  • Before: The agent sees the tap timestamp as 1736380800000 ms.
  • After: The agent sees 1736382000000 ms, including when the queued callback is replayed later.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, source-correct bug fix with shipped Gateway proof, independent timestamp expectations, and durable recovery coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied built-Gateway Telegram Test Server observations exercise generic, single-select, and multiselect callbacks through completed agent context, with baseline comparisons and an ordinary-message control; the SQLite close/reopen regression separately verifies receipt recovery and resolves the earlier replay coverage gap.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A fresh button tap on an older Telegram card appears to the agent as an old interaction.
Reason: The official-release report and baseline observation establish a concrete defect, and all production changes serve its correction.

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
Reviewed head: dd59024bab21cb43d4ce288fe59181d37fee13b0

Before merge

None.

Findings

None.

Agent review details

How this fits together

Telegram 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 4a84117 adds extensions/telegram/src/bot-handlers.callback.runtime.ts:231 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4a84117188a6; files: extensions/telegram/src/bot-handlers.callback.runtime.ts)

PR surface

Source +26, Tests +61, Docs +2. Total +89 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 29 3 +26
Tests 2 72 11 +61
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 103 14 +89

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #169881
Summary: The canonical report and both candidate fixes concern callback-generated messages inheriting the original card date.

Members:

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Incorrect callback timestamps distort agent freshness and chronology, with impact limited to Telegram callback-generated messages.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Callback interactions change the timestamps presented to the agent; the supplied Telegram Test Server proof exercises this behavior.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-12T20:26:34.656Z sha ac38060 :: needs real behavior proof before merge. :: none

Reviewed October 13, 2026, 6:46 PM ET / 22:46 UTC (Revision 2).

@obviyus

obviyus commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 13, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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. labels Oct 13, 2026
@obviyus
obviyus merged commit d2261ea into openclaw:main Oct 13, 2026
121 of 123 checks passed
@obviyus

obviyus commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Landed in d2261ea. Thanks @maliv2! Verified with real button clicks on the Telegram Test Server: callback turns now carry the press time instead of the card's original time.

@maliv2

maliv2 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @obviyus for the review, the Telegram Test Server verification, and landing this!

@maliv2
maliv2 deleted the fix/telegram-callback-tap-timestamp branch October 13, 2026 23:49
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram inline-button taps are timestamped with the source message's date, not the tap time

2 participants