Skip to content

LINE: buildPeerId adds redundant 'group:' prefix, breaking binding route matching #21907

@circleghost

Description

@circleghost

Bug Description

buildPeerId() in src/line/bot-message-context.ts prepends group: to the group ID for LINE group messages:

function buildPeerId(source: EventSource): string {
  if (source.type === "group" && source.groupId) {
    return `group:${source.groupId}`;  // adds "group:" prefix
  }
  // ...
}

This value is then passed as peer.id to resolveAgentRoute(). However, the binding system (in resolveAgentRoutematchesBindingScope) expects peer.id to be the raw group ID (e.g., Cc7e3bece...), matching what the docs instruct users to put in openclaw.json bindings.

Since matchesBindingScope does strict string comparison (scope.peer.id !== match.peer.id), the binding never matches:

  • Routing peer.id: group:Cc7e3bece...
  • Binding peer.id: Cc7e3bece...

This causes all LINE group messages to fall through to the default agent, ignoring any explicit bindings.

Evidence

Session keys show the redundant prefix — agent:main:line:group:group:cc7e3... (the format is <agentId>:<channel>:<peer.kind>:<peer.id>, so peer.id = group:cc7e3...).

Compare with Telegram, which does NOT have this issue: agent:main:telegram:group:-5017043739

Expected Behavior

buildPeerId should return the raw source.groupId (and source.roomId) without prefix, so that binding peer.id matches as documented.

Workaround

Patch buildPeerId in 5 dist files to remove the prefix:

if (source.type === "group" && source.groupId) return source.groupId;
if (source.type === "room" && source.roomId) return source.roomId;

Environment

  • OpenClaw 2026.2.19-2
  • Node.js 24.13.0
  • macOS 15.7.2 (arm64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions