Repository navigation
fix(telegram): resolve native command names from the loaded registry only - #123607
Conversation
…only Telegram's native-command registration resolved provider names through getChannelPlugin's bundled fallback. With no loaded registry entry (tests, dev tools), that fallback jiti-loads the entire Telegram plugin plus core graph from TypeScript source (~190s CPU, silent), which tripped the 300s no-output CI watchdog on the two test files that register at module scope. Telegram defines no resolveNativeCommandName hook, so the load resolved nothing. Thread the existing includeBundledChannelFallback option through listNativeCommandSpecs/listNativeCommandSpecsForConfig and use loaded-registry-only lookups in the Telegram plugin, matching the Discord sibling fix.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 6:45 AM ET / 10:45 UTC. ClawSweeper reviewWhat this changesThe PR threads an existing loaded-registry-only lookup option through native command listing and uses it for Telegram command registration and dispatch. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. Current main still uses the bundled fallback for Telegram native-command resolution; this active maintainer PR narrowly avoids that source-load path without changing Telegram’s current default command names. No blocking correctness or security finding was identified. Priority: P2 Review scores
Verification
How this fits togetherTelegram builds its native Bot API command menu from the shared command registry, optionally consulting a channel plugin for provider-specific names. The resulting names are registered as handlers and later resolved back into core command definitions. flowchart LR
A[Telegram bot startup] --> B[Native command registry]
B --> C[Channel plugin lookup]
C --> D[Command names and menu]
D --> E[Telegram command handlers]
F[Bundled plugin fallback] --> C
Before merge
Agent review detailsSecurityNone. PR surfaceSource +41, Tests +5. Total +46 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared default fallback for other channel consumers and land the explicit loaded-registry-only policy at Telegram’s native command boundary once exact-head CI is green. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the affected Telegram tests install an empty registry before module-scope registration, while current main falls through from the shared registry to bundled loading. The review is read-only, so it did not rerun the timing scenario. Is this the best way to solve the issue? Yes. This is the narrowest maintainable fix: Telegram has no current name-resolver hook, while the shared default fallback remains necessary for sibling channels that do override native names. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c2269f7a6c41. 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
|
…m shards (#123649) Hosted CI runners restored the boundary-artifact cache and rebuilt it anyway: fresh checkouts re-stamp every input mtime, so mtime freshness never passed. Stamp files now record the input content digest and byte-identical inputs skip the rebuild (~60s saved per hosted lint/boundary job, 0.17s verify). Telegram CI shards pack ten files per job instead of five now that per-file import cost is back to seconds (#123607), halving the ~42-job fanout.
…only (openclaw#123607) Telegram native-command registration resolved provider names through the bundled channel-plugin fallback, which jiti-transpiles the entire plugin plus core graph from source when no registry entry is loaded (~190s silent CPU) — tripping the 300s no-output CI watchdog on the two Telegram test files that register at module scope. Telegram defines no resolveNativeCommandName hook, so the load resolved nothing. Thread the existing includeBundledChannelFallback option through the spec-listing helpers and use loaded-registry-only lookups in the Telegram plugin, matching the Discord sibling. Runtime names are byte-identical; both files drop from 200s to ~5s.
…m shards (openclaw#123649) Hosted CI runners restored the boundary-artifact cache and rebuilt it anyway: fresh checkouts re-stamp every input mtime, so mtime freshness never passed. Stamp files now record the input content digest and byte-identical inputs skip the rebuild (~60s saved per hosted lint/boundary job, 0.17s verify). Telegram CI shards pack ten files per job instead of five now that per-file import cost is back to seconds (openclaw#123607), halving the ~42-job fanout.
What Problem This Solves
Telegram extension CI jobs die at exit 143 with zero output:
extensions/telegram/src/bot-native-commands.test.tsandbot-native-command-plugins.test.tssit silent for 300s, hit the no-output watchdog, retry, and fail again (e.g. run 31787829476, jobs 14/15). This holds back every Telegram PR, including #123528.Why This Change Was Made
CPU profile of the hang (95% of worker samples) shows the real cause — not a cache deadlock and not a slow-but-legitimate import:
registerTelegramNativeCommands(...)at module scope, so the cost lands in Vitest's silent import phase.listNativeCommandSpecsForConfig→resolveNativeName→getChannelPlugin("telegram"). The tests install an empty plugin registry, so the lookup falls through togetBundledChannelPlugin, which jiti-loadsextensions/telegram/channel-plugin-api.tsfrom TypeScript source — Babel-transpiling the whole plugin plus core graph inside the worker (~190s CPU locally, >300s on CI runners).resolveNativeCommandNamehook (only Slack/Discord do), so the load resolvesundefinedand the default name is used anyway: a ~190s no-op.Discord hit this class before and used the existing
includeBundledChannelFallback: falseescape hatch one-sidedly (extensions/discord/src/monitor/native-command.ts). This PR threads that option throughlistNativeCommandSpecs/listNativeCommandSpecsForConfigand applies loaded-registry-only lookups in the Telegram plugin.User Impact
None at runtime: a live gateway always has the Telegram channel plugin in the loaded registry, and Telegram has no native-name hook, so resolved command names are byte-identical. Dev/test checkouts stop paying a hidden multi-minute jiti transpile; Telegram CI shards stop timing out.
Evidence
bot-native-command-plugins.test.tsalone = 197s (import 195s, tests 1.4s); identical with warm or disabled fs-module-cache, disproving the cache theory. After: 5.8s.bot-native-commands.test.ts: 202s → 5.1s.src/auto-reply/commands-registry.test.ts(39), Discordnative-command.think-autocomplete.test.ts(5), and 7 Telegram bot-native/menu files (99) — all pass.tsgo:core,tsgo:extensions, all test type lanes,check:test-types, oxlint, oxfmt,git diff --checkclean.