openclaw - 💡(How to fix) Fix [Bug]: Weixin plugin passes channel config instead of global config to resolveAgentRoute, breaking agent bindings [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#52799Fetched 2026-04-08 01:19:13
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×2closed ×1locked ×1

Root Cause

In src/messaging/process-message.ts line 213, the plugin calls:

const route = deps.channelRuntime.routing.resolveAgentRoute({
  cfg: deps.config,  // ← this is the channel-level config, not the global config
  channel: "openclaw-weixin",
  accountId: deps.accountId,
  peer: { kind: "direct", id: ctx.To },
});

deps.config is the channel-scoped configuration (channels.openclaw-weixin section from openclaw.json), which does not contain the bindings array. The bindings are at the top level of the global config.

Since resolveAgentRoute receives a config without bindings, it never matches any binding rule and always falls back to the default agent.

Code Example

const route = deps.channelRuntime.routing.resolveAgentRoute({
  cfg: deps.config,  // ← this is the channel-level config, not the global config
  channel: "openclaw-weixin",
  accountId: deps.accountId,
  peer: { kind: "direct", id: ctx.To },
});

---

{
     "bindings": [
       { "agentId": "sophie", "match": { "channel": "openclaw-weixin" } }
     ]
   }
RAW_BUFFERClick to expand / collapse

Bug Description

When using @tencent-weixin/openclaw-weixin v1.0.2, agent bindings for the openclaw-weixin channel are never matched. All inbound WeChat messages route to the default agent (main) regardless of the configured bindings in openclaw.json.

Root Cause

In src/messaging/process-message.ts line 213, the plugin calls:

const route = deps.channelRuntime.routing.resolveAgentRoute({
  cfg: deps.config,  // ← this is the channel-level config, not the global config
  channel: "openclaw-weixin",
  accountId: deps.accountId,
  peer: { kind: "direct", id: ctx.To },
});

deps.config is the channel-scoped configuration (channels.openclaw-weixin section from openclaw.json), which does not contain the bindings array. The bindings are at the top level of the global config.

Since resolveAgentRoute receives a config without bindings, it never matches any binding rule and always falls back to the default agent.

Steps to Reproduce

  1. Install @tencent-weixin/openclaw-weixin and configure WeChat channel
  2. Add a binding in openclaw.json:
    {
      "bindings": [
        { "agentId": "sophie", "match": { "channel": "openclaw-weixin" } }
      ]
    }
  3. Restart gateway
  4. Send a message from WeChat
  5. Message routes to agent:main:main instead of agent:sophie:main

Expected Behavior

WeChat messages should be routed to the agent specified in bindings.

Environment

  • OpenClaw: latest (2026.3.x)
  • Plugin: @tencent-weixin/openclaw-weixin v1.0.2
  • Plugin source: npm (@tencent-weixin/[email protected])

Suggested Fix

The plugin should pass the global OpenClaw config (or at minimum a config that includes the bindings array) to resolveAgentRoute. This likely requires the plugin SDK to expose the global config, or the plugin needs to access it through a different mechanism than deps.config.

extent analysis

Fix Plan

To fix the issue, we need to pass the global OpenClaw config to resolveAgentRoute. We can achieve this by modifying the process-message.ts file in the @tencent-weixin/openclaw-weixin plugin.

Step-by-Step Solution

  1. Modify the plugin code: Update the process-message.ts file to access the global config.
  2. Get the global config: Use the deps.openclaw.config object to access the global config.
  3. Pass the global config to resolveAgentRoute: Update the resolveAgentRoute call to use the global config.

Example Code

// process-message.ts
const route = deps.channelRuntime.routing.resolveAgentRoute({
  cfg: deps.openclaw.config, // Use the global config
  channel: "openclaw-weixin",
  accountId: deps.accountId,
  peer: { kind: "direct", id: ctx.To },
});

Verification

To verify the fix, follow these steps:

  1. Update the @tencent-weixin/openclaw-weixin plugin with the modified code.
  2. Restart the gateway.
  3. Send a message from WeChat.
  4. Check that the message is routed to the agent specified in the bindings array.

Extra Tips

  • Make sure to test the fix thoroughly to ensure that it works as expected.
  • Consider submitting a pull request to the @tencent-weixin/openclaw-weixin plugin repository to share the fix with the community.
  • If you encounter any issues or have further questions, don't hesitate to reach out to the OpenClaw community or the plugin maintainers for support.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING