Skip to content

fix(telegram): log inbound gateway watch messages - #71713

Merged
obviyus merged 3 commits into
openclaw:mainfrom
rubencu:codex/telegram-inbound-watch-log
May 8, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
rubencu:codex/telegram-inbound-watch-log

Conversation

@rubencu

@rubencu rubencu commented Apr 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Problem: WhatsApp inbound messages appear in gateway:watch, but accepted Telegram inbound messages did not emit the same normal watch-level summary.
  • Why it matters: operators could confirm WhatsApp delivery at a glance, while Telegram required deeper debugging even when message dispatch was working.
  • What changed: Telegram now logs an inbound summary after a message context is accepted and before dispatch, using the same no-content shape as other gateway channel logs.
  • What did NOT change (scope boundary): no Telegram routing, dispatch, auth, polling, message-content handling, or changelog behavior changed.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes N/A
  • Related N/A
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: Telegram built and dispatched inbound contexts without emitting a normal inbound gateway summary log, while WhatsApp already did.
  • Missing detection / guardrail: extensions/telegram/src/bot-message.test.ts covered dispatch/no-context behavior but did not assert gateway-watch observability.
  • Contributing context (if known): found while comparing gateway:watch output for WhatsApp and Telegram inbound messages.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/telegram/src/bot-message.test.ts
  • Scenario the test should lock in: dispatchable Telegram contexts emit one inbound summary, skipped contexts emit none, and summaries include length/media metadata without message content.
  • Why this is the smallest reliable guardrail: the behavior is local to the Telegram message processor immediately before dispatch.
  • Existing test that already covers this (if any): none before this PR.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

Telegram inbound messages now appear in normal gateway watch logs once OpenClaw accepts them for dispatch. The log includes sender/target identifiers, chat type, optional media content type, and character count; it does not include message content.

Diagram (if applicable)

Before:
[Telegram inbound] -> [context accepted] -> [dispatch] -> [no gateway watch summary]

After:
[Telegram inbound] -> [context accepted] -> [gateway watch summary] -> [dispatch]

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS local workspace
  • Runtime/container: repo pnpm lanes on Node 22-compatible workspace
  • Model/provider: N/A
  • Integration/channel (if any): Telegram gateway message processor
  • Relevant config (redacted): N/A

Steps

  1. Send a Telegram message to an OpenClaw Telegram bot with gateway:watch active.
  2. Observe that no normal inbound Telegram watch summary appears before this fix.
  3. Run the Telegram message processor tests after this fix.

Expected

  • Accepted Telegram inbound messages emit a normal gateway-watch summary without logging message content.

Actual

  • Covered by the updated unit tests and manual live Telegram verification from a real session.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Local validation:

  • pnpm docs:list
  • pnpm test extensions/telegram/src/bot-message.test.ts
  • pnpm format:check extensions/telegram/src/bot-message.ts extensions/telegram/src/bot-message.test.ts
  • git diff --check origin/main...HEAD
  • OPENCLAW_OXLINT_SKIP_LOCK=1 pnpm check:changed after removing the manual changelog entry and amending the commit (lanes: extensions, extensionTests; 95 files and 1411 tests passed)
  • codex review --base origin/main completed locally with no discrete correctness findings before opening this PR

Human Verification (required)

What I personally verified (not just CI), and how:

  • Verified scenarios: dispatchable Telegram contexts log exactly one inbound summary; no-context messages do not log; summary formatting omits message content and preserves length/media metadata; live Telegram inbound delivery was manually verified with a real session.
  • Edge cases checked: unknown/default formatting inputs, bot username target formatting, media content-type inclusion.
  • What you did not verify: the full pnpm build && pnpm check && pnpm test sweep.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

No GitHub bot review conversations exist yet. Local codex review --base origin/main reported no actionable findings.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: additional watch output could reveal message metadata to operators who already have gateway logs.
    • Mitigation: the log mirrors the existing no-content WhatsApp-style shape and includes only identifiers, chat/media metadata, and character count.

AI-Assisted Disclosure

  • AI-assisted: yes, implemented in a Codex session.
  • Degree of testing: fully tested for the touched surface with targeted and changed-file repo gates; full repo build/test sweep not run.
  • Prompt/session context: user requested investigation of missing Telegram gateway:watch inbound logs compared with WhatsApp, then requested codex review --base origin/main, commit, fork push, and PR creation. The manual changelog entry was removed after user correction because changelog is not edited manually.
  • Understanding confirmation: I understand this change adds Telegram inbound observability after context acceptance and before dispatch; it does not change routing, authorization, message delivery, changelog generation, or log raw message content.
  • Codex review: codex review --base origin/main was run locally and there were no findings to address.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S labels Apr 25, 2026
@rubencu
rubencu force-pushed the codex/telegram-inbound-watch-log branch from 0180541 to ccd5278 Compare April 25, 2026 18:52
@rubencu rubencu changed the title [codex] fix(telegram): log inbound gateway watch messages fix(telegram): log inbound gateway watch messages Apr 25, 2026
@rubencu
rubencu marked this pull request as ready for review April 25, 2026 19:04
@greptile-apps

greptile-apps Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a telegramInboundLog.info call in bot-message.ts to emit a gateway-watch summary after Telegram inbound contexts are accepted and before dispatch, mirroring the existing WhatsApp behavior. New tests cover the dispatch-path log emission, the no-context skip, and the formatTelegramInboundLogLine formatter directly.

Confidence Score: 5/5

This PR is safe to merge — it adds observability-only logging with no routing, auth, or dispatch changes.

The change is tightly scoped: a single info-level log line emitted after context acceptance, using the same no-content shape as other gateway channel logs. The mock setup correctly uses vi.hoisted + vi.mock so the module-level singleton picks up the test mock on dynamic import. All new behavior is covered by three focused tests. No logic, auth, or data-flow changes were made.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(telegram): log inbound gateway watch..." | Re-trigger Greptile

@clawsweeper

clawsweeper Bot commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
Review failed before ClawSweeper could summarize the requested change.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Real behavior proof
Not applicable: Real behavior proof was not assessed because the Codex review failed.

Next step before merge
Review did not complete, so no work-lane recommendation was made.

Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

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

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

What I checked:

  • failure reason: codex execution failed.
  • codex failure detail: Codex review failed for this PR with exit 1.
  • codex stdout: Per-item Codex failure; continuing with the rest of the shard.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)

Remaining risk / open question:

  • No close action taken because the review did not complete.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 270421f3dac6.

@rubencu
rubencu force-pushed the codex/telegram-inbound-watch-log branch 2 times, most recently from b5bc403 to a600bac Compare May 3, 2026 03:12
@obviyus
obviyus force-pushed the codex/telegram-inbound-watch-log branch from a600bac to 42036ed Compare May 8, 2026 12:48
@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 8, 2026
@obviyus obviyus added the proof: override Maintainer override for the external PR real behavior proof gate. label May 8, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 8, 2026
@obviyus
obviyus force-pushed the codex/telegram-inbound-watch-log branch from 42036ed to 860116e Compare May 8, 2026 12:52
@obviyus
obviyus force-pushed the codex/telegram-inbound-watch-log branch from 860116e to 2d2b2ed Compare May 8, 2026 12:55
@obviyus
obviyus merged commit 12e885d into openclaw:main May 8, 2026
104 checks passed
@obviyus

obviyus commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Landed via rebase onto main.

  • Scoped tests: pnpm test extensions/telegram/src/bot-message.test.ts; git diff --check origin/main...HEAD
  • Changelog: CHANGELOG.md updated under Unreleased
  • Land commit: 2d2b2ede666a3b7c3104574536075d4ee2d36ed7
  • Merge commit: 12e885da5f6935b88812bd6a910bf09d03e3457b

Thanks @rubencu!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram proof: override Maintainer override for the external PR real behavior proof gate. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants