Skip to content

refactor(doctor): extract telegram provider warnings#51704

Merged
vincentkoc merged 2 commits intomainfrom
vincentkoc-code/doctor-refactor-telegram-phase1
Mar 21, 2026
Merged

refactor(doctor): extract telegram provider warnings#51704
vincentkoc merged 2 commits intomainfrom
vincentkoc-code/doctor-refactor-telegram-phase1

Conversation

@vincentkoc
Copy link
Copy Markdown
Member

Summary

  • Problem: src/commands/doctor-config-flow.ts still owns Telegram-specific setup and allowlist warning logic, which makes Doctor harder to split by provider.
  • Why it matters: adding provider-specific onboarding/warning behavior currently requires editing the monolithic config flow instead of extending provider-local doctor code.
  • What changed: extracted Telegram first-run and group allowlist warnings into src/commands/doctor/providers/telegram.ts, added a provider-local test file, and left doctor-config-flow.ts as the orchestrator/delegator for this slice.
  • What did NOT change (scope boundary): broader Doctor registry/orchestrator refactor, non-Telegram provider extraction, and warning text/runtime semantics.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

  • None intended. This is a refactor of existing Telegram Doctor warning/guidance behavior plus a changelog entry.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local Node 22 / pnpm
  • Model/provider: n/a
  • Integration/channel (if any): Telegram Doctor config flow
  • Relevant config (redacted): Telegram fresh-install and allowlist configs via unit tests

Steps

  1. Move Telegram-specific Doctor warning logic behind a provider-local module.
  2. Run focused tests for doctor-config-flow and the new Telegram provider test file.
  3. Run repo validation lanes that plausibly cover the touched surface.

Expected

  • Telegram Doctor warning behavior stays unchanged.
  • Doctor flow delegates this provider-specific slice to a provider-local module.

Actual

  • Focused Doctor tests passed.
  • pnpm build and pnpm check currently fail on unrelated latest-main baseline issues noted below.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Telegram fresh-install guidance still appears; configured-group empty allowlist warning still appears; allowFrom fallback still suppresses the warning.
  • Edge cases checked: top-level Telegram config and provider-local unit coverage.
  • What you did not verify: full Doctor refactor beyond Telegram, unrelated repo-wide build/check baseline failures.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert commits 6762e48ed1 and 65d215aa7d.
  • Files/config to restore: src/commands/doctor-config-flow.ts, src/commands/doctor/providers/telegram.ts, src/commands/doctor/providers/telegram.test.ts, CHANGELOG.md.
  • Known bad symptoms reviewers should watch for: missing Telegram first-run Doctor guidance or duplicate/changed group allowlist warnings.

Risks and Mitigations

  • Risk: provider extraction could subtly change warning copy or fallback behavior.
    • Mitigation: kept the delegated logic behavior-identical and added provider-local tests alongside existing flow tests.
  • Risk: reviewers may assume this is the full Doctor refactor.
    • Mitigation: scope is explicitly phase-1 Telegram-only extraction.

Validation Notes

  • Passed: pnpm exec vitest run src/commands/doctor-config-flow.test.ts src/commands/doctor/providers/telegram.test.ts
  • Fails on latest origin/main, unrelated to this PR:
    • pnpm build: src/memory/embeddings-openai.ts missing DEFAULT_OPENAI_EMBEDDING_MODEL; src/memory/manager-sync-ops.ts imports it.
    • pnpm check: oxfmt --check reports src/tts/tts.ts formatting with no diff in this branch.

@vincentkoc vincentkoc self-assigned this Mar 21, 2026
@openclaw-barnacle openclaw-barnacle bot added commands Command implementations size: S maintainer Maintainer-authored PR labels Mar 21, 2026
@vincentkoc vincentkoc marked this pull request as ready for review March 21, 2026 15:56
@vincentkoc vincentkoc merged commit a267c5d into main Mar 21, 2026
35 of 42 checks passed
@vincentkoc vincentkoc deleted the vincentkoc-code/doctor-refactor-telegram-phase1 branch March 21, 2026 15:57
@blacksmith-sh
Copy link
Copy Markdown
Contributor

blacksmith-sh bot commented Mar 21, 2026

Found 4 test failures on Blacksmith runners:

Failures

Test View Logs
Reinstall OpenClaw (this should install node-llama-cpp): npm i -g openclaw@latest View Logs
Reinstall OpenClaw (this should install node-llama-cpp): npm i -g openclaw@latest View Logs
Reinstall OpenClaw (this should install node-llama-cpp): npm i -g openclaw@latest View Logs
Reinstall OpenClaw (this should install node-llama-cpp): npm i -g openclaw@latest
View Logs

Fix in Cursor

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 21, 2026

Greptile Summary

This PR extracts Telegram-specific Doctor first-run and group-allowlist warning logic from the monolithic doctor-config-flow.ts into a new provider-local module at src/commands/doctor/providers/telegram.ts, accompanied by a focused unit test file and a changelog entry.

Key observations:

  • The refactor is behavior-identical for Telegram. allowsGroupAllowFromFallback("telegram") returns true (Telegram is not in the exclusion list), so the new code's assumption that Telegram always falls back to allowFrom is correct.
  • The return in checkAccount is now issued for all Telegram accounts (not just first-run), but since checkAccount has no code after the groupPolicy block, this is functionally equivalent.
  • Minor improvement in the extracted warning message: set ${params.prefix}.groupPolicy to "open" is more specific than the original set groupPolicy to "open".
  • Tests cover the three key branches: no groups (first-run), groups configured + empty allowFrom (warning), groups + populated allowFrom (quiet).

Confidence Score: 5/5

  • This PR is safe to merge — the extraction is behavior-identical and covered by focused tests.
  • The logic is a clean extraction: allowsGroupAllowFromFallback("telegram") returns true, confirming the new module's assumption matches the original. All three warning branches are tested. No runtime semantics change for any Telegram Doctor path. The only behavioral delta is a minor improvement in the allowlist warning message (fully-qualified path hint).
  • No files require special attention.

Last reviewed commit: "docs(changelog): not..."

mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 21, 2026
* 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
  ...
JohnJAS pushed a commit to JohnJAS/openclaw that referenced this pull request Mar 22, 2026
* refactor(doctor): extract telegram provider warnings

* docs(changelog): note doctor provider refactor
pholpaphankorn pushed a commit to pholpaphankorn/openclaw that referenced this pull request Mar 22, 2026
* refactor(doctor): extract telegram provider warnings

* docs(changelog): note doctor provider refactor
frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
* refactor(doctor): extract telegram provider warnings

* docs(changelog): note doctor provider refactor
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
* refactor(doctor): extract telegram provider warnings

* docs(changelog): note doctor provider refactor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant