fix(onboard): register discord plugin entry when Discord channel is configured (#4246)#4277
Conversation
…onfigured (#4246) The Discord branch of `nemoclaw onboard` writes channels.discord and installs the @openclaw/discord npm package but never registers plugins.entries.discord, so OpenClaw never loads the bridge at boot and the configured bot stays offline. Mirror the openclaw-weixin enablement pattern in scripts/generate-openclaw-config.py — when discord is among the active messaging channels, write plugins.entries.discord = {enabled: true} so the installed plugin is wired up alongside its channel config. Signed-off-by: Shawn Xie <shaxie@nvidia.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughA TypeScript OpenClaw config generator replaces the Python generator in builds; build_config() now enables ChangesOpenClaw config generator and Discord registration
Sequence Diagram(s)sequenceDiagram
participant DockerBuild
participant Generator as generate-openclaw-config.mts
participant Registry as manifest_registry
participant build_config
participant plugin_entries
participant FS as openclaw.json
participant WechatSeed as seed-wechat-accounts.py
DockerBuild->>Generator: run generator during image build
Generator->>Registry: discover/load model manifests
Generator->>build_config: compute providers, channels, _ch_cfg
build_config->>plugin_entries: if "discord" in _ch_cfg -> set plugins.entries.discord = {enabled: true}
Generator->>FS: write openclaw.json (0600)
Generator->>WechatSeed: spawn python3 seed-wechat-accounts.py if preinstalled signal
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 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 docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
E2E Scenario Advisor RecommendationRequired scenario E2E: Dispatch required scenario E2E:
Full scenario advisor summaryE2E Scenario AdvisorBase: Required scenario E2E
Optional scenario E2E
Relevant changed files
|
PR Review AdvisorFindings: 0 needs attention, 1 worth checking, 0 nice ideas Review findings🛠️ Needs attention
🔎 Worth checking
🌱 Nice ideas
Since last review detailsCurrent findings:
This is an automated advisory review. A human maintainer must make the final merge decision. |
|
✨ Thanks for submitting this detailed PR that fixes the Discord plugin registration issue. This proposes a fix for the issue where the Discord branch of Related open issues: |
…dget Compact the discord plugins.entries enablement added in this PR into a single inline statement so net Python additions are ≤0 under the generalized code growth guardrails (#4318). Behavior is unchanged; the existing test/generate-openclaw-config.test.ts coverage still asserts the discord plugin entry is registered when channels.discord is set. Signed-off-by: Shawn Xie <shaxie@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/generate-openclaw-config.py`:
- Line 735: The inline single-line conditional at line with _ch_cfg and
plugin_entries (if "discord" in _ch_cfg: plugin_entries["discord"] = {"enabled":
True}) must be split into a standard multi-line if block to satisfy Ruff E701;
replace it with an if "discord" in _ch_cfg: on its own line followed by an
indented statement that sets plugin_entries["discord"] = {"enabled": True} so
the check and assignment are on separate lines.
🪄 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: 7a0578d9-b4a8-42a2-bf83-074c904c846e
📒 Files selected for processing (1)
scripts/generate-openclaw-config.py
Address CodeRabbit Ruff E701 finding on PR #4277. The inline `if ...: ...` was originally introduced to fit a transient repo-wide Python growth budget that was removed in 0c108ae ("ci: stop blocking Python code growth"), so the two-line form is now strictly an improvement. No behavior change; `test/generate-openclaw-config.test.ts` still asserts the discord plugin entry is registered. Signed-off-by: Shawn Xie <shaxie@nvidia.com>
…4571) ## Summary Migrates `scripts/generate-openclaw-config.py` to a TypeScript entrypoint that runs with Node's experimental type stripping, keeping the generator in line with the rest of the project. Updates Docker/build-context wiring, preserves migration parity called out by review feedback, and adds focused regression tests for the new entrypoint. ## Related Issue Stacked on #4277. ## Changes - Replace the Python OpenClaw config generator with `scripts/generate-openclaw-config.ts`. - Run the generator via `node --experimental-strip-types` in the sandbox Docker build and staged build context. - Use the WHATWG `URL` parser for `CHAT_UI_URL` security decisions, including userinfo/ambiguous-host cases. - Preserve previous channel config shape by keeping channel-level `enabled` out of token and WhatsApp channel blocks. - Restore the npm-package `openclaw.plugin.json` WeChat metadata probe and add coverage for that layout. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Verification Targeted checks run: - `npx vitest run --project cli test/generate-openclaw-config.test.ts test/seed-wechat-accounts.test.ts test/security-c2-dockerfile-injection.test.ts test/sandbox-provisioning.test.ts test/sandbox-build-context.test.ts` - passed, 151 tests. - `npx tsc --noEmit --target ES2022 --module preserve --moduleResolution bundler --lib ES2022 --types node --strict --allowImportingTsExtensions scripts/generate-openclaw-config.ts` - passed. - `npx @biomejs/biome lint scripts/generate-openclaw-config.ts test/generate-openclaw-config.test.ts` - passed. - `git diff --check` - passed. Known broader-check status: - `npx prek run --all-files` did not start because the hook runner hit `self-signed certificate in certificate chain` while fetching a release. - `npm test` currently fails on existing/base issues unrelated to this migration, including missing plugin dist for SSRF parity and status/rebuild/deploy failures. - `npm run typecheck:cli` currently fails in existing `src/lib/deploy/index.test.ts` type errors unrelated to this generator. - [ ] `npx prek run --all-files` passes - [ ] `npm test` passes - [x] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed - [ ] Docs updated for user-facing behavior changes - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] 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) --- Signed-off-by: Carlos Villela <cvillela@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Migrated build-time configuration generation from Python to TypeScript for improved codebase consistency. * **Tests** * Updated test suite to validate the TypeScript configuration generator with expanded coverage for environment variable validation, schema constraints, and security scenarios. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/4571?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…try-4246 Signed-off-by: Carlos Villela <cvillela@nvidia.com> # Conflicts: # Dockerfile # scripts/generate-openclaw-config.py # test/generate-openclaw-config.test.ts # test/sandbox-build-context.test.ts # test/sandbox-provisioning.test.ts
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
Addressed the PR Review Advisor feedback from issuecomment-4550111584 in 0581f66. Changes:
Validation:
|
Summary
nemoclaw onboardwriteschannels.discordand installs the@openclaw/discordnpm package, but never registersplugins.entries.discord, so OpenClaw never loads the bridge at boot and the bot stays offline even with valid credentials configured.scripts/generate-openclaw-config.pynow setsplugins.entries.discord = {enabled: true}wheneverdiscordis in the active messaging channel set, mirroring how Dockerfile.base pairs the WeChat plugin install withopenclaw config set plugins.entries.openclaw-weixin.enabled true.test/generate-openclaw-config.test.tslock the contract: the entry appears when the channel is on, and is absent when it is off.Test plan
npx vitest run --project cli test/generate-openclaw-config.test.ts— 87/87 pass locally--freshDiscord onboard run, confirm~/.openclaw/openclaw.jsonnow containsplugins.entries.discord.enabled = trueand the bot replies to an@mentionin the configured serverSigned-off-by: Shawn Xie shaxie@nvidia.com
Summary by CodeRabbit
New Features
Tests
Build