nextlevelbuilder / nextlevelbuilder/goclaw

Agent bindings cannot override channel instance agent_id

Open
#232 2 comments 0 reactions 1 assignee View on GitHub

@haidang1810 is already working on this.

Since Mar 23, 2026.

agent:github-maintain area:channels maintain:triaged P3-low
Dominant language
Go
Stars
3.6k
Forks
1.1k
Avg merge
3d 5h
Merged PRs (30d)
24

Description

Problem

The maintainer of PR #227 recommended using agent bindings for per-channel agent routing. However, bindings cannot work when a channel instance has an agent_id set.

Flow
  1. Channel instance mother-slack has agent_id = <mother UUID>
  2. Slack adapter creates message with msg.AgentID = "mother" (from BaseChannel.AgentID())
  3. In processNormalMessage(), agentID := msg.AgentID"mother"
  4. resolveAgentRoute() is only called when agentID == "" — it never fires
  5. Config bindings are completely bypassed
Code
// cmd/gateway_consumer_normal.go
agentID := msg.AgentID
if agentID == "" {
    agentID = resolveAgentRoute(cfg, msg.Channel, msg.ChatID, msg.PeerKind)
}
What I need

One Slack bot (Socket Mode) serving multiple agents. DMs → Mother. #cell-invoice → invoice agent. #cell-ops → ops agent.

Options I see
  1. Make channel_instance.agent_id nullable — when NULL, msg.AgentID is empty, bindings kick in. Requires instance_loader to skip SetAgentID when agent_id is NULL.
  2. Always check bindings first — before falling back to msg.AgentID. Peer-level bindings (channel + chat_id) are more specific than a channel-wide default.
  3. Both — nullable agent_id + bindings-first.

Happy to submit a PR for whichever approach you prefer.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.