Skip to content

Google Chat DM routing ignores bindings — always routes to default agent main session #9198

@mrbaywatch

Description

@mrbaywatch

Bug Description

Google Chat DM messages from paired users always route to agent:main:main regardless of binding configuration. Channel-level, peer-level, and even default-agent-swap bindings are all ignored.

Environment

  • OpenClaw version: 2026.2.2-3
  • OS: macOS (Darwin 25.2.0 arm64)
  • Node: v22.22.0

Configuration

agents: {
  list: [
    { id: "main", name: "main", workspace: "~/projects/clawd" },
    { id: "work", name: "telenor-tom", workspace: "~/projects/telenor-tom" },
  ],
},
bindings: [
  { agentId: "work", match: { channel: "googlechat" } },
],
channels: {
  googlechat: {
    enabled: true,
    groupPolicy: "allowlist",
    groups: { "spaces/AAQAxyffo14": { allow: true, requireMention: true } },
    serviceAccountFile: "/path/to/service-account.json",
    audienceType: "app-url",
    audience: "https://gateway.example.com/googlechat",
  },
},

Steps to Reproduce

  1. Configure a second agent (work) with its own workspace and auth-profiles.json
  2. Add a binding: { agentId: "work", match: { channel: "googlechat" } }
  3. Pair a Google Chat user (DM)
  4. Send a DM from Google Chat

Expected Behavior

Message should route to agent:work:googlechat:dm:<spaceId> (per the docs: "DMs use session key agent:<agentId>:googlechat:dm:<spaceId>").

Actual Behavior

Message always routes to agent:main:main with ~5-6 minute delay (suggesting the system tries the binding, times out, then falls back).

What I've Tried

All of the following were tested with gateway restarts between each:

  1. Channel-level binding: { channel: "googlechat" } → still routes to main
  2. Peer-level bindings (level 1):
    • { channel: "googlechat", peer: { kind: "dm", id: "spaces/<id>" } }
    • { channel: "googlechat", peer: { kind: "group", id: "spaces/<id>" } }
      → still routes to main
  3. Default agent swap: Set work as default: true and first in list → still routes to agent:main:main
  4. Reset main session delivery context from googlechat to telegram → gateway overwrites it back
  5. Verified work agent works independently: openclaw agent --agent work -m "test" --local ✅ responds
  6. Verified work agent can deliver via googlechat: openclaw agent --agent work -m "test" --channel googlechat --deliver ✅ creates session

Diagnostic Details

  • openclaw agents list --bindings correctly shows: work: googlechat peer=dm:spaces/<id>
  • Work agent sessionsCount: 0 in openclaw status --json — never receives an inbound message
  • Pairing data at ~/.openclaw/credentials/googlechat-allowFrom.json has the user
  • Log shows lane=session:agent:main:main with messageChannel=googlechat for every Google Chat DM
  • No Google Chat-specific session (googlechat:dm:*) is ever created in any agent's session store
  • Telegram binding for another agent (petter with separate accountId) works correctly

Hypothesis

Google Chat DM handling for paired users may bypass the binding evaluation layer entirely, collapsing directly to the default agent's main session. This appears specific to Google Chat — Telegram bindings with accountId work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions