Skip to content

fix(telegram): offset checkpoints fail under stock Bun - #178909

Merged
obviyus merged 4 commits into
openclaw:mainfrom
brianmcguire:fix/telegram-worker-bun-context
Oct 23, 2026
Merged

obviyus merged 4 commits into
openclaw:mainfrom
brianmcguire:fix/telegram-worker-bun-context

Conversation

@brianmcguire

@brianmcguire brianmcguire commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #178809

What Problem This Solves

Under supported stock Bun, Telegram's native ingress Worker messages can lose the constructing plugin's async context. Real polling then logs failed to persist update offset ... Telegram runtime not initialized; the durable checkpoint remains unset even though an update was received. A clean Gateway restart consequently begins polling without the saved offset.

Solution and User Impact

Bind the existing Worker message callback to its construction context with AsyncLocalStorage.bind. The later onMessage assignment stays unchanged, and both immediate and deferred work use the correct plugin owner. No retry, state, schema, configuration, dependency, or plugin-SDK surface changes. The troubleshooting page identifies the error and recommends updating rather than clearing checkpoints.

The fix uses the existing callback and native async-context owner, not a parallel registry or wrapper API. Necessary production growth is +8/-3 (net +5); tests/support +119/-0; docs +1/-0. The native Worker test covers independent plugin owners, foreign-scope callback assignment, and immediate/deferred offset writes through public APIs. Its Node run also passes on main; it is a Node ownership control, not the evidence for the Bun defect.

Evidence

Built and installed main (cb81ec86d1c9d19ce300781ef84dde5209fa569b) and candidate (6b0850f71792c71780e1d111732562a7c6ed6f78) in secretless Linux arm64 Docker with Node 24.22.1. The latest official stock Bun release was 1.4.4, downloaded from its official Linux arm64 asset; its native node:sqlite reports SQLite 3.53.4. The installed openclaw.mjs runs under bun --bun, passing its unchanged runtime/SQLite admission. No engine edits or guard overrides.

The shipped setup/config commands create each independent profile, workspace, database, Telegram account, and allowlist. A local Bot API boundary server supplies synthetic getMe/getUpdates responses and an allowed user's ordinary /status update 7001. The actual built Gateway starts the actual ingress Worker; this does not replace the Worker or invoke a private callback. The observer only reads the SQLite checkpoint and records Bot API requests/replies.

  • Main under stock Bun, twice: receives/spools update 7001, logs the runtime-context persistence error, leaves lastUpdateId: null, and starts the first poll after a clean restart with no offset (recorded as 0).
  • Candidate under the same stock Bun, twice: persists lastUpdateId: 7001, returns the visible /status response through the Bot API boundary, and starts the first poll after restart at 7002. Neither first-run nor restart logs contain the context/persistence error.
  • Independent Node 24.22.1 controls on main and candidate both persist 7001, return the status response, and restart at 7002.
  • Focused native Worker and offset-store suites: 3 files, 16 tests passed. Targeted formatting and lint passed.

Captured outputs and checkpoint observations follow below. This is a real built-Gateway/local-channel-boundary proof, not a live Telegram account or live-provider claim. No model turn is needed for the /status command.

Captured built Gateway checkpoint and restart observations

Each arm used a fresh command-created profile. Empty/absent polling offsets are recorded as 0 by the local Bot API observer. Checkpoint rows below are read-only SQLite observations, not seeded state.

base0

checkpoint: [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":null,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]
status replies captured: 1
RESTART {"firstPoll": {"offset": 0, "time": 1792715033171}, "checkpoint": [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":null,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]}
PASS base0 bun
2026-10-23T00:23:46.766+00:00 [telegram] [diag] isolated polling batch spooled updateId=7001
2026-10-23T00:23:46.768+00:00 [telegram] failed to persist update offset 7001; a later update will retry: Telegram runtime not initialized

base1

checkpoint: [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":null,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]
status replies captured: 0
RESTART {"firstPoll": {"offset": 0, "time": 1792715066226}, "checkpoint": [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":null,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]}
PASS base1 bun
2026-10-23T00:24:18.885+00:00 [telegram] [diag] isolated polling batch spooled updateId=7001
2026-10-23T00:24:18.887+00:00 [telegram] failed to persist update offset 7001; a later update will retry: Telegram runtime not initialized

base-node-control

checkpoint: [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":7001,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]
status replies captured: 1
RESTART {"firstPoll": {"offset": 7002, "time": 1792715101629}, "checkpoint": [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":7001,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]}
PASS baseNodecontrol node
2026-10-23T00:24:53.906+00:00 [telegram] [diag] isolated polling batch spooled updateId=7001

cand0

checkpoint: [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":7001,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]
status replies captured: 1
RESTART {"firstPoll": {"offset": 7002, "time": 1792715576413}, "checkpoint": [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":7001,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]}
PASS cand0 bun
2026-10-23T00:32:50.311+00:00 [telegram] [diag] isolated polling batch spooled updateId=7001

cand1

checkpoint: [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":7001,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]
status replies captured: 1
RESTART {"firstPoll": {"offset": 7002, "time": 1792715609166}, "checkpoint": [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":7001,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]}
PASS cand1 bun
2026-10-23T00:33:22.757+00:00 [telegram] [diag] isolated polling batch spooled updateId=7001

cand-node-control

checkpoint: [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":7001,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]
status replies captured: 1
RESTART {"firstPoll": {"offset": 7002, "time": 1792715644289}, "checkpoint": [{"plugin_id": "telegram", "namespace": "telegram.update-offsets", "entry_key": "default", "value_json": "{\"version\":3,\"lastUpdateId\":7001,\"botId\":\"178909001\",\"tokenFingerprint\":\"aa3d3e878525ad05\"}"}]}
PASS candNodecontrol node
2026-10-23T00:33:56.136+00:00 [telegram] [diag] isolated polling batch spooled updateId=7001

Thanks to @brianmcguire for the fix and @qwexs for reporting the runtime failure.

Merge danger: two-way door; reverting removes callback context binding without changing storage or configuration. Existing polling checkpoint writes remain in the existing format. Blast radius is Telegram polling Worker message handling, especially Bun; Node behavior is retained by the control.

@clawsweeper

clawsweeper Bot commented Oct 21, 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.

@brianmcguire
brianmcguire marked this pull request as ready for review October 21, 2026 01:10
@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S labels Oct 21, 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: 🧂 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 21, 2026
@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Bind Telegram ingress Worker messages to the constructing plugin’s async context so offset checkpoints persist under stock Bun.

Example: Telegram polling receives update 7001 under stock Bun 1.4.4.

  • Before: Checkpoint persistence throws “Telegram runtime not initialized,” and a clean restart polls without a saved offset.
  • After: The checkpoint stores 7001, and the first poll after restart requests offset 7002.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal owner-boundary repair with discriminating native Worker coverage and supplied built-Gateway checkpoint/restart proof; the unchanged version-3 storage format requires no migration.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The reviewed-head proof runs the installed Gateway and actual ingress Worker under stock Bun 1.4.4 against a local HTTP Bot API boundary, observes SQLite checkpoint 7001 and status replies, and verifies restart polling at 7002; repeated base failures and Node controls distinguish the repaired path without claiming live Telegram or model coverage.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Telegram polling under stock Bun repeatedly fails to save received update offsets and restarts without the saved checkpoint.
Reason: The patch restores supported behavior through the existing owner and retains the intentional single-consumer design, with no new public surface or product policy.

Merge readiness

✅ Ready for maintainer review

This PR fixes a concrete Telegram checkpoint failure that remains on current main; no actionable patch defects were found, and the existing CI gate is still pending.

Priority: P2
Reviewed head: 6b0850f71792c71780e1d111732562a7c6ed6f78

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Telegram ingress Worker fetches Bot API updates and forwards messages to the polling session, which uses the owning plugin runtime to spool updates and persist SQLite checkpoints.

flowchart LR
  A[Telegram Bot API] --> B[Ingress Worker]
  B --> C[Bound message callback]
  C --> D[Polling session]
  D --> E[Plugin runtime]
  E --> F[SQLite spool and checkpoint]
  F --> B
Loading

Technical review

Best possible solution:

Land the existing callback-context repair after the required checks pass.

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

The supplied built-Gateway comparison reproduces the failure under stock Bun 1.4.4, and current-main source retains the same unbound callback; this read-only review executed no target code.

Is this the best way to solve the issue?

Binding the existing callback at construction restores the runtime lookup invariant at the context-loss boundary without adding retries, alternate runtime registries, or storage changes.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Telegram ingress Worker message forwarding keeps the original intent (fd244fd: Isolate Bot API polling from main-thread event-loop stalls while retaining durable ingress.)
  • Single private polling-session consumer keeps the original intent (c5c5ee7: Replace unnecessary private listener registries with one callback while preserving spool ACK, replay, recovery, and shutdown settlement.)
  • Telegram troubleshooting organization keeps the original intent (fd6fdb3: Split Telegram documentation by reader task, including symptom-first troubleshooting.)

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.ts:54 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.ts)

PR surface

Source +5, Tests +119, Docs +1. Total +125 across 4 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 1 8 3 +5
Tests 2 119 0 +119
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 128 3 +125

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:

  • P2: A supported opt-in runtime loses Telegram polling checkpoints, causing repeated persistence errors and incorrect restart offsets, with a focused repair available.
  • 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-10-21T01:28:50.043Z sha d9d0d14 :: needs real behavior proof before merge. :: [P2] Keep the ownership regression within supported test boundaries
  • reviewed 2026-10-21T20:31:41.721Z sha 1d1b458 :: needs maintainer review before merge. :: none

Reviewed October 22, 2026, 8:40 PM ET / October 23, 2026, 00:40 UTC (Revision 3).

@brianmcguire

Copy link
Copy Markdown
Contributor Author

Addressed the test-boundary finding in 1d1b458. The ownership regression now uses existing public SDK test APIs and real registry-managed plugin contexts, with no private core imports, helper bridges, new exports, or boundary exceptions. The import guard and all 20 extension-boundary contracts pass. The revised regression fails on the original adapter under stock Bun with Telegram runtime not initialized, and passes on stock Bun, the pinned fork, and Node. All 47 affected sibling cases and targeted static checks pass. Fresh independent P0-P2 review found no actionable findings.

The PR body now includes sanitized, reproducible two-process proof using the actual ingress Worker/sidecar, real HTTP to a local synthetic Bot API, the production ingress monitor, and production SQLite stores: the first process persists checkpoint 7001 with one pending update after an injected retryable delivery failure; the replacement reads 7001, replays that update, polls from 7002, then persists and delivers update 7002. Final pending and claimed queues are empty.

Live Telegram Test Server validation remains unavailable because I do not have QA broker access. The new proof establishes the local transport, persistence, and process-replacement behavior; it does not claim live Telegram, a running Gateway/model turn, or abrupt-kill recovery. A maintainer with QA credentials can complete that remaining live-service check.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

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 Oct 21, 2026
@obviyus

obviyus commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 23, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 23, 2026
@obviyus

obviyus commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Maintainer override: QA Smoke CI (profile 5/6) is an inherited failure, not caused by this PR.

The failing scenario is memory-dreaming-sweep. It times out after 90 s waiting for the managed cron, because embedding can't find a module in the captured package (dist/errors-*.mjs). The identical failure is on a scheduled main run (faaae32): https://github.com/openclaw/openclaw/actions/runs/39872214487/job/120149514603. This PR only changes the Telegram ingress callback, its test and docs; the QA-channel memory scenario never uses the Telegram Worker. All other required checks pass.

@obviyus
obviyus merged commit 9f89542 into openclaw:main Oct 23, 2026
117 of 121 checks passed
@obviyus

obviyus commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Landed in 9f89542. Thanks @brianmcguire. Telegram polling on Bun now saves its offset.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
fix(telegram): keep the ingress Worker context on stock Bun

On stock Bun (an opt-in runtime), the Telegram ingress Worker lost its runtime context, so saving the update offset failed every time with "Telegram runtime not initialized" and polling restarted from the old offset. The Worker now keeps its context on Bun, so the checkpoint is saved and polling resumes after it.

Evidence: built Gateway on stock Bun 1.4.4 with a Telegram Bot API boundary. On main the checkpoint stayed null and polling restarted at offset 0 (twice); with this change the checkpoint is 7001, polling restarts at 7002 and status replies are delivered (twice). Node behaves as before.

Thanks @brianmcguire.

Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa pushed a commit that referenced this pull request Oct 26, 2026
fix(telegram): keep the ingress Worker context on stock Bun

On stock Bun (an opt-in runtime), the Telegram ingress Worker lost its runtime context, so saving the update offset failed every time with "Telegram runtime not initialized" and polling restarted from the old offset. The Worker now keeps its context on Bun, so the checkpoint is saved and polling resumes after it.

Evidence: built Gateway on stock Bun 1.4.4 with a Telegram Bot API boundary. On main the checkpoint stayed null and polling restarted at offset 0 (twice); with this change the checkpoint is 7001, polling restarts at 7002 and status replies are delivered (twice). Node behaves as before.

Thanks @brianmcguire.

Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit 9f89542)

Adapted for 2026.9.x: 9.x fans Worker messages out to registered listeners, so
the bound handler wraps that loop. Main's regression fixture needs the newer
plugin background-context API and passes on Node either way, so it is omitted;
a Bun 1.4.2 probe confirmed that an unbound Worker message handler loses the
construction context and the bound one keeps it.
RomneyDa added a commit that referenced this pull request Oct 28, 2026
fix(telegram): keep the ingress Worker context on stock Bun

On stock Bun (an opt-in runtime), the Telegram ingress Worker lost its runtime context, so saving the update offset failed every time with "Telegram runtime not initialized" and polling restarted from the old offset. The Worker now keeps its context on Bun, so the checkpoint is saved and polling resumes after it.

Evidence: built Gateway on stock Bun 1.4.4 with a Telegram Bot API boundary. On main the checkpoint stayed null and polling restarted at offset 0 (twice); with this change the checkpoint is 7001, polling restarts at 7002 and status replies are delivered (twice). Node behaves as before.

Thanks @brianmcguire.

Co-authored-by: Ayaan Zaidi <[email protected]>

Adapt the factory-scope binding to the existing subscriber-set handle without replacing subscribe/unsubscribe or ACK/stop ownership; validate with two real worker/account owners and deferred offset writes.

(cherry picked from commit 9f89542)
Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 29, 2026
Mirror main's Knip entries for files added by beta.5 backports:
- scripts/perf/{node-event-session-source-measure.mjs,
  stream-dispatch-scope-measure.ts,system-prompt-report-retention.ts}
  as path-invoked script roots (#183931, #183552, #183010);
- the Telegram ingress context Worker fixture loaded by URL (#178909) in
  production ignoreFiles.
Also register scripts/test-security-mail-parser.mjs, the standalone
nodemailer sender-parsing regression added by #187301 (release-only).
RomneyDa added a commit that referenced this pull request Oct 29, 2026
…eadcode after backports (#187570)

* refactor: keep Teams allowlist sentinel private (#185484)

The Microsoft Teams fail-closed allowlist sentinel now remains module-private while preserving its exact restrictive projection and lifecycle coverage.

(cherry picked from commit 59b1ddd)

* test: teach the live-wrapper fake Bun to answer --revision

Partial cherry-pick of the test/scripts/test-live.test.ts hunk only.
#173807 (backported as e72f868) made the CI Bun --revision probe
mandatory; the fake Bun fixture must answer it from the checkout pin.

(cherry picked from commit 08dd80a)

* test(ci): expect watchdog exit 124 from wedged run-tsgo

#184639 (backported as d9a91b5) intentionally changed the run-tsgo
watchdog exit from 1 to 124 so CI collectors stop admitting work. Main
realigned this case in run-tsgo-worktree.test.ts (9b14a38); on the
release branch the same watchdog case lives in run-tsgo.test.ts and was
not realigned by the backport.

* test(vitest): keep gateway database-worker routes in canonical order

The beta.5 adaptation of #178415 (23a2bcd) prepended three
integration proofs to gatewayDatabaseWorkerTestFiles. Canonical project
ownership compares that list against sorted discovery, so the
out-of-order entries failed vitest-cli-ownership. Move them to their
sorted positions; routing membership is unchanged.

* refactor: keep Slack reconnect policy private (#181690)

Keeps Slack reconnect policy details module-private while preserving the exact invalid-auth cutoff, reset, and blocked-status behavior.

(cherry picked from commit cd65901)

* fix: keep retired Telegram throttler release private

Telegram hunk of 09f9ec8 (#183086) only. The release-only test
called the private helper directly; its surviving-alias case is already
asserted through releaseRemovedTelegramAccountThrottler, so drop the
duplicate direct call.

(cherry picked from commit 09f9ec8, partial)

* refactor: keep Claude partial-message measurement private

src/agents/cli-output-stream-limits.ts hunk of 28e2774 (#184686) only;
the backport of #184352 left this export without a consumer.

(cherry picked from commit 28e2774, partial)

* refactor: keep managed plugin cache selector private

src/plugins/management-catalog.ts hunk of 2c0c30b (#185269) only;
the backport of #184921 left this export without a consumer.

(cherry picked from commit 2c0c30b, partial)

* refactor(agents): keep requester settle batch callbacks type private

The backport of #181260 (2f7589a) moved RequesterSettleWakeParams
into the state module, leaving RequesterSettleWakeBatchCallbacks exported
only for a test fixture. Main keeps it module-private; type the fixture
through RequesterSettleWakeParams instead.

* refactor(infra): drop unconsumed streaming UTF-8 decoder

The minimal backport of #180861 (8d3183d) added decodeUtf8Chunks as
a prerequisite, but its main consumers (streaming state-migration
importers) were intentionally not backported, so production Knip flags
it. Remove the export and its unit case; decodeUtf8Input is unchanged.

* refactor(scripts): keep pinned Bun CI detection private

The minimal #172625 backport (e6c3639) deferred the dev-tool,
test-runtime and run-format callers that consume isCiEnvironment on main,
so the export has no consumer on the release branch.

* test(update): drop orphaned recovery version-mismatch fixture

The #185692 backport in 39f9bde removed the last consumer of
recoveryVersionMismatch from update-cli.plugin-convergence.test.ts. Main
removed the same fixture in eae9bc4 (#181717).

* test(gateway): type config removal mocks through inline module imports

The release adaptation of #152052 (41aa7a6, de41770) typed its
partial mocks through type-only namespace imports. Knip treats the
secrets runtime namespace as the only consumer of its exports, so the
full-tree scan reported prepareSecretsRuntimeSnapshotRestore and
SecretResolverWarning as unused. Use main's inline typeof import() form.

* refactor(shared): drop unconsumed async-store helper

The backport of #179213 (6d9852d, plus f3fb0e9 registering it
as a wrapper component) took the runWithAsyncStore helper and its test
without the plugin-instance-invocation consumer, leaving
src/shared/async-store.ts unused in production. Remove the helper, its
test and its wrapper-components entry rather than complete a perf change
during beta stabilization.

* chore(knip): model backported perf scripts and Telegram worker fixture

Mirror main's Knip entries for files added by beta.5 backports:
- scripts/perf/{node-event-session-source-measure.mjs,
  stream-dispatch-scope-measure.ts,system-prompt-report-retention.ts}
  as path-invoked script roots (#183931, #183552, #183010);
- the Telegram ingress context Worker fixture loaded by URL (#178909) in
  production ignoreFiles.
Also register scripts/test-security-mail-parser.mjs, the standalone
nodemailer sender-parsing regression added by #187301 (release-only).

* refactor(doctor): keep dashboard migration guard at the repair boundary

Release adaptation of 50b532d (#183153). The backport of #182345
(51f63cb) exported isUnstampedDashboardRoot only for its unit test.
Main made it private and drove the eligibility cases through
repairLegacyDashboardChatTypes using a canonical-repair fixture this
branch does not carry. Keep every accepted and rejected row case, now
asserted through the repair boundary with the branch's session accessor.

* test(agents): hold requester preparation for the settle capacity case after #181260 backport

Backport 2f7589a (#181260) filters delivered child findings from
settle wakes (needsRequesterSettleFindings), so this delivered-row case
no longer reads the child transcript where it injected worker capacity
and failed with 'expected findTranscriptEvent to be called'. Main
realigned the same case in 411b2e6 (#178104): inject capacity at
captureRequesterSessionEntryCurrent and assert the delivered result is
not repeated in the resumed wake. Apply that realignment; the
'Already delivered child results' wording that main also asserts belongs
to #178104's message change, which this branch does not carry.

(adapted from commit 411b2e6)

---------

Co-authored-by: Shakker <[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 docs Improvements or additions to documentation 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. size: S 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]: Telegram ingress Worker loses plugin runtime context on Bun; offset persistence retries with "Telegram runtime not initialized"

2 participants