Skip to content

fix(doctor): stop reporting a fully configured Telegram setup as first-time setup - #124706

Closed
ggeutzzang wants to merge 2 commits into
openclaw:mainfrom
ggeutzzang:fix/telegram-doctor-parent-scope-false-positive
Closed

ggeutzzang wants to merge 2 commits into
openclaw:mainfrom
ggeutzzang:fix/telegram-doctor-parent-scope-false-positive

Conversation

@ggeutzzang

@ggeutzzang ggeutzzang commented Aug 16, 2026 •

Copy link
Copy Markdown

Closes #124705

What Problem This Solves

Fixes an issue where operators running Telegram with multiple accounts would see
openclaw doctor report the channel as unconfigured, even though every account already
lists its groups and the bots reply in those groups normally:

- channels.telegram: Telegram is in first-time setup mode. DMs use pairing mode, so new
  senders must start a chat and be approved before regular messages are accepted. Group
  messages stay blocked until you add allowed chats under channels.telegram.groups ...

The warning tells operators their group messages are blocked when they are not, and points
at channels.telegram.groups — a key that multi-account setups intentionally leave empty
because each account carries its own groups. Doctor is what people reach for when
something looks broken, so a permanent false alarm there costs trust in every other line
it prints.

Why This Change Was Made

There are two layers here, and the first one reaches past Telegram.

Layer 1 — doctor could not resolve any channel's accounts.
resolveDoctorChannelAccountIds resolves the channel through normalizeAnyChannelId,
which only knows channels present in the plugin registry. Doctor inspects config without
starting channels, so that registry is empty and the function returned undefined for
every channel. That makes hasImplicitActiveAccount unconditionally true, which means
suppressParentGroupAllowlistWarning — added in #93434 for exactly this class of
parent-scope false positive — has been permanently false in production. Its tests pass
because they run where the registry is populated.

Doctor was already inconsistent with itself: channel-doctor.ts locates the Telegram
adapter through resolveReadOnlyChannelPluginsForConfig (config-driven, registry-free), so
the warning is produced, while channel-capabilities.ts needs the registry, so the data
that would suppress it is missing. getDoctorChannelCapabilities already sidesteps this by
consulting the bundled catalog first. Account resolution now falls back the same way
doctor already does elsewhere — the bundled catalog for bundled channels, and the
config-driven read-only plugin loader for configured external ones — so both halves of
doctor agree on which channels exist, third-party channels included.

Layer 2 — the parent container scope is checked as if it were an account.
scanEmptyAllowlistPolicyWarnings calls checkAccount(channelConfig, "channels.telegram", …, parent: undefined). Once accounts are in use that scope holds no groups of its own,
so Telegram's first-time guidance fires there while both account scopes stay silent. The
scanner's existing suppression signal reaches collectEmptyAllowlistPolicyWarningsForAccount
but not the channel-supplied extraWarningsForAccount hook, which is where that guidance
comes from. The parent scope now carries its active child accounts in the existing
ChannelDoctorEmptyAllowlistAccountContext as an optional childAccounts field, and
Telegram skips first-time guidance only when every active account defines groups.

The field is additive. The hook keeps being invoked on exactly the scopes it is invoked
on today, and a channel plugin that ignores childAccounts behaves exactly as before, so
no existing plugin — bundled or external — changes behavior without opting in.

childAccounts is withheld when hasImplicitActiveAccount is true — the same guard #93434
applied. A container-level botToken/tokenFile/$TELEGRAM_BOT_TOKEN synthesizes an
implicit default runtime account that inherits this scope and has no scope of its own to
warn on, so its group routing really is unconfigured and the container keeps owning that
guidance. It is also withheld when there are no active accounts, so when present it is
always non-empty. Deciding this in the scanner rather than in the adapter keeps the
account-resolution data and the guard in one place.

Non-goals: setups with no accounts block keep the existing warning verbatim, accounts
that genuinely lack groups keep warning at their own scope, and no authorization or
routing behavior changes — this only affects what doctor prints.

Blast radius, stated plainly. Layer 1 is broader than the Telegram symptom that led
here. Because resolveDoctorChannelAccountIds previously returned undefined for every
channel, suppressParentGroupAllowlistWarning was dead for every channel. This change
makes that suppression live across all channels at once. It only fires when every active
account genuinely resolves a groupAllowFrom (or allowFrom under the fallback
capability), so operators lose no real warning — but reviewers should weigh it as a
cross-channel behavior change, not a Telegram-only one. empty-allowlist-scan.test.ts
covers a non-Telegram channel on both sides of that boundary.

User Impact

Operators running multiple Telegram accounts get a clean openclaw doctor run instead of a
standing false alarm, and real first-time setups still get the guidance they need, reported
at the account scope that actually needs fixing. Beyond Telegram, doctor can now resolve
channel accounts at all during a normal run, which is what #93434's suppression needed to
work in the first place.

Evidence

Measured on the real CLI, not just tests. Built the repo and ran node openclaw.mjs doctor against a live 6-account Telegram config. Temporary instrumentation confirmed the
root cause before the fix:

TMPDIAG2 channelId=null
TMPDIAG  telegram accountIds=undefined implicit=true active=6

Each layer was then reverted independently and the CLI rebuilt, which shows both are
required:

Applied first-time setup warnings in real doctor output
neither 1
layer 1 only 1
both 0

No other Telegram warnings changed; the remaining ones are unrelated (dead-lettered ingress
events).

Red/green, production change reverted per layer. Reverting only
src/commands/doctor/channel-capabilities.ts:

× resolves account ids through the bundled catalog when no channel is registered
AssertionError: expected undefined to deeply equal { configured: [ 'default' ], …(1) }

Reverting only extensions/telegram/src/doctor.ts:

× skips parent-scope first-time guidance when every account configures groups
AssertionError: expected [ Array(1) ] to deeply equal []

Reverting only src/commands/doctor/shared/empty-allowlist-scan.ts:

× exposes active child accounts to the parent container scope only
AssertionError: Target cannot be null or undefined.

Test lanes:

Lane Result
commands lane (all doctor tests) 319 files, 4117 passed, 4 skipped
test:channels 100 files, 1122 passed
test:contracts:plugins 42 files, 1039 passed
test:contracts:channels 4 shards, all passed
test:extension telegram 212 chunks, 3593 passed, 0 failed
pnpm check green except assertion SAFETY comment ratchet

The one pnpm check failure is pre-existing and unrelated: it reports
src/gateway/server.auth.control-ui.pairing.suite.ts: 6 < 11 (a baseline larger than the
real count). Stashing this change and rerunning produces byte-identical output, so it
reproduces on main untouched.

New coverage pins both layers: account ids resolve through the bundled catalog when no
channel is registered, resolve a configured external plugin through the read-only loader,
and still return undefined when no loader can identify the channel;
first-time guidance is skipped only when every active account configures groups, and is
preserved when one account lacks them, when there is no accounts block, when
childAccounts is withheld for an implicit runtime account, and at account scope.

Prepared with AI assistance (Claude Code).

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram commands Command implementations size: M labels Aug 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 12:14 AM ET / 04:14 UTC (Revision 16).

ClawSweeper review

What this changes

The PR repairs Doctor’s channel-account discovery and suppresses misleading Telegram setup guidance when every active account configures groups.

Merge readiness

⛔ Blocked before merge - 6 items remain

Keep open: the reported bug remains on current main and the latest release, and this PR contains useful, demonstrated work. The prior P2 finding remains unfixed.

Likely related people: vincentkoc and Peter Steinberger (routing candidates, medium confidence).

Priority: P2
Reviewed head: d1f5ed85ec872434149c616958c6085dcf6338e2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong CLI evidence supports the useful fix, but the retained environment defect limits implementation confidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured production CLI run exercises account discovery, parent scanning, and Telegram’s warning adapter against a live six-account configuration, showing the false warning change from one to zero after both layers. External-environment coverage remains a correctness gap, not missing contributor proof; no stored-data contract changes.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured production CLI run exercises account discovery, parent scanning, and Telegram’s warning adapter against a live six-account configuration, showing the false warning change from one to zero after both layers. External-environment coverage remains a correctness gap, not missing contributor proof; no stored-data contract changes.
Evidence reviewed 10 items Pinned introduced change: Inspected the complete merge-base-to-head patch. The actual checkout and original PR head are d1f5ed8; no pinned test merge is available.
Current main still reports the false positive: The parent scope has no groups, and current Telegram warning logic emits first-time setup guidance without examining configured child accounts. Current main’s account resolver also still returns undefined when registry normalization cannot identify the channel.
Latest release retains the affected behavior: Read v2026.9.8 source through GitHub’s contents endpoint: account discovery still depends on registry normalization, and Telegram’s parent warning has no child-account suppression.
Findings 1 actionable finding [P2] Forward Doctor’s environment to external account discovery
Security None None.

How this fits together

Doctor inspects channel configuration and plugin metadata to explain configuration problems to operators. Its shared account scanner supplies context to Telegram’s plugin-owned warning logic.

flowchart TD
  A[Channel configuration] --> B[Doctor inspection]
  C[Plugin catalog and installed plugins] --> D[Account discovery]
  B --> D
  D --> E[Parent and account scope checks]
  E --> F[Telegram setup guidance]
  F --> G[Operator diagnostics]
Loading

Decision needed

Question Recommendation
Should the public Channel Doctor context gain the optional, parent-only childAccounts field? Accept the narrow additive context: Approve the optional field with its documented pure-container invariant and unchanged callback invocation.

Why: The additive contract preserves existing callbacks, but its permanent SDK shape needs owner acceptance that contributor assertions and previous bot recommendations cannot supply.

Before merge

  • Forward Doctor’s environment to external account discovery (P2) - Still unfixed from the prior review: both Doctor entrypoints discover warning adapters with their supplied env, but this new account-discovery call omits it. The loader defaults to process.env and uses that environment for workspace and installed-plugin discovery. If an external channel exists only under Doctor’s supplied home/state environment, its warning hook resolves while account discovery returns undefined; the scanner then treats the parent as an implicit account and retains the false positive. Thread the same environment through both scanner entrypoints and assert it at the loader boundary.
  • Resolve merge risk (P1) - The optional childAccounts field expands the public Channel Doctor callback contract without recorded owner acceptance.
  • Resolve merge risk (P1) - Production grows by 69 net lines while account discovery repeats the shared Doctor plugin lookup; consolidate discovery around the existing environment-bound plugin map to remove avoidable growth.
  • Complete next step (P2) - Resolve the reported branch conflicts against current main while preserving its asynchronous account-resolution contract.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P2] Forward Doctor’s environment to external account discovery — src/commands/doctor/channel-capabilities.ts:98-101
Agent review details

Security

None.

PR surface

Source +69, Tests +270. Total +339 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 5 81 12 +69
Tests 5 270 0 +270
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 351 12 +339

Review metrics

Metric Value Why it matters
Production versus test growth Production net +69; tests +270 The parent context has a concrete contract purpose, but consolidating repeated discovery can absorb avoidable production growth.
Public callback context 1 optional field added; 0 config options added The SDK addition needs owner acceptance even though existing callbacks remain invoked.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/telegram/src/doctor.ts, migration/backfill/repair: src/commands/doctor/channel-capabilities.ts, migration/backfill/repair: src/commands/doctor/shared/empty-allowlist-scan.ts, unknown-data-model-change: src/commands/doctor/channel-capabilities.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #124705
Summary: This PR is the explicit candidate fix for the matching open report; the earlier merged repair covers only part of the diagnostic path.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Approve and consolidate the Doctor contract (recommended)
    Accept the additive context and reuse the shared environment-bound discovery result before landing.
  2. Pause for a narrower SDK design
    Keep the useful fix open while the owner specifies an alternative that preserves existing callback invocation.

Technical review

Best possible solution:

Use one environment-bound Doctor plugin lookup for account discovery and warnings, preserving callback invocation and genuine account-level guidance with an owner-approved parent context.

Do we have a high-confidence way to reproduce the issue?

Yes: the linked multi-account configuration and current-main parent warning path establish the false positive; the contributor also supplies real CLI before/after evidence. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Acceptable mitigation, but not yet the best complete fix: retain plugin-owned guidance and callback invocation while consolidating discovery and forwarding Doctor’s environment. Skipping the public callback would silently remove external-plugin diagnostics.

Full review comments:

  • [P2] Forward Doctor’s environment to external account discovery — src/commands/doctor/channel-capabilities.ts:98-101
    Still unfixed from the prior review: both Doctor entrypoints discover warning adapters with their supplied env, but this new account-discovery call omits it. The loader defaults to process.env and uses that environment for workspace and installed-plugin discovery. If an external channel exists only under Doctor’s supplied home/state environment, its warning hook resolves while account discovery returns undefined; the scanner then treats the parent as an implicit account and retains the false positive. Thread the same environment through both scanner entrypoints and assert it at the loader boundary.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8a0b0c458bbd.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs misleading operator diagnostics without changing working Telegram delivery.
  • merge-risk: 🚨 compatibility: The PR adds a public plugin callback-context field whose permanent contract has not received recorded owner acceptance.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The captured production CLI run exercises account discovery, parent scanning, and Telegram’s warning adapter against a live six-account configuration, showing the false warning change from one to zero after both layers. External-environment coverage remains a correctness gap, not missing contributor proof; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured production CLI run exercises account discovery, parent scanning, and Telegram’s warning adapter against a live six-account configuration, showing the false warning change from one to zero after both layers. External-environment coverage remains a correctness gap, not missing contributor proof; no stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: Inspected the complete merge-base-to-head patch. The actual checkout and original PR head are d1f5ed8; no pinned test merge is available. (d1f5ed85ec87)
  • Current main still reports the false positive: The parent scope has no groups, and current Telegram warning logic emits first-time setup guidance without examining configured child accounts. Current main’s account resolver also still returns undefined when registry normalization cannot identify the channel. (extensions/telegram/src/doctor.ts:483, 8a0b0c458bbd)
  • Latest release retains the affected behavior: Read v2026.9.8 source through GitHub’s contents endpoint: account discovery still depends on registry normalization, and Telegram’s parent warning has no child-account suppression. (src/commands/doctor/channel-capabilities.ts, fc23bc864e45)
  • Environment mismatch at the new discovery boundary: The introduced loader call omits env. The loader explicitly defaults to process.env at src/channels/plugins/read-only.ts:707 and uses it for manifest discovery. Both repair-sequencing.ts:312 and preview-warnings.ts:854 give their warning-hook lookup Doctor’s explicit environment, but the scanner cannot forward it to account discovery. (src/commands/doctor/channel-capabilities.ts:98, d1f5ed85ec87)
  • Prior finding remains unchanged: The account-resolution file is unchanged between the earlier reviewed head 787507f and the current head. Existing external-plugin tests mock discovery without asserting its environment; shared scanner tests mock account resolution, so they do not detect this mismatch. (src/commands/doctor/channel-capabilities.test.ts:186, d1f5ed85ec87)
  • Real CLI proof: The captured PR body reports a rebuilt CLI run against a live six-account Telegram configuration: neither layer and discovery alone each produced one first-time warning; both layers produced zero, with other Telegram diagnostics unchanged. The contributor’s fix(doctor): stop reporting a fully configured Telegram setup as first-time setup #124706 (comment) confirms the restored additive implementation matches that measured behavior. Per-layer failing regressions and broad test results supplement this production-path proof. (extensions/telegram/src/doctor.ts:524, d1f5ed85ec87)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Forward the explicit environment through both Doctor scanner paths and add regression coverage that fails when discovery uses process.env.
  • Record SDK owner acceptance and consolidate account discovery with the shared Doctor lookup.
  • Resolve the reported branch conflicts while preserving current main’s asynchronous account-resolution owner.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (15 earlier review cycles; latest 8 shown)
  • reviewed August 16, 2026, 5:54 PM ET / 21:54 UTC sha unknown :: needs changes before merge. :: [P2] Forward Doctor’s environment to external plugin resolution
  • reviewed 2026-08-17T04:06:07.724Z sha d1f5ed8 :: needs changes before merge. :: [P2] Pass Doctor’s environment to external plugin resolution
  • reviewed 2026-08-21T11:52:08.311Z sha d1f5ed8 :: needs changes before merge. :: [P2] Forward Doctor’s environment to external plugin resolution
  • reviewed August 22, 2026, 8:59 AM ET / 12:59 UTC sha unknown :: found issues before merge. :: [P2] Forward Doctor’s environment to external plugin resolution
  • reviewed 2026-08-23T22:04:56.011Z sha d1f5ed8 :: needs changes before merge. :: [P2] Forward Doctor’s environment to external account resolution
  • reviewed 2026-08-29T22:59:59.155Z sha d1f5ed8 :: needs changes before merge. :: [P2] Forward Doctor’s environment to external account resolution
  • reviewed 2026-08-29T23:08:17.389Z sha d1f5ed8 :: needs changes before merge. :: [P2] Forward Doctor’s environment to external account resolution
  • reviewed September 3, 2026, 3:05 AM ET / 07:05 UTC sha unknown :: blocked before merge. :: [P2] Forward Doctor’s environment to external account resolution

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 16, 2026
@ggeutzzang
ggeutzzang force-pushed the fix/telegram-doctor-parent-scope-false-positive branch from b545367 to 7a6cb23 Compare August 16, 2026 17:53
@ggeutzzang

Copy link
Copy Markdown
Author

CI status on 7a6cb23a35a

123 pass, 2 fail. openclaw/ci-gate fails only as a consequence of check-lint, so
there is one real failure — and it is a runner shutdown, not a lint error.

check-lint was killed by the runner on both runs, at different durations:

Run Duration Outcome
95202133949 9m50s runner shutdown
95203740315 6m15s runner shutdown

Both logs end the same way:

##[error]The runner has received a shutdown signal. This can happen when the runner
service is stopped, or a manually started runner is canceled.
[oxlint] FAILED (exit 143)
##[error]The operation was canceled.

143 is 128 + SIGTERM, so oxlint was terminated mid-run rather than reporting
violations.

Separately, pnpm lint does fail locally — but identically on main. Running
node --import tsx scripts/run-lint.mts on this branch reports:

extensions/cua-computer/src/mcp-driver-client.ts:89:62: error
typescript(no-redundant-type-constituents): 'ActionResult' is an 'error' type that acts
as 'any' and overrides all other types in this union type.

Checking out origin/main (3e0634f7ed9) and running the same command produces that
exact line, so it is pre-existing and untouched by this PR, which changes no file under
extensions/cua-computer/. Per CONTRIBUTING I have not tried to fix it here.

check-test-types passes on this head. It failed on the first push because of my own
test typing (vi.fn(() => []) inferring a zero-arg signature, so mock.calls
destructuring broke); that is fixed in 7a6cb23a35a.

I do not have rerun permissions on this run. Happy to push a rebase if a fresh CI run
would help.

@ggeutzzang
ggeutzzang force-pushed the fix/telegram-doctor-parent-scope-false-positive branch from 7a6cb23 to 871da6c Compare August 16, 2026 18:57
@openclaw-barnacle openclaw-barnacle Bot removed the channel: telegram Channel integration: telegram label Aug 16, 2026
@ggeutzzang

Copy link
Copy Markdown
Author

Reworked to avoid the plugin SDK contract change

The previous head added an optional childAccounts field to
ChannelDoctorEmptyAllowlistAccountContext so Telegram could tell a pure multi-account
container from an unconfigured account scope. ClawSweeper flagged that correctly: the
context is re-exported from the plugin SDK, so the field would become an external contract
even though bundled Telegram is the only consumer today.

That turned out to be avoidable. The scanner already knows whether a scope is a pure
container — it computes activeAccounts and hasImplicitActiveAccount a few lines above —
so it can decide whether to ask the channel at all instead of shipping the channel more
facts to reason about:

skipChannelExtraWarnings: activeAccounts.length > 0 && !hasImplicitActiveAccount,

Deciding whether to ask is the scanner's job; deciding what to warn about stays the
channel's. The guard is unchanged in spirit: when a container-level
botToken/tokenFile/$TELEGRAM_BOT_TOKEN synthesizes an implicit default runtime
account, that account inherits the container and has no scope of its own, so the hook still
runs and its guidance is preserved.

What this removes from the diff:

previous head this head
src/channels/plugins/types.adapters.ts +6 (public SDK context) untouched
extensions/telegram/src/doctor.ts +13 untouched
extensions/telegram/src/doctor.test.ts +64 untouched
production source +47/−8 +32/−9

No channel plugin code changes at all now, so the merge-risk: 🚨 compatibility concern
about expanding a public plugin-SDK hook payload should no longer apply. The second merge
risk (parent-scope suppression going live across bundled channels once account resolution
succeeds) is inherent to layer 1 and still stands as described in the PR body — it is the
part that makes #93434's suppression actually reachable.

Same verified outcome. Rebuilt and re-ran node openclaw.mjs doctor against the same
live 6-account Telegram config: the first-time setup mode line is gone, and no other
Telegram warning changed. Test lanes re-run on this head: commands 318 files / 4115 passed,
telegram extension unchanged at 26 tests in doctor.test.ts (it needed no new coverage
because it needed no change), tsgo:core:test clean for these files.

Happy to go back to the context-field approach if maintainers would rather have channels
make that call themselves — the earlier revision is preserved locally and easy to restore.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 16, 2026
@ggeutzzang
ggeutzzang force-pushed the fix/telegram-doctor-parent-scope-false-positive branch from 871da6c to 6643ee2 Compare August 16, 2026 19:24
@openclaw-barnacle openclaw-barnacle Bot added the channel: telegram Channel integration: telegram label Aug 16, 2026
@ggeutzzang

Copy link
Copy Markdown
Author

Reverted the rework — the additive field was the safer of the two

My previous push replaced the optional childAccounts context field with a scanner-side
skip of the channel hook, on the reasoning that not touching the exported type would reduce
the compatibility surface. That reasoning was wrong, and ClawSweeper's review of that head
named exactly why:

The empty-allowlist context and Doctor adapter are re-exported through the plugin SDK;
the callback contract does not restrict calls to account scopes.

Not calling a public callback is a bigger change than adding a field to it. Concretely, for
an external channel plugin:

external plugin's experience
optional childAccounts added a new field appears; ignore it and behavior is identical
hook invocation skipped its own code is unchanged, yet its warning silently disappears

The first is additive, the second is breaking. My error was checking that Telegram is the
only in-repo implementation of collectEmptyAllowlistExtraWarnings and concluding the
call site was unobserved — but a hook exported through the plugin SDK cannot be surveyed
by grepping this repository.

So this head (6643ee2cebf) is back to the additive approach, rebased onto current main
and squashed to one commit. The PR body now states the additive guarantee explicitly:

The hook keeps being invoked on exactly the scopes it is invoked on today, and a channel
plugin that ignores childAccounts behaves exactly as before, so no existing plugin —
bundled or external — changes behavior without opting in.

Re-verified on this head: related suites 81 passed (core 40 / telegram 31 / catalog 10),
commands lane 319 files / 4116 passed. The real-CLI before/after and the per-layer revert
evidence in the PR body are unchanged, since the behavior of this revision is what they
were originally measured against.

The open question is unchanged and is still yours to decide: whether an optional,
parent-only child-account context is acceptable as plugin SDK surface. ClawSweeper's
earlier recommendation on this same approach was to accept it.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@ggeutzzang
ggeutzzang force-pushed the fix/telegram-doctor-parent-scope-false-positive branch from 6643ee2 to e0737f6 Compare August 16, 2026 19:54
@ggeutzzang

Copy link
Copy Markdown
Author

Fixed the P2 finding: external plugins now resolve too

The new catalog fallback only identifies bundled catalog entries. Doctor already
resolves configured external plugins through its read-only loader, but their account IDs
still return undefined here.

Correct, and it made the layer-1 repair half a fix: bundled channels resolved, configured
third-party channels kept returning undefined and kept the false positive.

resolveDoctorChannelAccountIds now falls back through both paths doctor already uses,
in the same order doctor uses them:

const plugin =
  (channelId ? (getChannelPlugin(channelId) ?? getBundledChannelPlugin(channelId)) : undefined) ??
  findReadOnlyChannelPlugin(cfg, channelName);

findReadOnlyChannelPlugin calls resolveReadOnlyChannelPluginsForConfig with the same
options channel-doctor.ts passes (includePersistedAuthState: false,
includeSetupFallbackPlugins: true) and matches on plugin id, so a configured external
channel is identified even when it is in neither the registry nor the bundled catalog. That
loader is internally cached, and a load failure still returns undefined so doctor stays
conservative.

Note the ordering detail: the external path is reached even when channelId itself is
unresolvable, which is the normal case for a third-party channel absent from both the
registry and the catalog.

Coverage added (channel-capabilities.test.ts, now 13 tests):

  • resolves account ids for a configured external plugin through the read-only loader
  • still returns undefined when no loader can identify the channel

Red/green on this finding — reverting only channel-capabilities.ts:

× resolves account ids for a configured external plugin through the read-only loader
AssertionError: expected undefined to deeply equal { configured: [ 'default' ], …(1) }

Commands lane on this head: 319 files, 4117 passed, 4 skipped. Type check clean for these
files.

The remaining items are the maintainer decision on the additive exported context, which I
cannot resolve from here.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

…t-time setup

Operators running Telegram with multiple accounts saw doctor report the
channel as unconfigured -- "Telegram is in first-time setup mode ... Group
messages stay blocked" -- while those bots replied in those groups normally.

Two layers caused it.

resolveDoctorChannelAccountIds resolved channels through the plugin
registry, which is empty during a doctor run because doctor inspects config
without starting channels. It therefore returned undefined for every
channel, pinning hasImplicitActiveAccount to true and leaving
suppressParentGroupAllowlistWarning (added in openclaw#93434 for this same class of
parent-scope false positive) permanently dead in production. Doctor was
already inconsistent with itself here: channel-doctor.ts finds adapters
through the config-driven read-only path, so the warning was produced, while
channel-capabilities.ts needed the registry, so the data that suppresses it
was missing. Account resolution now falls back the same way doctor already
does elsewhere: the bundled catalog for bundled channels, and the read-only
configured-plugin loader for external ones, so configured third-party
channels resolve too.

The parent container scope is also checked as if it were an account, and the
scanner's suppression signal never reached the channel-supplied
extraWarningsForAccount hook. The scope now carries its active child
accounts as an optional childAccounts field, and Telegram skips first-time
guidance only when every active account defines groups. childAccounts is
withheld when an implicit runtime account inherits the container scope, and
when no active accounts exist, so it is always non-empty when present.

The field is additive: existing channel plugins that ignore it keep their
current behavior, and the hook keeps being called on every scope it is
called on today.

Verified on the real CLI, not only tests: with neither layer the warning
appears, with layer 1 alone it still appears, with both it is gone.

Note the reach: because account resolution previously failed for every
channel, this makes parent-scope suppression live across all channels, not
just Telegram.

Prepared with AI assistance (Claude Code).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@ggeutzzang
ggeutzzang force-pushed the fix/telegram-doctor-parent-scope-false-positive branch from e0737f6 to 787507f Compare August 16, 2026 20:04
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Sep 19, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram commands Command implementations merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M stale Marked as stale due to inactivity status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doctor: configured multi-account Telegram reported as first-time setup

2 participants