Repository navigation
improve(telegram): cut cold channel setup import latency - #122955
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 4:18 AM ET / 08:18 UTC. ClawSweeper reviewWhat this changesThe PR separates Telegram’s setup-only plugin surface from commands, Doctor, and security runtime behavior to reduce cold Merge readinessKeep this PR open: no blocking correctness defect was found, and current main still loads Telegram setup through the runtime-heavy shared base. Exact-head CI is still running, and the maintainer label requires a human landing decision. Priority: P2 Review scores
Verification
How this fits togetherThe channel-add command loads a setup-scoped Telegram plugin to collect credentials, validate config, and apply setup changes. Telegram’s full runtime plugin then supplies message commands, diagnostics, and security behavior after setup. flowchart LR
A[Channel add command] --> B[Setup plugin registry]
B --> C[Telegram setup-safe base]
C --> D[Wizard config and secrets]
E[Telegram runtime entry] --> F[Runtime plugin additions]
F --> G[Commands Doctor security]
D --> H[Configured Telegram channel]
G --> H
Decision needed
Why: The patch is technically coherent, but the maintainer label and author association require an explicit human landing judgment rather than automated cleanup. Before merge
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +1, Config +7, Other +2. Total +19 across 13 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the setup-safe Telegram base once exact-head CI confirms the packaged-private SDK boundary and the retained setup contract on the current head. Do we have a high-confidence way to reproduce the issue? Yes: current main’s setup entry imports the broad shared base, and the PR supplies a concrete cache-disabled bundled-setup measurement plus focused command and plugin test commands. Is this the best way to solve the issue? Yes: keeping one canonical setup-safe base and extending it only for runtime behavior removes the import leak without changing Telegram’s setup contract or adding a parallel policy path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3b6e54041f18. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
6ac5958 to
f31c880
Compare
f31c880 to
640743a
Compare
640743a to
0e199d0
Compare
|
Merged via squash.
|
…2955) * perf(telegram): keep setup entry on light graph * fix(plugin-sdk): complete private UI hint boundaries
What Problem This Solves
Fixes an issue where operators running
openclaw channels add telegramwould pay for Telegram's full runtime graph during a cold setup-only load. The same import leak dominatedsrc/commands/channels.add.test.ts: main CI run 31657034715 spent 81.7s in the file and 79.5s in the Telegram--use-envcase, makingchecks-node-compact-small-8the slowest lane at 6.6 minutes.Why This Change Was Made
Telegram now composes one canonical setup-safe plugin base containing the existing metadata, setup wizard, setup contract, capabilities, config schema, account config behavior, reload rules, and secret declarations. The full runtime plugin reuses that base and adds commands, Doctor, and security; the setup entry never imports those runtime-only surfaces.
The refactor also replaces three broad SDK imports with existing narrow seams:
secret-provider-alias,secret-input, and a packaged-privatechannel-config-ui-hintsentrypoint. This keeps the plugin boundary intact without promoting a new public SDK API.User Impact
Cold
openclaw channels add telegramsetup lookup is materially faster while Telegram setup UX, configuration validation, credential handling, secrets, and full runtime behavior remain unchanged.Evidence
AI-assisted change; final Codex autoreview was clean with no accepted/actionable findings.
Import profiling before the fix:
sourceLoaderCallMs=78,610.6), 2,199 Jiti-transformed modules.openclaw/plugin-sdk/provider-authedge fromaccount-inspect.tsopened 1,347 modules by itself.src/agents/harness/registry.ts131.326ms;packages/ai/dist/reasoning-tag-text-partitioner-*.mjs104.563ms;src/plugins/providers.ts89.88ms;extensions/telegram/setup-plugin-api.ts80.643ms;src/agents/auth-profiles/oauth-manager.ts63.527ms;kysely/dist/index.js62.038ms;src/agents/provider-request-config.ts60.287ms;commander/lib/command.js52.691ms;src/agents/auth-profiles/store.ts51.968ms;src/plugins/provider-runtime.ts50.784ms.Before/after:
time node scripts/run-vitest.mjs src/commands/channels.add.test.ts: 110.00s wall / 104.63s Vitest before; 15.80s wall / 12.60s Vitest after in the uncontended patch run. While this work was in flight, fix(ci): prevent channel add command test timeout #122879 independently landed the test-only synthetic contract optimization onmain; this PR now carries only the owner-boundary Telegram fix.Commands and gates:
OPENCLAW_VITEST_IMPORT_DURATIONS=1 OPENCLAW_VITEST_PRINT_IMPORT_BREAKDOWN=1 node scripts/run-vitest.mjs src/commands/channels.add.test.ts— 32/32 passed in the measured patch run.node scripts/run-vitest.mjs extensions/telegram/src/account-inspect.test.ts extensions/telegram/src/config-schema.test.ts extensions/telegram/src/setup-surface.test.ts extensions/telegram/src/shared.test.ts— 73/73 passed on Blacksmith Testbox.node scripts/check-changed.mjs -- <changed files>— passed all typecheck, lint, SDK surface, package boundary, dead-code, and import-cycle gates on Blacksmith Testbox.pnpm build— passed on Blacksmith Testbox in 4m59s; noINEFFECTIVE_DYNAMIC_IMPORTwarning for touched modules. Run: https://github.com/openclaw/openclaw/actions/runs/31660977841git diff --check— clean.The requested broad
node scripts/run-vitest.mjs extensions/telegramwas attempted locally and on a credential-hydrated Testbox, but both runs exposed unrelated current-main runtime-test failures (ambient multi-agentAgentSelectionRequiredError, polling/webhook timeouts) and the broad run hit the no-output watchdog. The setup/config owner tests above are green; exact-head PR CI remains the clean-environment broad-suite authority.