Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,14 @@ ENV NPM_CONFIG_OFFLINE=true \
NPM_CONFIG_FUND=false

# Install NemoClaw plugin into OpenClaw (local /opt/nemoclaw, no network).
# Re-apply WeChat account seeding after OpenClaw doctor/plugin-install touches
# openclaw.json; the seed script no-ops unless WeChat is actively configured.
# Prune non-runtime metadata from staged bundled plugin dependencies before
# this layer is committed; deleting it in a later layer would not reduce the
# OCI image imported by k3s.
# hadolint ignore=DL3059,DL4006
RUN (openclaw plugins install /opt/nemoclaw > /dev/null 2>&1 || true) \
&& python3 /usr/local/lib/nemoclaw/seed-wechat-accounts.py \
&& if [ -d /sandbox/.openclaw/plugin-runtime-deps ]; then \
find /sandbox/.openclaw/plugin-runtime-deps -type f \( \
-name '*.d.ts' -o -name '*.d.mts' -o -name '*.d.cts' -o \
Expand Down
34 changes: 34 additions & 0 deletions test/seed-wechat-accounts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,40 @@ describe("seed-wechat-accounts.py: openclaw.json patching (channels.openclaw-wei
expect(cfg.channels["openclaw-weixin"].accounts.primary.enabled).toBe(true);
});

it("restores the channel block after a later OpenClaw config rewrite drops it", () => {
// The Dockerfile invokes this seed script again after OpenClaw doctor and
// plugin installation because those commands can rewrite openclaw.json
// after generate-openclaw-config.py first runs. Re-running the seed must
// be enough to put the upstream WeChat channel registration back.
writeOpenclawConfig({
channels: {
telegram: { accounts: { default: { enabled: true } } },
slack: { accounts: { default: { enabled: true } } },
},
plugins: {
installs: {
"openclaw-weixin": {
type: "npm",
spec: "@tencent-weixin/openclaw-weixin@2.4.2",
},
},
},
});

const result = runSeed({
NEMOCLAW_WECHAT_CONFIG_B64: configB64({
accountId: "primary",
baseUrl: "https://ilinkai.wechat.com",
userId: "wxid-42",
}),
});
expect(result.status).toBe(0);

const cfg = readJson(path.join(tmpDir, ".openclaw", "openclaw.json"));
expect(Object.keys(cfg.channels)).toEqual(["telegram", "slack", "openclaw-weixin"]);
expect(cfg.channels["openclaw-weixin"].accounts.primary.enabled).toBe(true);
});

it("bails (and warns) when openclaw.json is missing — does not invent a config", () => {
// generate-openclaw-config.py runs first and is responsible for producing
// openclaw.json. If it failed silently, we'd rather print a warning than
Expand Down
Loading