NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[All Platforms][Messaging] channels add telegram turns a mistyped TELEGRAM_GROUP_POLICY into open

Open PicoNVIDIA opened this issue 2 months ago • 0 comments

Description

nemoclaw <sandbox> channels add telegram doesn't validate TELEGRAM_GROUP_POLICY or TELEGRAM_REQUIRE_MENTION. An unrecognized value is replaced with the manifest default, so a typo of disabled ends up as groupPolicy: "open".

Onboard has rejected bad values here since #5696. That check, detectInvalidMessagingChannelConfigEnvValues() in src/lib/messaging-channel-config.ts, has one caller: src/lib/onboard/messaging-channel-setup.ts. The channels add path in src/lib/actions/sandbox/policy-channel.ts never calls it, and normalizeInputValue() in src/lib/messaging/compiler/manifest-compiler.ts swaps an out-of-range value for the default.

docs/manage-sandboxes/set-up-telegram.mdx says "Export the settings before onboarding or channels add telegram", so users will reasonably expect both paths to treat the values the same way.

Reproduction Steps

  1. In an isolated HOME, register an OpenClaw sandbox named mysb and put stub openshell and docker binaries on PATH.
  2. Run: NEMOCLAW_NON_INTERACTIVE=1 TELEGRAM_BOT_TOKEN=123456:fake TELEGRAM_GROUP_POLICY=disabeld TELEGRAM_REQUIRE_MENTION=1 NEMOCLAW_SKIP_TELEGRAM_REACHABILITY=1 nemoclaw mysb channels add telegram
  3. Run it again with TELEGRAM_GROUP_POLICY=disabled.

I expected the first run to stop with Invalid TELEGRAM_GROUP_POLICY value 'disabeld' (expected one of: open, allowlist, disabled), which is what onboard prints.

Environment

  • macOS 26.5.2 (arm64), Node.js v22.22.3
  • NemoClaw main at 4c44f7cc8; the files involved are unchanged on d61268122
  • Real CLI (node bin/nemoclaw.js) with stubbed OpenShell. With no live gateway, I checked what would be written by building the same plan through MessagingWorkflowPlanner.buildChannelAddPlanFromSandboxEntry().

Debug Output

$ TELEGRAM_GROUP_POLICY=disabeld ... nemoclaw mysb channels add telegram
  ✓ telegram Telegram group policy defaulted: open

$ TELEGRAM_GROUP_POLICY=disabled ... nemoclaw mysb channels add telegram
  ✓ telegram — Telegram group policy already set: disabled

Plan built from the same environment:
  disabeld -> plan value "open",     rendered openclaw.json "groupPolicy":"open"
  disabled -> plan value "disabled", rendered openclaw.json "groupPolicy":"disabled"

TELEGRAM_REQUIRE_MENTION=yes falls back the same way and prints ✓ telegram reply mode defaulted: @mentions only.

Logs

If you meant to turn group chats off and mistyped the value, the bot answers in any group, and the only hint is a green check mark saying the policy defaulted to open.

Running the same validation at the start of channels add, before planning or any sandbox change, would fix it. A CLI test with something like TELEGRAM_GROUP_POLICY=lockdown would keep it from coming back.

Checklist

  • [x] I confirmed this bug is reproducible
  • [x] I searched existing issues and this is not a duplicate

PicoNVIDIA avatar Sep 28 '26 21:09 PicoNVIDIA