refactor(plugins): route Telegram runtime through plugin sdk#51772
Conversation
Greptile SummaryThis PR completes the
Confidence Score: 5/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f65e91a175
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| setTelegramThreadBindingIdleTimeoutBySessionKey, | ||
| setTelegramThreadBindingMaxAgeBySessionKey, | ||
| telegramMessageActions, | ||
| } from "../../../extensions/telegram/runtime-api.js"; | ||
| } from "../../plugin-sdk/telegram.js"; |
There was a problem hiding this comment.
Avoid routing Telegram cold paths through the full SDK barrel
Switching this eager import to ../../plugin-sdk/telegram.js widens createRuntimeTelegram()'s cold path from the narrow runtime API to the entire Telegram SDK barrel. src/plugin-sdk/telegram.ts re-exports src/plugins/runtime/runtime-telegram-contract.ts, which in turn pulls in extensions/telegram/api.ts and modules like extensions/telegram/src/sticker-cache.ts that load model-catalog/media-understanding code. As a result, even lightweight callers that only need resolveTelegramToken or collectUnmentionedGroupIds now pay that startup cost the first time channel.telegram is touched, which regresses Telegram startup and defeats the intent of the existing lazy runtime-telegram-ops.runtime.ts split.
Useful? React with 👍 / 👎.
| resolveSlackUserAllowlist as resolveSlackUserAllowlistImpl, | ||
| sendMessageSlack as sendMessageSlackImpl, | ||
| handleSlackAction as handleSlackActionImpl, | ||
| } from "../../../extensions/slack/runtime-api.js"; | ||
| } from "../../plugin-sdk/slack.js"; |
There was a problem hiding this comment.
Preserve the narrow Slack lazy-runtime import surface
This lazy runtime boundary used to depend only on extensions/slack/runtime-api.js; routing it through ../../plugin-sdk/slack.js now forces the whole Slack SDK barrel to initialize on first use. That barrel re-exports extensions/slack/api.ts, which brings in unrelated HTTP/action/client modules (for example extensions/slack/src/client.ts and extensions/slack/src/http/index.ts) before simple operations like probeSlack or allowlist resolution run. For Slack status/onboarding flows, that turns a targeted lazy load into a much heavier cold-start and memory hit.
Useful? React with 👍 / 👎.
f65e91a to
a0c4175
Compare
a0c4175 to
d45230f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d45230fb11
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| setTelegramThreadBindingMaxAgeBySessionKey, | ||
| telegramMessageActions, | ||
| } from "../../../extensions/telegram/runtime-api.js"; | ||
| } from "../../plugin-sdk/telegram.js"; |
There was a problem hiding this comment.
Keep Telegram runtime off the full plugin-sdk barrel
Switching this import to ../../plugin-sdk/telegram.js widens runtime-telegram.ts from the narrow runtime API to the full Telegram SDK barrel, which re-exports extensions/telegram/api.ts and modules like extensions/telegram/src/sticker-cache.ts. Fresh evidence: src/plugins/runtime/runtime-channel.ts imports createRuntimeTelegram unconditionally, so this extra Telegram API graph is now loaded on every plugin-runtime startup, even in non-Telegram flows that never touch channel.telegram. That turns a boundary cleanup into a real startup and memory regression for all plugin-backed commands.
Useful? React with 👍 / 👎.
* main: (516 commits) fix: use content hash for memory flush dedup instead of compactionCount (openclaw#30115) (openclaw#34222) fix(tts): add matrix to VOICE_BUBBLE_CHANNELS (openclaw#37080) feat(memory): pluggable system prompt section for memory plugins (openclaw#40126) fix: detect nvm services from installed command (openclaw#51146) fix: handle Linux nvm CA env before startup (openclaw#51146) (thanks @GodsBoy) refactor: route Telegram runtime through plugin sdk (openclaw#51772) refactor: route iMessage runtime through plugin sdk (openclaw#51770) refactor: route Slack runtime through plugin sdk (openclaw#51766) refactor(doctor): extract provider and shared config helpers (openclaw#51753) Fix Discord `/codex_resume` picker expiration (openclaw#51260) fix(ci): remove duplicate embedding default export fix(ci): restore embedding defaults and plugin boundaries fix: compaction safeguard summary budget (openclaw#27727) web UI: fix context notice using accumulated inputTokens instead of prompt snapshot (openclaw#51721) fix(status): skip cold-start status probes refactor(doctor): extract telegram provider warnings (openclaw#51704) fix(telegram): default fresh setups to mention-gated groups docs(changelog): note telegram doctor first-run guidance fix(doctor): add telegram first-run guidance fix(doctor): suppress telegram fresh-install group warning ...
Summary
src/plugins/runtime/runtime-telegram.tsandsrc/plugins/runtime/runtime-telegram-ops.runtime.tsthroughsrc/plugin-sdk/telegram.tssrc/plugins/** must not import extensions/**inventory to zeroTesting
import { createRuntimeTelegram } from './src/plugins/runtime/runtime-telegram.ts';
const runtime = createRuntimeTelegram();
console.log(JSON.stringify({
hasAudit: typeof runtime.auditGroupMembership === 'function',
hasCollectUnmentioned: typeof runtime.collectUnmentionedGroupIds === 'function',
hasProbe: typeof runtime.probeTelegram === 'function',
hasToken: typeof runtime.resolveTelegramToken === 'function',
hasSend: typeof runtime.sendMessageTelegram === 'function',
hasPoll: typeof runtime.sendPollTelegram === 'function',
hasMonitor: typeof runtime.monitorTelegramProvider === 'function',
hasMessageActions: typeof runtime.messageActions === 'object',
hasTypingPulse: typeof runtime.typing.pulse === 'function',
hasEdit: typeof runtime.conversationActions.editMessage === 'function'
}, null, 2));
EON