Skip to content

improve(telegram): polling workers start faster and use half the memory - #190890

Merged
vincentkoc merged 4 commits into
openclaw:mainfrom
boeingchoco:perf/telegram-ingress-worker-light-import
Nov 26, 2026
Merged

vincentkoc merged 4 commits into
openclaw:mainfrom
boeingchoco:perf/telegram-ingress-worker-light-import

Conversation

@boeingchoco

@boeingchoco boeingchoco commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #190889

What Problem This Solves

Each Telegram polling account runs getUpdates in its own worker thread, and every worker loads the debug proxy capture store (about 1,250 modules, roughly 20 MiB of heap) even though capture is off unless OPENCLAW_DEBUG_PROXY_ENABLED is set. A Gateway with three bot accounts carries about 60 MiB for code that never runs, and every polling restart pays the import again.

User Impact

Each Telegram polling worker holds about half the heap (42.2 → 21.9 MiB) and reaches its first successful poll in less than half the time (487 → 202 ms). With debug proxy capture enabled, the worker records getUpdates exchanges exactly as it does on main.

Why This Change Was Made

The worker imported the transport through fetch.ts, whose static plugin-sdk/proxy-capture import evaluates the capture store graph. The transport core now lives in fetch-transport.ts and takes the capture owner functions as an option. fetch.ts keeps resolveTelegramTransport and resolveTelegramFetch with the same signatures and passes the SDK functions, so main-thread callers keep capture unchanged.

The parent decides capture with the owner's resolveDebugProxySettings().enabled and passes it in workerData. Only then does the worker import fetch.js, after its stop listener is registered. The worker marker moves to a side-effect-free protocol module; importing it from the parent factory also pulled in process-runtime. The six type assertions that move with the transport now carry // SAFETY: comments, so the assertion baseline loses its Telegram fetch entry instead of moving it.

Evidence

Acceptance rule written before measuring: correctness identical, evaluated modules −30% or more, retained worker heap −10 MiB or more, first poll-success wall and CPU median ≤ 1.05× and p95 ≤ 1.20×, steady CPU per poll ≤ 1.05×.

Built worker against a loopback Bot API (one empty short poll, a 20-update batch acked like the parent spool, then empty polls), 10 samples per arm, order alternating each sample, idle host (load 0.2–0.7):

node scripts/perf/telegram-ingress-worker-measure.mjs --build-dir <head> --compare-build-dir <base> --samples 10 --output <json>
Metric (median) main 0ce08d2 this branch ratio p95 ratio
Evaluated modules 1,794 550 0.31 0.31
Worker heap after full GC 42.21 MiB 21.86 MiB 0.52 0.52
Construction → first poll-success 486.7 ms 202.2 ms 0.42 0.42
Worker CPU to first poll-success 483.7 ms 199.3 ms 0.41 0.45
Worker CPU, 20-update batch 4.51 ms 2.15 ms 0.48 0.30
Worker CPU per steady empty poll 3.04 ms 2.88 ms 0.95 0.94

Both arms send the same poll sequence (offsets null, null, 1020, timeouts 0, 1, 1) and ack update 1019.

Whole Gateway, built dist of each checkout, booted from a copied state with three Telegram polling accounts inside a network-less sandbox (the workers stay in their poll retry loop, which keeps the import cost and drops the traffic). 5 boots per arm, order flipping each round, idle host (load 0.35–0.91). Each boot waits for /healthz, settles 120 s, then opens Node's inspector with SIGUSR1, forces a full GC in every isolate and reads Runtime.getHeapUsage per worker. Rule written before the run: Telegram worker heap median −10 MiB or more each, process RSS median not higher, spawn → /healthz median ≤ 1.10×.

Metric (median of 5 boots) main 0ce08d2 this branch change
Heap per Telegram worker after full GC (3 per boot) 42.10 MiB 21.77 MiB −20.3 MiB
All worker heaps after full GC 726.2 MiB 665.6 MiB −60.6 MiB
Main isolate heap after full GC 328.1 MiB 328.3 MiB 1.00×
Process RSS after 120 s settle 1,881 MiB 1,786 MiB −95 MiB
Process RSS after forced GC 1,751 MiB 1,652 MiB −99 MiB
Spawn → /healthz 200 7,807 ms 7,794 ms 1.00×

The Telegram heap spread is under 0.03 MiB in both arms. The fifth boot of each arm had extra non-Telegram workers (29 and 27 instead of 23), which raises that boot's RSS in both arms and leaves the medians unchanged.

Capture enabled, whole Gateway: fresh state, one Telegram polling account whose apiRoot points at a loopback fake Bot API (first getUpdates empty, the second returns update 5000, then empty), network-less sandbox, one run per build:

openclaw proxy run -- env OPENCLAW_STATE_DIR=<gateway state> openclaw gateway run

The Gateway child gets its own state dir because proxy run holds the owner lease of its own. The run stops after the fifth getUpdates (still in flight at shutdown, so four pairs are recorded); openclaw proxy sessions --json then lists one proxy-run session (34 events on this branch, 36 on main; the extra two are the sandbox's failed DNS lookups for update checks). These are the getUpdates rows of that session's capture_events, with the bot token replaced by <token> and the loopback host:port by <fake-bot-api>:

kind      method  path                                  status  stored body                          meta_json
request   POST    <fake-bot-api>/bot<token>/getUpdates  -       offset=none timeout=0 limit=100      {"subsystem":"telegram-fetch"}
response  POST    <fake-bot-api>/bot<token>/getUpdates  200     ok=true results=0                    {"subsystem":"telegram-fetch"}
request   POST    <fake-bot-api>/bot<token>/getUpdates  -       offset=none timeout=30 limit=100     {"subsystem":"telegram-fetch"}
response  POST    <fake-bot-api>/bot<token>/getUpdates  200     ok=true results=1 update_ids=[5000]  {"subsystem":"telegram-fetch"}
request   POST    <fake-bot-api>/bot<token>/getUpdates  -       offset=5001 timeout=30 limit=100     {"subsystem":"telegram-fetch"}
response  POST    <fake-bot-api>/bot<token>/getUpdates  200     ok=true results=0                    {"subsystem":"telegram-fetch"}
request   POST    <fake-bot-api>/bot<token>/getUpdates  -       offset=5001 timeout=30 limit=100     {"subsystem":"telegram-fetch"}
response  POST    <fake-bot-api>/bot<token>/getUpdates  200     ok=true results=0                    {"subsystem":"telegram-fetch"}

The stored batch response is {"ok":true,"result":[{"update_id":5000,"message":{"message_id":1,"date":1793577600,"chat":{"id":4242,"type":"private"},"from":{"id":4242,"is_bot":false,"first_name":"Proof"},"text":"capture proof"}}]} (synthetic). Main records the same eight rows (its first two responses land in the other order), and both builds record the same 14 main-thread Telegram rows (getMe, deleteWebhook, deleteMyCommands, setMyCommands, sendMessage). On this branch the worker's transport records only when the worker loaded fetch.js from the parent's debugProxyCapture flag, so these rows also show that flag reaching the worker.

When the Gateway owns capture itself (OPENCLAW_DEBUG_PROXY_ENABLED=1 without proxy run), both builds record those main-thread rows and none of the worker's getUpdates: the worker's capture store open is refused with Shared-state admission requires the host broker, because openSharedStateSqliteWorkerStore rejects callers off the main thread. That is the same on main, and this PR does not change it.

Measured on 0ce08d269ff, and the capture runs use the same two builds. The branch is rebased onto fc6dff488ce without conflicts; 0ce08d269ff..fc6dff488ce does not touch extensions/telegram, src/proxy-capture or the proxy CLI, and the SAFETY comments and the dropped marker re-export added after the measurements do not change runtime code. The checks below were rerun on the rebased branch.

Tests: Telegram fetch, keepalive, ingress worker (factory, runtime, deadline, context) and polling session, plus src/proxy-capture/coverage.test.ts: 8 files, 72 tests pass. No unit case is added: the capture run above shows the parent's debug proxy setting reaching the worker and the worker recording its getUpdates exchanges. pnpm tsgo:extensions, pnpm tsgo:extensions:test, pnpm deadcode:exports, oxlint and oxfmt pass, and the CI baseline ratchets (check:baseline-ratchets, max-lines, line-cap, assertion-safety, database worker and dialect, timeout race, mock exports) pass against the PR base fc6dff488ce.

Overlap: open #151923 also edits extensions/telegram/src/fetch.ts (dispatcher pool options). The changes are independent, but git will report a conflict for whichever lands second, and that branch moves its fetch.ts edits into fetch-transport.ts.

Diff shape

git diff -M -B shows fetch.ts → fetch-transport.ts as a 95% similar copy; the changes there are the type-only SDK import, the debugProxyCapture option, the early return in captureResponse, and resolveTelegramFetch moving to the new fetch.ts. scripts/lib/type-assertion-guard-scope.mjs follows the existing chained assertions to the new path, and the SAFETY comments remove the file's line from config/assertion-safety-baseline.txt. polling-session.test.ts imports the marker from the protocol module.

Integrated worker measurements

The integrated candidate 3d49ac4f8a37 preserves the shared dispatcher pool, upload deadlines and the most recently acknowledged update ID. I compared it with its main baseline 4934b24699c0 on the same Linux x64 host using Node 24.22.1 and the repository build. Each arm ran ten fresh polling workers, alternating the order of the two builds.

Capture disabled Main baseline Candidate
Median retained V8 heap per worker after full GC 44,944,068 bytes 24,680,000 bytes
Evaluated modules 1,843 564
First successful poll, median / p95 658.3 / 665.5 ms 303.8 / 349.5 ms
CPU to first successful poll, median / p95 656.1 / 663.4 ms 300.4 / 343.6 ms
Steady CPU per poll, median 1.891 ms 1.896 ms

Retained heap fell by 19.33 MiB per polling worker. All seven comparison thresholds passed. The whole-Gateway RSS figures earlier in this description remain the contributor’s measurements on the earlier build.

With capture enabled, each built worker persisted six complete telegram-fetch request/response flows for successful getUpdates calls against the loopback Bot API. Both arms acknowledged update 1019 and polled next with offset 1020. The paired worker harness sets the worker option directly, so the two factory assertions separately cover how the parent selects disabled and enabled capture.

Both production builds passed. Nine transport and worker test files passed all 78 cases. Forced worker exit and a stalled sample both produced the expected nonzero result within their deadline and cleaned their temporary state. Integrated CI

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram scripts Repository scripts size: XL labels Nov 2, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 2, 2026
@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR keeps debug capture dependencies out of Telegram polling workers when capture is disabled.

Example: Starting a Telegram polling worker with debug capture disabled on the recorded Linux build.

  • Before: The worker evaluates 1,843 modules and retains 44,944,068 bytes of heap after full GC.
  • After: The worker evaluates 564 modules and retains 24,680,000 bytes, saving 19.33 MiB.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, measured optimization with production-entry-point evidence, preserved transport contracts, successful exact-head CI, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Recorded whole-Gateway CLI runs exercise capture selection and stored getUpdates exchanges, while paired built-worker runs at the reviewed candidate show lower heap and startup cost with unchanged acknowledgements, offsets, and enabled capture behavior.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Each Telegram polling account retains roughly 20 MiB of unnecessary worker heap and pays extra startup CPU while debug capture is disabled.
Reason: The measured memory and startup gains address an owned performance defect without adding configuration, public APIs, or persistent state.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main still loads optional capture dependencies into polling workers, and the focused extraction preserves transport behavior without actionable defects.

Reviewed head: 3d49ac4f8a374e90c952a758d1adf89d9cba11cc

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Telegram parent creates one polling worker per account; each worker fetches Bot API updates and advances its offset after the parent acknowledges durable enqueue.

flowchart TD
  A[Telegram polling session] --> B[Parent worker factory]
  B --> C[Polling worker]
  C --> D[Shared transport core]
  C --> E[Optional capture adapter]
  E --> D
  D --> F[Telegram Bot API]
  C --> G[Parent durable ingress queue]
Loading

Technical review

Best possible solution:

Keep one shared transport implementation and load its existing capture adapter only for workers whose parent enables capture.

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

Current-main source confirms the eager import chain, and the supplied paired built-worker measurements quantify its cost; this read-only review ran no target code.

Is this the best way to solve the issue?

The extraction removes the unnecessary worker dependency graph while retaining the existing transport and capture owners, making it a focused solution to the measured problem.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3bd892f5a2eb.

Provenance checked

  • Telegram proxy capture integration keeps the original intent (958c34e: Extend shared proxy capture coverage to Telegram HTTP exchanges for debugging and inspection.)
  • Isolated Telegram polling keeps the original intent (fd244fd: Keep getUpdates progressing during main-thread event-loop stalls while preserving durable ingress handling.)
  • Assertion safety guard keeps the original intent (203aafc: Ratchet unexplained production assertions; the PR documents the moved assertions and relocates the existing chained-assertion exception.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Avant: Raw commit fd244fd adds extensions/telegram/src/telegram-ingress-worker.runtime.ts:165 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fd244fd76de3; files: extensions/telegram/src/telegram-ingress-worker.runtime.ts)
  • Peter Steinberger: Raw commit e2558f1 adds extensions/telegram/src/telegram-ingress-worker.runtime.ts:293 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e2558f1de0ad; files: extensions/telegram/src/telegram-ingress-worker.runtime.ts)
  • Ayaan Zaidi: Raw commit 5a10a29 adds extensions/telegram/src/telegram-ingress-worker.runtime.ts:179 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5a10a29807ab; files: extensions/telegram/src/telegram-ingress-worker.runtime.ts)

PR surface

Source +52, Tests +11, Other +296. Total +359 across 12 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 723 671 +52
Tests 4 20 9 +11
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 298 2 +296
Total 12 1041 682 +359

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

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

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 (2 earlier review cycles)
  • reviewed 2026-11-02T05:49:53.265Z sha 93c77fd0b60862e2d3ec3266e1b234b9c143e7ad :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-02T09:56:27.334Z sha e48dff8777eb0e0def89ce7db377a007046ee1ba :: needs maintainer review before merge. :: none

Reviewed November 26, 2026, 5:31 AM ET / 10:31 UTC (Revision 3).

@boeingchoco
boeingchoco force-pushed the perf/telegram-ingress-worker-light-import branch from 93c77fd to e48dff8 Compare November 2, 2026 09:49
@boeingchoco

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 2, 2026
@boeingchoco
boeingchoco force-pushed the perf/telegram-ingress-worker-light-import branch from e48dff8 to 88cf484 Compare November 3, 2026 01:25
@boeingchoco
boeingchoco marked this pull request as ready for review November 3, 2026 01:26
Copilot AI balanced review requested due to automatic review settings November 3, 2026 01:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Each Telegram polling account runs getUpdates in its own worker thread.
The worker imported the transport through fetch.ts, whose static
plugin-sdk/proxy-capture import evaluated the capture store graph even
though capture is off unless OPENCLAW_DEBUG_PROXY_ENABLED is set. The
worker runtime also took its marker from the parent factory module,
which pulled in process-runtime.

Move the transport core to fetch-transport.ts and pass the capture
owner functions in as an option. fetch.ts keeps resolveTelegramTransport
and resolveTelegramFetch and supplies the SDK functions, so main-thread
callers keep capture. The parent passes resolveDebugProxySettings().enabled
to the worker, which imports fetch.js only then and only after its stop
listener is registered. The marker moves to a side-effect-free module.
The six type assertions that move with the transport get SAFETY
comments, so its assertion baseline entry goes away.

Built worker against a loopback Bot API, 10 alternating samples
(scripts/perf/telegram-ingress-worker-measure.mjs): evaluated modules
1,794 -> 550, heap after full GC 42.2 -> 21.9 MiB, first poll-success
487 -> 202 ms (worker CPU 484 -> 199 ms), steady CPU per empty poll
3.04 -> 2.88 ms. Poll sequence and acked update ids match. Under
`openclaw proxy run`, a Gateway with one polling account records the
worker's getUpdates exchanges the same way on both builds.

Whole Gateway with three polling accounts, 5 alternating boots per arm:
each Telegram worker heap 42.1 -> 21.8 MiB, process RSS 1,881 -> 1,786
MiB, main heap and spawn -> /healthz time unchanged.
@boeingchoco
boeingchoco force-pushed the perf/telegram-ingress-worker-light-import branch from 88cf484 to 214a341 Compare November 3, 2026 05:38
@vincentkoc vincentkoc self-assigned this Nov 26, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Nov 26, 2026
@vincentkoc
vincentkoc merged commit 0ef3bad into openclaw:main Nov 26, 2026
134 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 26, 2026
…oid-chat-preview-grapheme-boundary

* commit '0bea7ecb3029583dd49d83f760d4f40c9e1f543c': (129 commits)
  fix(android): settle startup before checking archive refresh (#205891)
  fix: Gateway retains completed reply runtimes after catalog reloads (#195479)
  fix: clear unused-export failures in dependency checks (#205905)
  refactor: share browser routing for meeting captions and cleanup (#205916)
  fix(ui): update Workshop file preview mode (#205872)
  refactor(android): decouple shared JSON values from node handlers (#202840)
  fix(ci): remove bot credit from release notes (#205914)
  fix: pause interrupted shell turns when their result is unknown (#205859)
  fix(ui): skip publication options for removed workspaces (#205909)
  fix: preserve indentation in document previews (#205834)
  improve(ci): avoid full fixture builds for volume checks (#205903)
  refactor(android): derive connection readiness from its owner (#202898)
  fix: preserve side chat text when dictating at the limit (#205710)
  improve(telegram): polling workers start faster and use half the memory (#190890)
  fix: keep speaker identities distinct in meeting notes (#205860)
  fix: wait for cancellation before releasing ACP test preparation (#205893)
  fix: bound workers retained after deleting sessions across agents (#197409)
  fix(memory): keep a child's memory audience after its parent resets (#205887)
  refactor(android): give installed skills one data owner (#202892)
  fix(cli): share process failure listeners across invocations (#205732)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
…ry (openclaw#190890)

* improve(telegram): polling workers start faster and use half the memory

Each Telegram polling account runs getUpdates in its own worker thread.
The worker imported the transport through fetch.ts, whose static
plugin-sdk/proxy-capture import evaluated the capture store graph even
though capture is off unless OPENCLAW_DEBUG_PROXY_ENABLED is set. The
worker runtime also took its marker from the parent factory module,
which pulled in process-runtime.

Move the transport core to fetch-transport.ts and pass the capture
owner functions in as an option. fetch.ts keeps resolveTelegramTransport
and resolveTelegramFetch and supplies the SDK functions, so main-thread
callers keep capture. The parent passes resolveDebugProxySettings().enabled
to the worker, which imports fetch.js only then and only after its stop
listener is registered. The marker moves to a side-effect-free module.
The six type assertions that move with the transport get SAFETY
comments, so its assertion baseline entry goes away.

Built worker against a loopback Bot API, 10 alternating samples
(scripts/perf/telegram-ingress-worker-measure.mjs): evaluated modules
1,794 -> 550, heap after full GC 42.2 -> 21.9 MiB, first poll-success
487 -> 202 ms (worker CPU 484 -> 199 ms), steady CPU per empty poll
3.04 -> 2.88 ms. Poll sequence and acked update ids match. Under
`openclaw proxy run`, a Gateway with one polling account records the
worker's getUpdates exchanges the same way on both builds.

Whole Gateway with three polling accounts, 5 alternating boots per arm:
each Telegram worker heap 42.1 -> 21.8 MiB, process RSS 1,881 -> 1,786
MiB, main heap and spawn -> /healthz time unchanged.

* fix(perf): bound Telegram worker samples and match capture modes

* fix(telegram): preserve dispatcher deadlines in the slim transport

---------

Co-authored-by: boeingchoco <[email protected]>
Co-authored-by: Vincent Koc <[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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XL 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.

[Bug]: Every Telegram polling worker loads the debug proxy capture store while capture is off

3 participants