Skip to content

fix(telegram): honor abortSignal in startup probe retry loop - #109604

Merged
steipete merged 3 commits into
openclaw:mainfrom
wangmiao0668000666:fix/telegram-probe-abort-signal
Jul 17, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
wangmiao0668000666:fix/telegram-probe-abort-signal

Conversation

@wangmiao0668000666

Copy link
Copy Markdown
Contributor

What Problem This Solves

extensions/telegram/src/probe.ts has a retry loop for the initial getMe call that waits on a bare setTimeout. When a Telegram account startup is aborted (e.g. gateway shutdown, account removal, or session cancellation), the probe keeps sleeping through its full retry backoff and may issue additional getMe requests even though the result will be discarded. This wastes resources and delays shutdown.

Why This Change Was Made

The startAccount caller in extensions/telegram/src/channel.ts already owns ctx.abortSignal and passes it to the startup probe concurrency limiter, but it never reached probeTelegram. This change threads the signal through TelegramProbeOptions and replaces the bare setTimeout with sleepWithAbort from openclaw/plugin-sdk/runtime-env, the same helper already used throughout the Telegram plugin (polling, webhook, delivery, ingress spool).

This follows the same pattern as recent merged fixes in sibling plugins:

User Impact

Telegram account startup now respects cancellation promptly. If an account is stopped while the startup probe is retrying a network/DNS stall, the retry loop exits as soon as the abort signal fires instead of waiting out the remaining backoff and firing another getMe request.

Evidence

Before (probe.ts retry delay):

await new Promise((resolve) => {
  setTimeout(resolve, delayMs);
});

The delay could not be interrupted, so a second getMe fetch could be issued after abort.

After:

await sleepWithAbort(delayMs, options?.abortSignal);

The loop now exits immediately when the owning AbortSignal aborts, and the transport is not promoted to a fallback dispatcher for an abort-induced error.

Regression test: extensions/telegram/src/probe.abort-signal.integration.test.ts starts a local HTTP stub, destroys the first connection to force a retry, fires a real AbortController while the probe is in its backoff, and asserts that only one getMe request and one TCP connection are observed.

Validation run:

node scripts/run-vitest.mjs \\
  extensions/telegram/src/probe.test.ts \\
  extensions/telegram/src/probe.abort-signal.integration.test.ts
# Test Files  2 passed (2)
# Tests  14 passed (14)

pnpm tsgo:extensions
# passes
git diff --check
# clean

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S labels Jul 17, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 2:50 AM ET / 06:50 UTC.

Summary
The PR forwards the Telegram account abort signal into startup probing, makes the retry backoff abortable, suppresses fallback promotion after cancellation, and adds a real-socket regression test.

PR surface: Source +4, Tests +87. Total +91 across 3 files.

Reproducibility: yes. at source level: current main's bare retry timer cannot observe the account abort signal, and the real-socket regression path demonstrates the extra-attempt failure mode. A full live gateway reproduction was not supplied.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted gateway logs or terminal output showing a real Telegram account abort during startup-probe backoff and confirming that no additional getMe request occurs.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The real-socket loopback test is valuable integration coverage, but it remains a controlled Telegram API stub rather than an after-fix OpenClaw account startup/shutdown run; add redacted terminal output or gateway logs, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] The loopback socket test does not exercise the full gateway-to-startAccount shutdown or account-removal path, so the real lifecycle wiring and observable shutdown timing remain unproven outside the controlled test process.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the plugin-owned signal wiring and focused regression coverage, then add a redacted gateway transcript showing a real Telegram account abort during probe backoff with prompt shutdown and no subsequent getMe attempt.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Wait for contributor-supplied real account-lifecycle proof, then refresh review and normal checks against the current base; there is no concrete code defect for an automated repair worker.

Security
Cleared: The diff introduces no dependency, permission, secret-handling, package-resolution, downloaded-code, or supply-chain changes.

Review details

Best possible solution:

Keep the plugin-owned signal wiring and focused regression coverage, then add a redacted gateway transcript showing a real Telegram account abort during probe backoff with prompt shutdown and no subsequent getMe attempt.

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

Yes at source level: current main's bare retry timer cannot observe the account abort signal, and the real-socket regression path demonstrates the extra-attempt failure mode. A full live gateway reproduction was not supplied.

Is this the best way to solve the issue?

Yes: forwarding the existing owner signal and using the shared abortable-delay helper is the narrowest maintainable fix, with no new configuration, SDK contract, or competing retry implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9ac2f77487fa.

Label changes

Label justifications:

  • P2: This is a bounded Telegram lifecycle reliability fix with limited blast radius and no evidence of message loss, security impact, or an unusable runtime.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The real-socket loopback test is valuable integration coverage, but it remains a controlled Telegram API stub rather than an after-fix OpenClaw account startup/shutdown run; add redacted terminal output or gateway logs, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +4, Tests +87. Total +91 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 8 4 +4
Tests 1 87 0 +87
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 95 4 +91

What I checked:

Likely related people:

  • steipete: Authored the current-head commit that isolated the Telegram probe retry-abort regression proof and force-pushed the reviewed head. (role: recent reviewer and test refiner; confidence: high; commits: 019d29b6cfb6; files: extensions/telegram/src/probe.abort-signal.integration.test.ts)
  • MkDev11: Recent merged work on Telegram's sticky fallback transport recovery is closely related to the probe transport promotion behavior changed here. (newreleases.io) (role: adjacent transport behavior contributor; confidence: medium; files: extensions/telegram/src/probe.ts, extensions/telegram/src/fetch.ts)
  • danielgruneberg: Recent merged work specifically adjusted Telegram startup bot-label probe behavior, making this person relevant to the caller and probe lifecycle boundary. (newreleases.io) (role: startup probe contributor; confidence: medium; files: extensions/telegram/src/channel.ts, extensions/telegram/src/probe.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-17T03:29:19.063Z sha c3584b90d48f4b32e07f8b4bc6c8f2885c4fcf09 :: needs real behavior proof before merge. :: none

@steipete
steipete merged commit e01027d into openclaw:main Jul 17, 2026
107 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 18, 2026
…w#109604)

* fix(telegram): honor abortSignal in startup probe retry loop

* test(telegram): isolate probe retry abort proof

* fix(telegram): abort active startup probe requests

---------

Co-authored-by: Peter Steinberger <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…w#109604)

* fix(telegram): honor abortSignal in startup probe retry loop

* test(telegram): isolate probe retry abort proof

* fix(telegram): abort active startup probe requests

---------

Co-authored-by: Peter Steinberger <[email protected]>
@wangmiao0668000666
wangmiao0668000666 deleted the fix/telegram-probe-abort-signal branch October 28, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants