Skip to content

fix(telegram): expose spooled handler timeout config#87891

Closed
khang-dogo wants to merge 1 commit into
openclaw:mainfrom
khang-dogo:fix/telegram-spooled-handler-timeout-config
Closed

fix(telegram): expose spooled handler timeout config#87891
khang-dogo wants to merge 1 commit into
openclaw:mainfrom
khang-dogo:fix/telegram-spooled-handler-timeout-config

Conversation

@khang-dogo

@khang-dogo khang-dogo commented May 29, 2026

Copy link
Copy Markdown

Summary

  • expose channels.telegram.spooledUpdateHandlerTimeoutMs with top-level and per-account config support
  • pass the configured value into Telegram isolated polling sessions
  • document the timeout and regenerate bundled channel config metadata

Why

Telegram isolated ingress already fails stale claimed spool updates after a handler timeout, but operators could not tune that timeout from channels.telegram. A wedged .processing file can therefore keep a same-chat lane blocked until the default 25 minute timeout.

Runtime Proof

I ran a redacted local runtime harness against the PR head using the real TelegramPollingSession, real spool files, real reply-fence timeout recovery path, and a fake Telegram Bot runtime to avoid live network calls. The harness configured isolatedIngress.spooledUpdateHandlerTimeoutMs = 200, wrote two same-lane spooled updates, wedged update 42, and verified update 43 drained only after timeout recovery restarted isolated ingress.

{
  "configuredTimeoutMs": 200,
  "configuredAbortGraceMs": 200,
  "elapsedMs": 475,
  "workerCreateCount": 2,
  "botConstructCount": 2,
  "events": [
    "first:42",
    "second:43"
  ],
  "failedUpdateIds": [
    42
  ],
  "pendingUpdateIds": [],
  "timeoutLog": "[telegram] Telegram isolated polling spool handler timed out behind update 42 on lane telegram:-100:topic:10 after 205ms; marking the update failed, aborting active reply work, and restarting isolated ingress so later updates can drain."
}

This shows the configured timeout was honored by the isolated-ingress runtime path: update 42 was failed after the configured timeout budget and the later same-lane update 43 drained after the restart.

Validation

  • pnpm config:channels:check
  • pnpm exec vitest run extensions/telegram/src/config-schema.test.ts extensions/telegram/src/polling-session.test.ts passed locally while preparing the patch. A later rerun in this workspace timed out in Vitest/Rolldown pre-test bundling with repeated plugin timing warnings before any assertion output.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram size: XS triage: dirty-candidate Candidate: broad unrelated surfaces; may need splitting or cleanup. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 29, 2026
@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution. ClawSweeper proposes closing this for now: the implementation may be reasonable, but passing review and proof does not establish that OpenClaw should add this product surface.

Close for unconfirmed product direction: the patch is coherent and proof-backed, but it adds a new public Telegram operator config contract without maintainer sponsorship for the key name, bounds, default, and support commitment.

This is a proposal only until the separate default-off apply policy is enabled and all live maintainer-signal checks pass. A maintainer can sponsor the direction, request a narrower version, or apply clawsweeper:human-review to keep it open.

Review details

Best possible solution:

Keep the internal recovery path and the linked lane-release fix separate; expose a public timeout knob only if a maintainer sponsors the API name, bounds, default, docs, and support contract.

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

Yes for the claimed config gap: current main has the internal isolated-ingress timeout hook but no public schema/type/docs/monitor wiring for channels.telegram.spooledUpdateHandlerTimeoutMs. I did not run tests because this review is read-only.

Is this the best way to solve the issue?

No as a merge path: the implementation is narrow and plausible, but adding a public Telegram config knob is not the best default without maintainer sponsorship. The safer path is to land the runtime lane-release repair separately and add this tuning surface only after the API contract is accepted.

Security review:

Security review cleared: Security review cleared: the diff changes Telegram config schema/types/docs/generated metadata/tests and one option-plumbing line, with no dependency, lockfile, workflow, secret, permission, or code-execution surface concern found.

AGENTS.md: found and applied where relevant.

What I checked:

  • Repository policy makes this compatibility-sensitive: Root policy treats config/default additions as compatibility-sensitive and expects review metrics plus maintainer-visible risk for public operator surfaces. (AGENTS.md:31, 82dfd8910743)
  • Telegram maintainer note checked: The Telegram maintainer note requires stronger live proof for transport, streaming, topics, callbacks, authorization, and reply-context changes; this PR is an internal timeout/config surface, so the runtime harness is relevant but product direction remains separate. (.agents/maintainer-notes/telegram.md:37, 82dfd8910743)
  • Current main has an internal timeout hook: Current main resolves opts.isolatedIngress?.spooledUpdateHandlerTimeoutMs or the environment override and falls back to the 25-minute isolated-ingress backlog stall budget. (extensions/telegram/src/polling-session.ts:393, 82dfd8910743)
  • Current main does not expose the public config key: The monitor passes adjacent Telegram account config into TelegramPollingSession, but current main does not pass a public spooledUpdateHandlerTimeoutMs value. (extensions/telegram/src/monitor.ts:301, 82dfd8910743)
  • Current schema gap confirmed: Current main exposes pollingStallThresholdMs in the Telegram account schema but has no public spooledUpdateHandlerTimeoutMs schema field. (src/config/zod-schema.providers-core.ts:298, 82dfd8910743)
  • PR adds the public config contract: The PR adds spooledUpdateHandlerTimeoutMs to the Telegram schema with 30,000 to 3,600,000 ms bounds and documentation text. (src/config/zod-schema.providers-core.ts:293, 1bdf43652ce7)

Likely related people:

  • joshavant: Authored the merged Telegram isolated-ingress and stalled spool-handler recovery work that shaped this timeout, reply-fence, and restart path. (role: feature-history owner; confidence: high; commits: fd244fd76de3, b7735f88fa27, 9921825e1795; files: extensions/telegram/src/polling-session.ts, extensions/telegram/src/polling-session.test.ts, extensions/telegram/src/telegram-ingress-spool.ts)
  • 0xghost42: Authored the recent merged lone-active-spooled-handler timeout recovery PR on the same polling-session timeout path. (role: recent adjacent contributor; confidence: high; commits: 11b6c01198a0, 9f7577d9d08d; files: extensions/telegram/src/polling-session.ts, extensions/telegram/src/polling-session.test.ts)
  • vincentkoc: Recent history includes Telegram/config schema maintenance and adjacent spool claim preservation work near the affected surfaces. (role: recent config and Telegram area contributor; confidence: medium; commits: 2ddebf3897be, 49572863d3c1, 2da361a3457d; files: src/config/zod-schema.providers-core.ts, extensions/telegram/src/telegram-ingress-spool.ts, extensions/telegram/src/polling-session.ts)

Codex review notes: model internal, reasoning high; reviewed against 82dfd8910743.

@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels May 29, 2026
@khang-dogo

Copy link
Copy Markdown
Author

Added runtime proof to the PR body.

The proof uses the real TelegramPollingSession, real isolated-ingress spool files, and real reply-fence timeout recovery path with a fake Telegram Bot runtime to avoid live network calls. It shows spooledUpdateHandlerTimeoutMs = 200 causing update 42 to be failed after ~205ms and update 43 on the same lane draining after the restart.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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 May 29, 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 29, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels May 29, 2026
@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 29, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels May 29, 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 29, 2026
@clawsweeper clawsweeper Bot removed the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Jun 20, 2026
@clawsweeper clawsweeper Bot added the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Jun 20, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 20, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 5, 2026
@steipete steipete closed this Jul 9, 2026
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. triage: dirty-candidate Candidate: broad unrelated surfaces; may need splitting or cleanup. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants