feat(onboard): support Telegram mention-only mode - #2417
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds Telegram mention-only configuration: onboarding captures/persists Changes
Sequence DiagramsequenceDiagram
autonumber
participant Env as Environment (env/CLI)
participant Onboard as Onboard Service
participant Patcher as Dockerfile Patcher
participant Docker as Docker Build
participant BuildPy as Build-time Python
Env->>Onboard: TELEGRAM_REQUIRE_MENTION input
Onboard->>Onboard: derive telegramConfig.requireMention
Onboard->>Patcher: patchStagedDockerfile(..., telegramConfig)
Patcher->>Patcher: JSON -> base64 (NEMOCLAW_TELEGRAM_CONFIG_B64)
Patcher->>Docker: start image build (ARG/ENV passed)
Docker->>BuildPy: run inline Python with NEMOCLAW_TELEGRAM_CONFIG_B64
BuildPy->>BuildPy: base64-decode JSON
BuildPy->>BuildPy: set Telegram groupPolicy = "mentions" or "open"
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/onboard.ts`:
- Around line 3823-3832: The Telegram reply-mode flag (TELEGRAM_REQUIRE_MENTION)
is only read into telegramConfig during Dockerfile rebuilds, so changes are
ignored when a sandbox is reused; update the reuse/path logic to consider
TELEGRAM_REQUIRE_MENTION drift by persisting the effective Telegram config (from
telegramConfig) into the sandbox registry or session state and comparing it
during reuse checks, and if it differs from the incoming env value (or desired
groupPolicy), trigger the same rebuild/warning/force-recreate flow as the
Dockerfile change path; specifically, modify the reuse handling code that checks
enabledTokenEnvKeys and groupPolicy to load and compare the saved Telegram
config entry and enforce rebuild or surface a user-facing warning when
TELEGRAM_REQUIRE_MENTION semantics change.
In `@src/lib/sandbox-channels.ts`:
- Around line 35-37: Update the requireMentionHelp string (paired with
requireMentionEnvKey) so it no longer states that DMs are always answered;
clarify that this setting only controls group-chat behavior and note that direct
messages may still be restricted by pairing or TELEGRAM_ALLOWED_IDS (or other
access controls). Locate the requireMentionHelp constant in
src/lib/sandbox-channels.ts and replace the overpromising help text with a
concise description that explicitly limits the scope to group chats and mentions
the potential DM restrictions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 10d86093-2cf8-4419-a74a-884bc6567157
📒 Files selected for processing (4)
Dockerfilesrc/lib/onboard.tssrc/lib/sandbox-channels.tstest/onboard.test.ts
ac6731f to
871b21e
Compare
|
Addressed both CodeRabbit nits in Cheers! |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/onboard-session.test.ts`:
- Around line 166-173: The test currently calls session.saveSession which
normalizes telegramConfig, so to exercise rejection-on-load you must persist a
malformed session payload directly (or mock the session read) and then call
session.loadSession to assert it throws; specifically, create the session with
session.createSession(), construct a malformed telegramConfig (e.g.,
requireMention: "yes"), write that malformed JSON into the session persistence
backend for that session id (or stub the session file reader method such as the
internal read/load helper), and then call session.loadSession(sessionId)
expecting it to reject or throw instead of using session.saveSession which
sanitizes input.
In `@src/lib/onboard-session.ts`:
- Line 103: filterSafeUpdates currently omits SessionUpdates.telegramConfig so
calls to markStepComplete() / completeSession() drop telegramConfig silently;
update filterSafeUpdates to preserve and copy the telegramConfig field when
present (and ensure its type matches TelegramConfig | null) so that
markStepComplete() and completeSession() propagate telegramConfig through safe
update paths instead of discarding it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: aa408aed-835a-4dbc-a9e6-f19c6629a940
📒 Files selected for processing (6)
Dockerfilesrc/lib/onboard-session.test.tssrc/lib/onboard-session.tssrc/lib/onboard.tssrc/lib/sandbox-channels.tstest/onboard.test.ts
✅ Files skipped from review due to trivial changes (2)
- src/lib/sandbox-channels.ts
- test/onboard.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/lib/onboard.ts
871b21e to
7ae976f
Compare
|
Addressed both follow-up CodeRabbit nits in |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/lib/onboard.ts (1)
3835-3859:⚠️ Potential issue | 🟠 MajorTelegram mention-mode drift is still missed in reuse flows.
This session write only helps
--resume; a normalnemoclaw onboardrun creates a fresh session beforecreateSandbox()decides whether to reuse, so an existing ready sandbox can still be reused with the old TelegramgroupPolicy. And even on resume,telegramConfigChangedmissestrue -> unset, although the Dockerfile generator would switch that back toopen. Please persist the effective Telegram mode somewhere the general reuse path can read it, and compare effective runtime policy (Boolean(requireMention)) rather than only non-null mismatches.Also applies to: 6900-6934
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/onboard.ts` around lines 3835 - 3859, The effective Telegram mention-mode (computed via computeTelegramRequireMention and stored in telegramConfig) is not persisted where the general sandbox reuse path (createSandbox and the reuse decision) can read it, and the comparison logic only checks non-null mismatches so it misses true->unset transitions; persist the resolved Boolean(requireMention) into a shared place used by reuse (e.g., set onboardSession.telegramConfigEffective or the sandbox metadata that createSandbox reads) whenever computeTelegramRequireMention runs, and update the reuse/comparison logic (telegramConfigChanged or reuse decision) to compare the effective runtime policy via Boolean(requireMention) rather than null/non-null so both true->false and true->unset are detected and force sandbox recreate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/lib/onboard.ts`:
- Around line 3835-3859: The effective Telegram mention-mode (computed via
computeTelegramRequireMention and stored in telegramConfig) is not persisted
where the general sandbox reuse path (createSandbox and the reuse decision) can
read it, and the comparison logic only checks non-null mismatches so it misses
true->unset transitions; persist the resolved Boolean(requireMention) into a
shared place used by reuse (e.g., set onboardSession.telegramConfigEffective or
the sandbox metadata that createSandbox reads) whenever
computeTelegramRequireMention runs, and update the reuse/comparison logic
(telegramConfigChanged or reuse decision) to compare the effective runtime
policy via Boolean(requireMention) rather than null/non-null so both true->false
and true->unset are detected and force sandbox recreate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 27fe17de-3553-4607-b44b-9f1af9687a29
📒 Files selected for processing (6)
Dockerfilesrc/lib/onboard-session.test.tssrc/lib/onboard-session.tssrc/lib/onboard.tssrc/lib/sandbox-channels.tstest/onboard.test.ts
✅ Files skipped from review due to trivial changes (3)
- src/lib/sandbox-channels.ts
- test/onboard.test.ts
- src/lib/onboard-session.test.ts
7ae976f to
06b8f83
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/lib/onboard.ts (1)
4039-4052:⚠️ Potential issue | 🟠 MajorPersist Telegram reply mode in sandbox metadata, not just the resume session.
Lines 4044-4051 only write this into
onboardSession. A freshnemoclaw onboardcreates a new session beforecreateSandbox()reaches its normal reuse branch, and that branch still does not compare any recorded Telegram mode, so changingTELEGRAM_REQUIRE_MENTIONon an existing ready sandbox can still be ignored unless the user forces recreation. Please store the effective Telegram group policy with the sandbox’s persisted metadata and check it during the regular reuse flow, not only during--resume.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/onboard.ts` around lines 4039 - 4052, The code only writes telegramConfig.requireMention into onboardSession via onboardSession.updateSession, but you must also persist the effective Telegram group policy into the sandbox's persisted metadata so the normal createSandbox reuse branch will detect drift; update the logic that writes current.telegramConfig (where telegramConfig.requireMention is checked) to also write the same value into the sandbox metadata object saved/updated during sandbox creation/update (the code paths involved around createSandbox and the sandbox reuse branch), and ensure the reuse flow compares the persisted sandbox metadata's Telegram policy against the current TELEGRAM_REQUIRE_MENTION to trigger sandbox recreation when they differ.
🧹 Nitpick comments (1)
src/lib/onboard-session.ts (1)
604-608: Prefer reusingparseTelegramConfighere to avoid validation drift.
filterSafeUpdatescurrently duplicates telegram parsing logic. Reusing the helper keeps one source of truth.♻️ Proposed refactor
- if (isObject(updates.telegramConfig) && typeof updates.telegramConfig.requireMention === "boolean") { - safe.telegramConfig = { requireMention: updates.telegramConfig.requireMention }; - } else if (updates.telegramConfig === null) { + const parsedTelegram = parseTelegramConfig(updates.telegramConfig); + if (parsedTelegram) { + safe.telegramConfig = parsedTelegram; + } else if (updates.telegramConfig === null) { safe.telegramConfig = null; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/onboard-session.ts` around lines 604 - 608, In filterSafeUpdates, replace the inline telegram parsing with a call to the existing parseTelegramConfig helper to avoid validation drift: when updates.telegramConfig is provided, set safe.telegramConfig to null if updates.telegramConfig === null, otherwise pass updates.telegramConfig into parseTelegramConfig(...) and assign its result; ensure you only call parseTelegramConfig when updates.telegramConfig is not undefined so behavior for omitted fields remains unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/lib/onboard.ts`:
- Around line 4039-4052: The code only writes telegramConfig.requireMention into
onboardSession via onboardSession.updateSession, but you must also persist the
effective Telegram group policy into the sandbox's persisted metadata so the
normal createSandbox reuse branch will detect drift; update the logic that
writes current.telegramConfig (where telegramConfig.requireMention is checked)
to also write the same value into the sandbox metadata object saved/updated
during sandbox creation/update (the code paths involved around createSandbox and
the sandbox reuse branch), and ensure the reuse flow compares the persisted
sandbox metadata's Telegram policy against the current TELEGRAM_REQUIRE_MENTION
to trigger sandbox recreation when they differ.
---
Nitpick comments:
In `@src/lib/onboard-session.ts`:
- Around line 604-608: In filterSafeUpdates, replace the inline telegram parsing
with a call to the existing parseTelegramConfig helper to avoid validation
drift: when updates.telegramConfig is provided, set safe.telegramConfig to null
if updates.telegramConfig === null, otherwise pass updates.telegramConfig into
parseTelegramConfig(...) and assign its result; ensure you only call
parseTelegramConfig when updates.telegramConfig is not undefined so behavior for
omitted fields remains unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: c5b456eb-b531-46c3-80b9-b22a33d1d2e9
📒 Files selected for processing (6)
Dockerfilesrc/lib/onboard-session.test.tssrc/lib/onboard-session.tssrc/lib/onboard.tssrc/lib/sandbox-channels.tstest/onboard.test.ts
✅ Files skipped from review due to trivial changes (1)
- src/lib/sandbox-channels.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/lib/onboard-session.test.ts
- Dockerfile
- test/onboard.test.ts
06b8f83 to
b0d2e74
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/lib/onboard.ts (1)
7604-7614:⚠️ Potential issue | 🟠 MajorCompare the effective Telegram mode, not just non-null booleans.
This only flags drift when both sides are non-null. A sandbox previously built with Telegram's default-open behavior (
recordedTelegramRequireMention === null) will still be reused unchanged when the user later setsTELEGRAM_REQUIRE_MENTION=1, and the reverse transition back to default-open is ignored too. That leavesgroupPolicystale after resume.Proposed fix
- const currentTelegramRequireMention = computeTelegramRequireMention(); - const recordedTelegramRequireMention = session?.telegramConfig?.requireMention ?? null; - const telegramConfigChanged = - currentTelegramRequireMention !== null && - recordedTelegramRequireMention !== null && - currentTelegramRequireMention !== recordedTelegramRequireMention; + const currentTelegramRequireMention = computeTelegramRequireMention(); + const recordedTelegramRequireMention = session?.telegramConfig?.requireMention ?? null; + const telegramEnabledPreviously = session?.messagingChannels?.includes("telegram") === true; + const effectiveCurrentTelegramRequireMention = telegramEnabledPreviously + ? (currentTelegramRequireMention ?? false) + : currentTelegramRequireMention; + const effectiveRecordedTelegramRequireMention = telegramEnabledPreviously + ? (recordedTelegramRequireMention ?? false) + : recordedTelegramRequireMention; + const telegramConfigChanged = + effectiveCurrentTelegramRequireMention !== effectiveRecordedTelegramRequireMention;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/onboard.ts` around lines 7604 - 7614, The code only treats a change as drift when both currentTelegramRequireMention and recordedTelegramRequireMention are non-null, which misses transitions involving the default/open mode (null). Update the logic around computeTelegramRequireMention, recordedTelegramRequireMention and telegramConfigChanged to compare the effective Telegram mode by normalizing nulls to the same default value (use the same default semantics as TELEGRAM_REQUIRE_MENTION/open mode) before comparing; i.e., derive effectiveCurrent = computeTelegramRequireMention() ?? DEFAULT and effectiveRecorded = session?.telegramConfig?.requireMention ?? DEFAULT and then set telegramConfigChanged = effectiveCurrent !== effectiveRecorded so both transitions to/from default are detected (this will keep groupPolicy in sync on resume).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/onboard.ts`:
- Around line 332-336: The function computeTelegramRequireMention currently
returns null for any value other than "0" or "1", silently treating typos as
unset; update computeTelegramRequireMention to explicitly validate
process.env.TELEGRAM_REQUIRE_MENTION: return true for "1", false for "0", return
null only if the env var is undefined or empty, and throw a clear Error (or
raise a validation exception) if the value is present but not "0" or "1" so
invalid configs like "true" are rejected during startup.
---
Duplicate comments:
In `@src/lib/onboard.ts`:
- Around line 7604-7614: The code only treats a change as drift when both
currentTelegramRequireMention and recordedTelegramRequireMention are non-null,
which misses transitions involving the default/open mode (null). Update the
logic around computeTelegramRequireMention, recordedTelegramRequireMention and
telegramConfigChanged to compare the effective Telegram mode by normalizing
nulls to the same default value (use the same default semantics as
TELEGRAM_REQUIRE_MENTION/open mode) before comparing; i.e., derive
effectiveCurrent = computeTelegramRequireMention() ?? DEFAULT and
effectiveRecorded = session?.telegramConfig?.requireMention ?? DEFAULT and then
set telegramConfigChanged = effectiveCurrent !== effectiveRecorded so both
transitions to/from default are detected (this will keep groupPolicy in sync on
resume).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 36fa6f6b-294a-425c-82b1-4a2e73bc962e
📒 Files selected for processing (6)
Dockerfilesrc/lib/onboard-session.test.tssrc/lib/onboard-session.tssrc/lib/onboard.tssrc/lib/sandbox-channels.tstest/onboard.test.ts
✅ Files skipped from review due to trivial changes (3)
- src/lib/sandbox-channels.ts
- test/onboard.test.ts
- src/lib/onboard-session.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/lib/onboard-session.test.ts
- Dockerfile
| function computeTelegramRequireMention(): boolean | null { | ||
| const raw = process.env.TELEGRAM_REQUIRE_MENTION; | ||
| if (raw === "1") return true; | ||
| if (raw === "0") return false; | ||
| return null; |
There was a problem hiding this comment.
Reject invalid TELEGRAM_REQUIRE_MENTION values instead of silently treating them as unset.
Any value other than "0" or "1" falls through to null, and the rest of the flow interprets that as default-open behavior. In non-interactive onboarding, a typo like TELEGRAM_REQUIRE_MENTION=true will quietly disable mention-only mode and make the bot reply to every group message.
Proposed fix
function computeTelegramRequireMention(): boolean | null {
const raw = process.env.TELEGRAM_REQUIRE_MENTION;
+ if (raw === undefined || raw === "") return null;
if (raw === "1") return true;
if (raw === "0") return false;
- return null;
+ console.error(" TELEGRAM_REQUIRE_MENTION must be set to 0 or 1.");
+ process.exit(1);
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/lib/onboard.ts` around lines 332 - 336, The function
computeTelegramRequireMention currently returns null for any value other than
"0" or "1", silently treating typos as unset; update
computeTelegramRequireMention to explicitly validate
process.env.TELEGRAM_REQUIRE_MENTION: return true for "1", false for "0", return
null only if the env var is undefined or empty, and throw a clear Error (or
raise a validation exception) if the value is present but not "0" or "1" so
invalid configs like "true" are rejected during startup.
|
✨ Thanks for submitting this pull request that proposes a way to add support for Telegram mention-only mode, providing parity with Discord's existing requireMention toggle. Related open issues: |
1 similar comment
|
✨ Thanks for submitting this pull request that proposes a way to add support for Telegram mention-only mode, providing parity with Discord's existing requireMention toggle. Related open issues: |
b0d2e74 to
9aa3c3c
Compare
…rift The drift check at the resume gate was guarded on recordedTelegramRequireMention !== null && currentTelegramRequireMention !== null, which only flagged a mismatch when both sides were boolean. Two real sequences fell through: - Sandbox built before TELEGRAM_REQUIRE_MENTION existed (recordedTelegramRequireMention === null), then user sets TELEGRAM_REQUIRE_MENTION=1. Drift unflagged → sandbox reused with baked-in groupPolicy: open even though user asked for mentions. - Sandbox built with TELEGRAM_REQUIRE_MENTION=1 (recorded true), then user unsets the env var. Drift unflagged → sandbox reused with baked-in groupPolicy: mentions even though user expects default-open. Collapse null and false to the same effective mode (default-open) before comparing, so any change to the user-visible behavior triggers a recreate. Mirrors the underlying rule in the openclaw.json generator: empty config → groupPolicy: open. Closes the CodeRabbit review item on NVIDIA#2417. Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
NemoClaw already offers Discord's `requireMention` toggle (reply only
when @mentioned vs to all messages in a guild), but Telegram's group
behavior is effectively fixed to `groupPolicy: open` — the bot replies
to every message in every group it joins. Teams running the bot in
busy Telegram groups have no way to restrict it to mentions without
hand-patching `openclaw.json` after build.
Parity with Discord's `requireMention`, scoped to Telegram:
- **`src/lib/sandbox-channels.ts`** — add `requireMentionEnvKey:
"TELEGRAM_REQUIRE_MENTION"` plus a help string to the telegram
`ChannelDef`. The help text explicitly scopes the setting to group
chats and notes DMs stay subject to pairing / TELEGRAM_ALLOWED_IDS.
- **`src/lib/onboard.ts`** — loosen the interactive mention-prompt
gate: the prompt used to require both a `requireMentionEnvKey` AND
a configured `serverIdEnvKey` (Discord-specific). Telegram has no
server ID, so the prompt never fired. Now it fires for any channel
with `requireMentionEnvKey` whose `serverIdEnvKey` (if present) is
populated — Telegram's prompt always fires, Discord's still gates
on a configured server ID.
- **`src/lib/onboard.ts`** — new `computeTelegramRequireMention()`
helper reads `TELEGRAM_REQUIRE_MENTION` (set either by the
interactive prompt above or by a non-interactive env export) and
maps it to `true | false | null`. Used both at build time to bake
the `telegramConfig` into the Dockerfile and at resume time to
detect drift.
- **`src/lib/onboard-session.ts`** — add `TelegramConfig` type +
`telegramConfig: TelegramConfig | null` field on `Session` with a
`parseTelegramConfig()` that rejects non-boolean values. Persisted
in both `createSession` and `normalizeSession`.
- **`src/lib/onboard.ts`** — on every build, write the effective
`telegramConfig` into session state via `onboardSession.updateSession`.
- **`src/lib/onboard.ts`** — reuse path computes
`telegramConfigChanged` (current env vs recorded session) alongside
`webSearchConfigChanged`. Drift triggers a `[resume] TELEGRAM_REQUIRE_MENTION
changed; recreating sandbox.` note and forces a fresh build so the
new `groupPolicy` actually takes effect — otherwise the config
stays baked at the old value.
- **`Dockerfile`** — add `ARG NEMOCLAW_TELEGRAM_CONFIG_B64=e30=`,
promote to ENV, and read it in the existing python3 openclaw.json
generator. When `requireMention` is truthy, telegram's
`groupPolicy` is set to `mentions`; otherwise `open` (existing
default, preserved for backward compatibility).
Interactive: when a user enables Telegram in step [5/8] of onboard,
the wizard now asks "Reply only when @mentioned? [Y/n]" after the
token prompt.
Non-interactive:
TELEGRAM_REQUIRE_MENTION=1 nemoclaw onboard --non-interactive
# or
TELEGRAM_REQUIRE_MENTION=0 nemoclaw onboard --non-interactive
Unset env var + non-interactive = same as before (open groups). No
behavior change for existing sandboxes or scripted onboards that
don't set the new variable.
If a user re-runs onboard against an existing sandbox with a
different TELEGRAM_REQUIRE_MENTION value, the resume path now
detects the drift and recreates the sandbox so the new group policy
actually takes effect — instead of silently keeping the stale value
baked into the old image.
- `npx vitest run test/onboard.test.ts` — 3 new end-to-end tests
exercising `patchStagedDockerfile` with mention-only, open-group,
and empty telegramConfig.
- `npx vitest run src/lib/onboard-session.test.ts` — 4 new tests
covering telegramConfig save/load roundtrips (both boolean
values), malformed input rejection, and null default on fresh
sessions.
- Full onboard + onboard-selection + sandbox-channels suite: 208
tests pass, no regressions.
- Typecheck clean.
Closed PR NVIDIA#1784 by @kagura-agent proposed the same interactive +
env-var approach and was thanked by @wscurran with CodeRabbit review
addressed before the author voluntarily closed to reduce PR volume.
This PR takes the same shape plus the drift-detection path that
CodeRabbit flagged on the resume case (sandbox reuse would
otherwise ignore changes to TELEGRAM_REQUIRE_MENTION until the user
forced a rebuild).
Discord's `requireMention` has the same pre-existing limitation on
the reuse path — changing DISCORD_REQUIRE_MENTION against a reused
sandbox keeps the old value. That's out of scope for this PR; a
follow-up would apply the same session-state-tracked drift pattern
to discordGuilds.
Fixes NVIDIA#1737.
Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
…rift The drift check at the resume gate was guarded on recordedTelegramRequireMention !== null && currentTelegramRequireMention !== null, which only flagged a mismatch when both sides were boolean. Two real sequences fell through: - Sandbox built before TELEGRAM_REQUIRE_MENTION existed (recordedTelegramRequireMention === null), then user sets TELEGRAM_REQUIRE_MENTION=1. Drift unflagged → sandbox reused with baked-in groupPolicy: open even though user asked for mentions. - Sandbox built with TELEGRAM_REQUIRE_MENTION=1 (recorded true), then user unsets the env var. Drift unflagged → sandbox reused with baked-in groupPolicy: mentions even though user expects default-open. Collapse null and false to the same effective mode (default-open) before comparing, so any change to the user-visible behavior triggers a recreate. Mirrors the underlying rule in the openclaw.json generator: empty config → groupPolicy: open. Closes the CodeRabbit review item on NVIDIA#2417. Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
60ab29a to
8be1cd3
Compare
|
Rebased onto current upstream/main ( |
|
verified end-to-end: • python generator (the layer not covered by PR tests) — ran build_config() • upstream layers — author's tests cover persistence (7 cases on ready to merge. |
## Summary Daily release-prep documentation refresh for merged PRs from the past 24 hours. This updates user-facing docs for Telegram mention-only mode, in-sandbox messaging shutdown, Hermes onboarding/runtime behavior, and compatible-endpoint smoke validation, then bumps the docs metadata to 0.0.33 after tag v0.0.32. ## Related Issue None. ## Changes - #2417 / c7e49ad: Document `TELEGRAM_REQUIRE_MENTION` for Telegram group-chat replies in `docs/manage-sandboxes/messaging-channels.md` and `docs/reference/commands.md`. - #1977 / 69403e0: Update `nemoclaw tunnel stop` and deprecated `nemoclaw stop` docs to explain that NemoClaw also attempts to stop the in-sandbox OpenClaw gateway and messaging polling. - #2781 / b83ffe2, #2859 / 4df8be6, and #2846 / 0968dfd: Refresh the Hermes quickstart for the default `my-hermes` sandbox name, cross-agent same-name guard, agent type visibility in `nemoclaw list`, Brave prompt omission, and supported prebaked Hermes integrations. - #2849 / fd240ff: Document the Telegram plus OpenAI-compatible endpoint `inference.local` smoke check in inference options and troubleshooting. - Bump `docs/versions1.json` and `docs/project.json` from 0.0.32 to 0.0.33 for daily release preparation. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [x] Doc only (includes code sample changes) ## Verification - [ ] `npx prek run --all-files` passes - [ ] `npm test` passes - [ ] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed - [x] Docs updated for user-facing behavior changes - [x] `make docs` builds without warnings (doc changes only) - [x] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) Additional checks run: - `python3 scripts/docs-to-skills.py docs/ .agents/skills/ --prefix nemoclaw-user --dry-run` - `git diff --check` - `make docs` passed with the existing local version-switcher read message. - Full `npx prek run --all-files` and `npm test` were skipped for this doc-only automation run. Commit and pre-push hooks otherwise passed docs, lint, secret, and conversion checks until the local `Test (skills YAML)` hook failed because `vitest/config` is not installed in this fresh worktree. --- Signed-off-by: Miyoung Choi <miyoungc@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated Hermes quickstart: default sandbox name is "hermes"; guidance to use distinct sandbox names, note same-name reuse is prevented, Hermes wizard does not request Brave Web Search, and sandbox listings now show agent type. * Clarified provider onboarding: bounded in-sandbox smoke check runs when Telegram messaging is enabled. * Expanded Telegram docs: added TELEGRAM_REQUIRE_MENTION (DMs still governed by TELEGRAM_ALLOWED_IDS), onboarding examples, stop-messaging/tunnel behavior, and troubleshooting. * Promoted docs to version 0.0.33. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Miyoung Choi <miyoungc@nvidia.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…licy enum The config generator emitted groupPolicy: "mentions" when TELEGRAM_REQUIRE_MENTION=1, but the OpenClaw gateway schema only accepts "open", "disabled", or "allowlist" — crashing the gateway on startup (introduced by NVIDIA#2417). The correct approach per OpenClaw docs is to keep groupPolicy: "open" (groups remain accessible) and set per-group mention-gating via groups: { "*": { requireMention: true } }. The previous "mentions" value conflated two independent controls. Fixes NVIDIA#3022 Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Summary
Parity with Discord's existing
requireMentiontoggle, scoped to Telegram. Teams running the bot in busy Telegram groups can now restrict it to reply only when @mentioned instead of to every group message.Problem
Telegram's group behavior in NemoClaw is hardcoded to
groupPolicy: open— the bot answers every message the moment it joins a group. Users have no CLI flag, env var, or onboard prompt to narrow this; the only workaround is hand-patchingopenclaw.jsonafter build.Discord already has the equivalent via
requireMention.Changes
src/lib/sandbox-channels.ts— addrequireMentionEnvKey: \"TELEGRAM_REQUIRE_MENTION\"+ help string to the TelegramChannelDef.src/lib/onboard.ts— loosen the interactive mention-prompt gate: the prompt used to require bothrequireMentionEnvKeyAND a populatedserverIdEnvKey(Discord-specific). Now any channel withrequireMentionEnvKeyfires the prompt, with the Discord-specific server-ID check preserved. Also build atelegramConfigfromTELEGRAM_REQUIRE_MENTIONand pass it throughpatchStagedDockerfile.Dockerfile— addARG NEMOCLAW_TELEGRAM_CONFIG_B64=e30=, promote to ENV, and wire into the Python openclaw.json generator: ``groupPolicy`` becomes ``mentions`` when ``requireMention`` is truthy, otherwise ``open`` (existing default preserved).Usage
Interactive:
Non-interactive:
Unset env + non-interactive = same as before (open groups). No behavior change for existing scripted onboards.
Test plan
npx vitest run test/onboard.test.ts src/lib/sandbox-channels.test.ts test/onboard-selection.test.ts— 179 tests pass including 3 new ones:Prior art
Closed PR #1784 by @kagura-agent proposed the same approach and was thanked by @wscurran with CodeRabbit review addressed before the author voluntarily closed "to reduce PR volume." This PR takes the same shape with a refreshed test layout and an explicit backward-compat regression test.
Fixes #1737.
Signed-off-by: latenighthackathon latenighthackathon@users.noreply.github.com
Summary by CodeRabbit
New Features
Tests