Skip to content

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

Description

@boeingchoco

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Performance: every Telegram polling worker evaluates the debug proxy capture store at startup although capture stays off unless OPENCLAW_DEBUG_PROXY_ENABLED is set, so each polling account carries about 20 MiB of worker heap and about 280 ms of startup CPU for code that never runs.

Steps to reproduce

  1. Check out main at 0ce08d269ff and build it (dist/telegram-ingress-worker.runtime.js).
  2. Start that worker with the workerData contract createTelegramIngressWorker uses (runtime marker, token, API root, timeout) against a loopback Bot API that answers getUpdates, with a module load hook installed in the worker.
  3. After the first successful poll, count the evaluated modules and read the worker heap after a full GC.

The linked PR adds scripts/perf/telegram-ingress-worker-measure.mjs, which does this for one or two built checkouts; the numbers below come from it.

Expected behavior

With debug proxy capture off (the default), the polling worker loads what getUpdates needs. resolveEffectiveDebugProxyUrl and captureHttpExchangeAsync only do work when the debug proxy is enabled, and main-thread Telegram requests keep their capture behavior either way.

Actual behavior

telegram-ingress-worker.runtime.ts imports resolveTelegramTransport from fetch.ts, and fetch.ts statically imports openclaw/plugin-sdk/proxy-capture. That SDK facade re-exports the capture env, runtime and store modules, so every worker evaluates the whole capture store graph before its first poll. The worker also takes its runtime marker from the parent-side factory telegram-ingress-worker.ts, which pulls in openclaw/plugin-sdk/process-runtime.

Built worker on 0ce08d269ff, loopback Bot API, 10 samples, idle host:

Per worker median p95
Evaluated modules 1,794 1,794
Heap after full GC 42.21 MiB 42.22 MiB
Construction → first poll-success 486.7 ms 662.0 ms
Worker CPU to first poll-success 483.7 ms 543.6 ms

The same build loaded with only the transport core and no capture graph evaluates 550 modules and retains 21.86 MiB.

Whole Gateway with three Telegram polling accounts (built dist, network-less sandbox, 5 boots, full GC through the inspector): each of the three Telegram workers holds 42.1 MiB.

OpenClaw version

main at 0ce08d269ff. v2026.10.9 has the same import chain (checked in source, not measured).

Operating system

Ubuntu 26.04.1 LTS x86_64 (Node 26.13)

Install method

Source checkout (built dist)

Model

Any model; the cost is paid when a polling worker starts.

Provider / routing chain

Any. Telegram channel in polling mode, which runs one ingress worker per account.

Additional provider/model setup details

Default config: debug proxy capture off.

Impact and severity

Each Telegram polling account holds about 20 MiB of extra worker heap for as long as the Gateway runs, so three accounts hold about 60 MiB. Every polling restart pays the import again before its first poll.

Activity

  1. added
    clawsweeper:intake:bug
    P2
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    clawsweeper:source-repro
    impact:other
    issue-rating: 🦞 diamond lobster
    and removed
    clawsweeper:intake:bug
    on Nov 2, 2026
  2. clawsweeper commented on Nov 2, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    Current main retains the unnecessary capture imports, and the same author’s open closing PR requires this issue to remain open.

    Reproducibility: Current source establishes the unconditional worker-to-transport-to-capture-store import path despite capture’s disabled-settings guard; the contributor supplies built-worker and Gateway measurements, but this review executed no product code.

    Root-cause cluster
    Relationship: canonical
    Canonical: #190889
    Summary: This issue tracks the eager capture import overhead, and its paired open PR owns the proposed repair.

    Members:

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

    Next step
    Resolve conflicts in #190890, then verify disabled-capture loading and enabled-capture behavior on its updated head before merging.

    Review details

    Best possible solution:

    Keep one shared Telegram transport implementation while loading capture dependencies only when existing capture settings enable them.

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

    Current source establishes the unconditional worker-to-transport-to-capture-store import path despite capture’s disabled-settings guard; the contributor supplies built-worker and Gateway measurements, but this review executed no product code.

    Is this the best way to solve the issue?

    Separating optional capture dependencies from the existing transport addresses the source-proven waste while preserving polling acknowledgement, proxy routing, and enabled capture behavior.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The linked repair PR currently conflicts with main.
    • The contributor’s numerical memory and CPU results were not rerun on current main.

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

    Label changes

    Label changes:

    No label changes.

    Label justifications:

    • P2: Avoidable startup CPU and retained memory scale with polling accounts, without demonstrated current message loss or an availability failure.
    • impact:other: The demonstrated impact is unnecessary worker dependency loading and reported memory and CPU overhead.
    Evidence reviewed

    What I checked:

    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; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed November 26, 2026, 4:16 AM ET / 09:16 UTC.

  3. added
    clawsweeper:intake:bug
    and removed
    clawsweeper:intake:bug
    on Nov 2, 2026
  4. openclaw-barnacle commented on Nov 15, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale after 7 days without qualifying human activity.
    Without new human activity, Barnacle may close it as not planned 7 days after this message was posted. This is administrative inactivity cleanup, not a claim that the problem is fixed.
    A human update restarts the inactivity clock; a new PR head also restarts it. A maintainer can add no-stale for a durable hold, or bad-barnacle to suppress Barnacle. Remove the hold when work can resume.

  5. added
    stale
    on Nov 15, 2026
  6. added
    clawsweeper:intake:bug
    and removed
    clawsweeper:intake:bug
    on Nov 15, 2026
  7. self-assigned this
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2clawsweeper:linked-pr-openclawsweeper:no-new-fix-prclawsweeper:source-reproimpact:otherissue-rating: 🦞 diamond lobsterstale

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions