Skip to content

connector-openclaw: add lane support for OpenClaw webhook delivery #140

@marshall-ch-personal

Description

@marshall-ch-personal

Problem

The @orgloop/connector-openclaw connector delivers events to OpenClaw's /hooks/agent endpoint but never passes a lane field in the request body. OpenClaw's hook handler accepts lane and uses it for scheduling — without it, all deliveries resolve to the nested lane which has a hardcoded maxConcurrent: 1.

When a pipeline fires many routes concurrently (e.g. labeling 5 issues triggers 5 routes simultaneously), all deliveries queue serially in the nested lane. We observed 15+ minute delays with 12 items backed up.

Root Cause

In target.js, the request body sent to /hooks/agent:

const body = {
    message: this.buildMessage(event, routeConfig),
    sessionKey: ...,
    agentId: this.agentId,
    wakeMode: routeConfig.wake_mode ?? 'now',
    deliver: routeConfig.deliver ?? false,
    // lane is never set ← this is the gap
    channel: this.defaultChannel,
    to: this.defaultTo,
};

OpenClaw's /hooks/agent handler reads request.lane and passes it to resolveNestedAgentLane(). When absent, it defaults to the nested lane (concurrency: 1). Setting lane: "main" uses the main scheduling lane which respects agents.defaults.maxConcurrent (typically 4-30).

Proposed Fix

  1. Read lane from connector config (cfg.lane) in init()
  2. Read lane from route config (routeConfig.lane) for per-route override
  3. Pass it in the request body: lane: routeConfig.lane ?? this.lane ?? undefined

This allows users to configure in their connector YAML:

actors:
  - id: my-agent
    connector: "@orgloop/connector-openclaw"
    config:
      base_url: "http://127.0.0.1:18789"
      auth_token_env: "${OPENCLAW_WEBHOOK_TOKEN}"
      agent_id: "my-agent"
      lane: "main"  # ← use main scheduling lane

Or per-route in the route config:

then:
  actor: my-agent
  config:
    lane: "main"

Impact

Any OrgLoop user with concurrent pipeline routes hitting OpenClaw will experience this bottleneck. The fix is backward-compatible — omitting lane preserves current behavior.

Workaround

Monkey-patch node_modules/@orgloop/connector-openclaw/dist/target.js to add lane support. Not recommended for production.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions