Repository navigation
refactor(channels): deslop Telegram, Matrix and Feishu fourth pass - #160032
Conversation
Reuse canonical parameter, result, presentation and lifecycle owners across the three plugins, and remove unused forwarding layers while preserving their wire and state contracts. Also close Telegram membership-audit transports after response settlement and reject Mini App bootstrap handoffs after the validated config changes. Add disposal and authority-race regressions, including real bootstrap issuance through the existing database-worker test lane.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 28, 2026, 1:15 AM ET / 05:15 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch simplifies Telegram, Matrix, and Feishu channel code, closes Telegram membership-audit transports, and rechecks Mini App owner configuration before issuing a Control UI bootstrap credential. Merge readiness⛔ Blocked before merge - 5 items remain Keep open. Current main still has both Telegram defects addressed by this branch, and the reviewed cleanup remains useful. The assertion-baseline follow-up is present, but Telegram-visible callback and draft behavior still lacks the Test Server proof required by the Telegram plugin guide. Priority: P2 Review scores
Verification
How this fits togetherThe three channel plugins turn platform events and OpenClaw configuration into authorized agent turns and platform replies. Telegram also checks group membership and offers a Mini App route that can issue a short-lived Control UI credential. flowchart LR
A[Platform events and config] --> B[Channel plugins]
B --> C[Access and routing]
C --> D[Agent turns]
D --> E[Platform replies]
B --> F[Telegram membership audit]
B --> G[Mini App owner check]
G --> H[Bootstrap credential]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the targeted transport and credential fixes, then attach a redacted Test Server trace for the changed callback and streaming paths before landing the channel cleanup. Do we have a high-confidence way to reproduce the issue? Yes for the two targeted defects: current-main source shows an unclosed audit transport and a Mini App configuration snapshot retained across awaited work. The PR reports negative-control runs; I did not execute those tests locally. Is this the best way to solve the issue? Yes for the targeted repairs: they use the existing transport and credential-admission owners. The wider cleanup still needs the Telegram-visible proof required for the paths it touches. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 02e1ac8391f8. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
Apply the exact assertion-safety reductions generated for the four cleaned channel files, and name the merged Matrix delivery result without shadowing its filter callback.
28 upstream commits, including the fourth cleanup pass over Telegram, Matrix and Feishu (openclaw#160032), which touches 22 Feishu files. One conflict, in extensions/feishu/src/comment-dispatcher.ts. This branch resolves the comment chunk limit and chunk mode from account.accountId and adds the comment table mode right after them. openclaw#160032 shortened the typing reaction setup below them to createCommentTypingReactionLifecycle({ ...params }) and dropped startTypingReaction from the returned object. The resolution keeps both. The spread passes the lifecycle the same six fields the old object did, and nothing in the tree still reads startTypingReaction. comment-dispatcher.test.ts, send.ts and the database-workers test routing list changed on both sides in separate places and merged cleanly. Each of the four files carries the same branch changes over the new main as it did over the old one, and the new upstream assertion in comment-dispatcher.test.ts is kept. Every name this branch uses from a file openclaw#160032 changed is still exported with the same shape. Upstream left the generated config baseline and the channel metadata unchanged in this range. build:docker ran in a separate detached checkout of this commit outside the nested node_modules install, and regenerating there changed nothing, so the counts stay at core 2464, channel 3788, plugin 4351 with the same hashes. The three generated-file checks pass there. Upstream deleted two files in this range, neither a test and neither touched by this branch. Feishu: 106 files and 1853 tests in the extension project, 17 files and 312 tests in the database-workers project. The one test fewer than before is the comment-handler case openclaw#160032 folded into comment-dispatcher.test.ts. The forwarder test and the routing guards pass, 1958 tests. tsgo:core, tsgo:extensions, tsgo:extensions:test, tsgo:test:root, the line-cap, max-lines and assertion-safety ratchets against upstream/main, oxlint and oxfmt on the 43 changed code files all pass.
…penclaw#160032) Share canonical types and parameter/result owners, remove unused forwarding layers and callback projections, and preserve channel wire formats and policy contracts. Remove 629 net production lines across the fourth-pass sweep. Fix Telegram membership audits leaking owned transports and Mini App bootstrap issuance retaining stale configuration across awaited work. Add disposal and real-issuer currentness regressions with original-owner negative controls. Validation: 6,749 channel tests, build, changed checks, SDK API/export checks, import boundaries, and 20 byte-identical Telegram HTTP requests on Blacksmith Testbox. Exact-head CI has only the unrelated Bun plugin-retention failures also present in run 36379467856 on unrelated PR openclaw#149275; landed under the explicit maintainer exception, with a separate plugin-fixture repair to follow. See PR evidence for complete coverage, commands and limitations.
What Problem This Solves
Removes repeated argument/result projections, duplicate types and unnecessary forwarding layers remaining in Telegram, Matrix and Feishu after the earlier cleanup passes.
User Impact
The refactors preserve wire payloads, parsing, channel policies, crypto/device state, rate limits, chunking, persistence and configuration. Two bugs found during the sweep are also repaired: Telegram membership audits release their owned HTTP transport, and Mini App bootstrap handoffs reject changes to the configuration they authenticated against.
Why This Change Was Made
This fourth pass removes 629 net production lines (598 added, 1,227 deleted). It is below the requested 1,000-line threshold; the complete, size-sorted READ coverage for all 204 production files over 200 lines is attached below.
Fixes found along the way
finallyafter all response bodies settle. The regression checks exact GET request bytes and disposal of a real dispatcher on success, network failure, malformed JSON and a gated final response body.Evidence
Final head:
da15bdd95eadbe7a68cf7980c74f102bb2d0c6b6. Its exact source tree,834abc290ac0c775e401cc7c72e21c3b6ba8b15c, matches the source verified and checked on Blacksmith Testboxtbx_01m3k3nc9xz8ymp4gktqbdctkx. The earlier runtime/build/API campaign ran ontbx_01m3jvqe5h37w3vq9bqvw7npe1; the follow-up only tightens the assertion baseline and renames one Matrix local variable.pnpm test:extensions:batch telegram,matrix,feishu: 6,749 tests / 451 files passed (1,955.59 s).pnpm build: passed (425.21 s).pnpm plugin-sdk:api:diff --base origin/main --head HEAD: passed; no Plugin SDK API changes (250.13 s). Export registration check passed too.Import-boundary tests (
fs-safe, plugin extension, test-helper extension and the boundary checker) plus the extension test-plan contract passed (9.95 s).Mini App original-owner negative control: five expected refusal failures and one successful unchanged-owner control. Candidate: 19/19 route tests passed, including real bootstrap issuance with zero persisted tokens after revocation versus one for unchanged authority (16.16 s).
Audit original-owner negative control: 4/4 expected disposal failures. Candidate: 4/4 passed, checking exact GET bytes and real dispatcher lifetime (15.01 s).
Other changed-file focused runs passed: Feishu comment dispatcher 18 tests / 35.58 s; comment handler 9 / 19.31 s; Telegram audit 5 / 1.79 s; native-quote drafts 10 / 23.31 s; draft streams 56 / 20.07 s. Commands used
pnpm test <file> --maxWorkers=1; cold worker preparation is included.Final
node scripts/check-changed.mjs: passed, including extension/test type checks, all three dead-export scans and lint. The first CI failure was the required shrink of four assertion-baseline entries; those eight removed assertions are now reflected exactly. A Matrix local-variable shadow found by lint was renamed. No baseline increase, suppression, retry or weakened assertion was used.Telegram raw HTTP parity: 20 requests across 8 cases were BYTE-IDENTICAL between the baseline and candidate. The existing registered model callback fixture covers authorization, persistence, answer and edit; three added task-only cells exercise direct acknowledgement, successful eager acknowledgement, and a real HTTP 400 followed by the fallback acknowledgement. Registered rich/HTML/plain presentations and explicitly flushed HTML/rich draft quotes cover accepted and rejected quotes. Comparison preserves exact ordered method, relative path, content-type and body bytes, with no body/field normalization. Ordered trace SHA-256:
e1c59d1623f2ed0099de92d742148b2ff4bdf6aab7d946149a8e9da95d1ac95f. This is the lane's explicitly allowed byte-parity proof, not a Telegram Test Server claim; question Gateway resolution is not claimed by the no-message acknowledgement cells. All temporary fixtures and production swaps were restored byte-for-byte.All lane-owned Testboxes are stopped. Independent Codex review completed; the final baseline/rename delta is scoped-clean. Earlier alias/acknowledgement/parser findings were rejected against complete owner source and call sites. No accepted finding remains. No storage schema, serialized state, configuration key or manifest changed; the shared test-path list only selects the existing host-broker fixture lane.
Hosted CI and maintainer landing exception
The final-head CI run 36379727824 failed only
checks-node-compact-large-37and its downstream CI gate. The Buncore-unit-fast-2partition reports two assertions insrc/plugins/runtime.retention.test.ts:Completed retirement retained a successor registryandLive recovery retained its retired instance. Fail-fast cancelled remaining jobs; 48 jobs succeeded, including the changed extension configuration lanes. This is not an all-green hosted-CI claim.Both exact assertions also fail in the same Bun partition on unrelated PR #149275 at its current head
b1a73f4de56a58726f5a54b5bbf50d0733664c91: CI run 36379467856, job 108793705564. Its log shows the same registry and recovery-source child modes. These children use empty registries and a synthetic temporary plugin; they never execute this PR's Telegram, Matrix or Feishu files. The only changed test routing entry selects the Mini App database-worker lane and does not select this core fixture. The full channel Testbox proof above passed.Peter explicitly directed exact-head admin squash landing when the only hosted failures demonstrably pre-exist in unrelated current CI, followed by repair of any unowned failure. That exception applies to head
da15bdd95eadbe7a68cf7980c74f102bb2d0c6b6. The plugin fixture repair subsequently landed independently in #160200. Its identical collection placement passed this lane's 20 standalone retention runs and both real-leak negative controls. A separate OOM-fixture lifetime defect found during the shard replays was repaired and merged in #160276; no duplicate plugin-retention patch was published.The final-head ClawSweeper review found no actionable code or security defect. Its remaining Test Server request is declined under Peter's explicit lane instruction permitting behavior-identical changes proved by byte comparisons; the exact 20-request comparison is documented above. It does not establish live Test Server behavior. Its generated configuration/data-model prompts cite
unknown-truncated-pull-files; inspection of the complete diff confirms no schema, persisted-format, manifest or configuration-key change.Blacksmith Testbox lease results and cleanup
tbx_01m3jkmm7624bngfvsss189b0htbx_01m3jpfy65ypf3xzp1memba4ddtbx_01m3jvqe5h37w3vq9bqvw7npe1tbx_01m3k3nc9xz8ymp4gktqbdctkxThe separate inherited-CI repair leases and commands are recorded in the follow-up linked above.
Complete production-file coverage
Lane l134 fourth-pass coverage
Base:
47d9700dcf8. Recent merged PR subjects and name-only diffs since September 20 were read before editing. Untouched production files over 150 lines were inspected first. This table covers all 204 production TypeScript files over 200 lines at the starting base; tests and test support are excluded.extensions/feishu/src/channel.tsextensions/feishu/src/bot.tsextensions/feishu/src/reply-dispatcher.tsextensions/feishu/src/monitor.comment.tsextensions/telegram/src/channel.tsextensions/feishu/src/docx.tsextensions/telegram/src/action-runtime.tsextensions/telegram/src/bot-message-context.session.tsextensions/telegram/src/message-cache.tsextensions/telegram/src/bot/delivery.replies.tsextensions/feishu/src/doctor.tsextensions/telegram/src/draft-stream.tsextensions/feishu/src/media.tsextensions/feishu/src/outbound.tsextensions/telegram/src/fetch.tsextensions/matrix/src/matrix/sdk/verification-manager.tsextensions/matrix/src/matrix/sdk/client-base.tsextensions/telegram/src/bot-message-dispatch-delivery.tsextensions/telegram/src/bot-native-command-menu.tsextensions/feishu/src/monitor.transport.tsextensions/feishu/src/drive.tsextensions/matrix/src/matrix/thread-bindings.tsextensions/telegram/src/bot-message-dispatch-reply.tsextensions/telegram/src/bot-handlers.callback-router.tsextensions/matrix/src/matrix/client/config.tsextensions/telegram/src/thread-bindings.tsextensions/matrix/src/onboarding.tsextensions/feishu/src/streaming-card.tsextensions/telegram/src/rich-blocks.tsextensions/telegram/src/webhook.tsextensions/feishu/src/send.tsextensions/matrix/src/cli-shared.tsextensions/telegram/src/bot-handlers.callback-router-controls.tsextensions/telegram/src/bot-message-context.tsextensions/telegram/src/lane-delivery-text-deliverer.tsextensions/telegram/src/doctor.tsextensions/telegram/src/format.tsextensions/telegram/src/bot/helpers.tsresolveTelegramReplyIdonly forwards tonormalizeTelegramReplyToMessageId; preserve public name through a direct re-export rather than an extra body. Forum-cache, group/DM authorization, and reply-context flows have separate behavior and remain untouched.extensions/matrix/src/matrix/sdk.tsextensions/matrix/src/matrix/client/shared.tsextensions/matrix/src/matrix/monitor/handler.tsextensions/matrix/src/channel.tsextensions/matrix/src/matrix/format.tsextensions/telegram/src/polling-session.tsextensions/telegram/src/send-message.tsextensions/matrix/src/tool-actions.tsextensions/matrix/src/matrix/monitor/verification-events.tsextensions/telegram/src/bot-message-dispatch-draft.tsextensions/matrix/src/matrix/send.tsextensions/feishu/src/bitable.tsextensions/telegram/src/bot-handlers.inbound-authorization.tsextensions/telegram/src/bot-handlers.message-pipeline.tsextensions/feishu/src/monitor.account.tsextensions/telegram/src/bot-handlers.message-context.tsextensions/matrix/src/approval-handler.runtime.tsextensions/matrix/src/matrix/crypto-state-store.tsextensions/matrix/src/matrix/actions/verification.tsextensions/matrix/doctor-contract-api.tsextensions/telegram/src/outbound-adapter.tsextensions/matrix/src/matrix/monitor/index.tsextensions/telegram/src/send-context.tsextensions/matrix/src/matrix/sdk/recovery-key-store.tsextensions/telegram/src/bot-message-dispatch.tsextensions/feishu/src/presentation-card.tsextensions/telegram/src/rich-blocks-html-map.tsextensions/telegram/src/bot-handlers.inbound-media.tsextensions/matrix/src/matrix/client/storage.tsextensions/feishu/src/client.tsextensions/telegram/src/telegram-ingress-drain.tsextensions/telegram/src/bot-message.tsextensions/matrix/src/matrix/monitor/events.tsextensions/matrix/src/matrix/sdk/client-core.tsextensions/feishu/src/feishu-ingress.tsextensions/telegram/src/bot-handlers.event-bindings.tsextensions/matrix/src/matrix/monitor/handler-ingress-content.tsextensions/matrix/src/matrix/sdk/decrypt-bridge.tsextensions/feishu/src/monitor.message-handler.tsextensions/telegram/src/bot-message-context.body.tsextensions/matrix/src/matrix/monitor/config.tsextensions/matrix/src/matrix/sdk/transport.tsextensions/telegram/src/bot/body-helpers.tsextensions/matrix/src/matrix/delivery-plan.tsextensions/matrix/src/matrix/monitor/inbound-dedupe-migration.tsextensions/telegram/src/bot-native-command-dispatch.tsextensions/telegram/src/account-throttler.tsextensions/feishu/src/card-action.tsextensions/telegram/src/bot-native-command-menu-state.tsextensions/feishu/src/setup-surface.tsextensions/telegram/src/bot/delivery.resolve-media.tsresolveTelegramPrimaryMediafor documents versus audio/voice; unifying would change behavior. Trusted local roots, mapped container paths, retries, and source-fetch policy are concrete contracts; no safe large cleanup.extensions/telegram/src/rich-block-model.tsextensions/matrix/src/cli-verification.tsextensions/feishu/src/config-schema.tsextensions/telegram/src/bot-core.tsextensions/matrix/src/matrix/poll-types.tsextensions/matrix/src/matrix/sdk/crypto-bootstrap.tsextensions/telegram/src/bot-handlers.inbound-pipeline.tsextensions/telegram/src/interactive-fallback.tsextensions/telegram/src/send-prepared.tsextensions/telegram/src/doctor-contract.tsextensions/telegram/src/message-cache-codec.tsextensions/feishu/src/comment-shared.tsextensions/matrix/src/matrix/sdk/idb-persistence.tsextensions/telegram/src/telegram-ingress-worker.runtime.tsextensions/matrix/src/matrix/monitor/room-history.tsextensions/telegram/src/bot-native-command-builtins.tsextensions/feishu/src/app-registration.tsextensions/matrix/src/approval-reactions.tsextensions/matrix/src/matrix/monitor/startup-verification.tsextensions/telegram/src/bot-message-dispatch-progress.tsextensions/telegram/src/bot-message-dispatch-turn.tsextensions/matrix/src/matrix/actions/messages.tsextensions/telegram/src/bot-native-commands.tsextensions/telegram/src/network-errors.tsextensions/telegram/src/bot-handlers.inbound-processing.tsextensions/feishu/src/thread-bindings.tsextensions/matrix/src/approval-native.tsextensions/telegram/src/approval-handler.runtime.tsextensions/telegram/src/bot-native-command-login.tsextensions/matrix/src/matrix/monitor/handler-context.tsextensions/telegram/src/channel-actions.tsextensions/telegram/src/send-message-text.tsextensions/matrix/src/matrix/sdk/client-verification.tsextensions/matrix/src/matrix/client/sync-cache-state.tsextensions/feishu/src/policy.tsextensions/matrix/src/matrix/monitor/handler-ingress-access.tsextensions/telegram/src/bot-update-tracker.tsextensions/feishu/src/bot-content.tsextensions/feishu/src/accounts.tsextensions/matrix/src/cli-account.tsextensions/matrix/src/matrix/direct-management.tsextensions/feishu/src/comment-handler.tsextensions/telegram/src/config-schema.tsextensions/feishu/src/read-policy.tsextensions/feishu/src/monitor.vc-meeting-invited-handler.tsextensions/telegram/src/button-types.tsextensions/matrix/src/matrix/monitor/handler-reply-dispatcher.tsextensions/matrix/src/matrix/send/chunking.tsextensions/telegram/src/sendchataction-401-backoff.tsextensions/telegram/src/bot-handlers.inbound-buffer.tsextensions/telegram/src/bot-native-command-plugins.tsextensions/matrix/src/outbound.tsextensions/feishu/src/docx-markdown.tsextensions/matrix/src/matrix/monitor/direct.tsextensions/telegram/src/outbound-media.tsextensions/telegram/src/probe.tsextensions/matrix/src/matrix/monitor/reaction-events.tsextensions/feishu/src/bot-broadcast.tsextensions/feishu/src/chat.tsextensions/telegram/src/model-buttons.tsextensions/feishu/src/post.tsextensions/telegram/src/send-special.tsextensions/matrix/src/cli-verification-backup.tsextensions/matrix/src/exec-approvals.tsextensions/telegram/src/account-inspect.tsextensions/telegram/src/conversation-route.tsextensions/telegram/src/send-edit.tsextensions/telegram/src/bot/inbound-text-entities.tsextensions/matrix/src/matrix/read-policy.tsextensions/matrix/src/matrix/config-update.tsextensions/telegram/src/history-policy.tsextensions/feishu/src/wiki.tsextensions/matrix/src/matrix/client/file-sync-store.tsextensions/telegram/src/rich-block-split.tsextensions/telegram/src/sequential-key.tsextensions/feishu/src/comment-reaction.tsextensions/telegram/src/status-reaction-variants.tsextensions/feishu/src/docx-table-ops.tsextensions/matrix/src/matrix/send/media.tsextensions/feishu/src/markdown.tsextensions/telegram/src/send-actions.tsextensions/feishu/src/subagent-hooks.tsextensions/matrix/src/matrix/monitor/mentions.tsextensions/matrix/src/matrix/format-spoiler-ranges.tsextensions/telegram/src/ingress.tsextensions/telegram/src/miniapp/routes.tsextensions/telegram/src/rich-blocks-html.tsextensions/feishu/src/interactive-message-content.tsextensions/matrix/src/matrix/deps.tsextensions/matrix/src/matrix/monitor/handler-draft-controller.tsextensions/telegram/src/telegram-text-delivery.tsextensions/matrix/src/matrix/accounts.tsextensions/telegram/src/bot-message-dispatch-context.tsextensions/feishu/src/probe.tsextensions/telegram/src/send-outbound.tsextensions/feishu/src/native-card.tsextensions/telegram/src/update-offset-store.tsextensions/telegram/src/status-issues.tsextensions/matrix/src/doctor-contract.tsextensions/telegram/src/history-read.tsextensions/telegram/src/polling-lease.tsextensions/feishu/src/dynamic-agent.tsextensions/telegram/src/bot-processing-outcome.tsextensions/matrix/src/setup-config.tsextensions/telegram/src/topic-name-cache.tsextensions/matrix/src/matrix/draft-stream.tsextensions/matrix/src/matrix/sdk/client-support.tstimedOutis unconsumed but deleting internal result shape is optional and low value.extensions/matrix/src/matrix/monitor/handler-helpers.tsextensions/telegram/src/monitor.tsextensions/telegram/src/format-html.tsextensions/matrix/src/config-schema.tsextensions/telegram/src/progress-draft-preview.tsextensions/feishu/src/doctor-contract.tsextensions/matrix/src/matrix/sdk/types.tsextensions/telegram/src/target-writeback.ts