Skip to content

Implement direct Gateway-dispatched OpenClaw tool activity #3865

Description

@CompleteDotTech

Parent

Implements the durable direct-Gateway dispatch path required by #3847. It supersedes the reverted observer-only attempt in #3852.

Problem

The CLI does not expose the Gateway-accepted runId before tool events begin, so an observer cannot safely correlate session-scoped session.tool events to one Cave turn.

Scope

  • Make a compatible authenticated Gateway the authoritative OpenClaw chat transport.
  • Use the published @openclaw/gateway-client and @openclaw/gateway-protocol packages for protocol constants, validation, device authentication, and capabilities.
  • Obtain the accepted dispatch runId, bind chat and tool events to it, and keep the existing CLI route as a fail-closed fallback for unsupported, unpaired, unavailable, or schema-incompatible runtimes.
  • Add release-versioned protocol fixtures and a route-level WebSocket-to-SSE/persistence integration test.

Acceptance criteria

  • No tool card is emitted unless its authenticated, validated frame matches the exact dispatched run ID.
  • Operator scopes and paired-device authentication are negotiated before dispatch; Gateway credentials are never inherited by the CLI fallback child.
  • Unknown protocol/schema/capability, malformed frames, replay/gap, disconnect, cancellation, or dispatch failure close the Gateway path and retain safe plain-chat behavior.
  • Supported protocol versions are generated from/pinned to official package schemas, with an upgrade matrix and conformance fixtures.
  • Route-level tests prove that one dispatched run emits start/update/result cards and that a concurrent run cannot leak cards into it.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions