Skip to content

[Feature]: Carry gateway client capabilities through the CLI/bundle-MCP backend #102577

Description

@steipete

Summary

Thread gateway client capabilities through the CLI/bundle-MCP loopback backend so capability-gated tools (e.g. show_widget, gated on inline-widgets) work when a Control UI conversation runs on a CLI-backed model backend.

Problem to solve

Capability-gated tool availability lands with the inline web-widget work: the originating gateway client declares capabilities at connect, chat.send stamps them into the run context, and tool assembly filters tools whose requiredClientCaps the client did not declare. The embedded runner and the Codex app-server backend transport these caps end to end. The CLI-backed backend path does not: RunCliAgentParams, the MCP loopback environment/request scope, and McpLoopbackScopeParams carry no capability field, so resolveGatewayScopedTools() assembles tools with no caps and capability-gated tools are dropped (fail closed). A Control UI user on a CLI-backed model therefore cannot use show_widget even though their client advertises inline-widgets.

Proposed solution

Propagate the originating client capabilities through the CLI run parameters and the MCP loopback request/scope contract (including any loopback scope caching, which must key on the caps or resolve them per request), then let the existing filterToolsByClientCaps gate apply unchanged. Tests: loopback scope carries caps; a CLI-backed run from a caps-declaring client assembles the gated tool; channel-originated CLI runs still exclude it.

Impact

  • Affected: Control UI conversations using CLI-backed model backends; any future capability-gated tools.
  • Severity: feature gap (fail closed — no security exposure).
  • Consequence: gated tools silently unavailable on one backend family.

Evidence/examples

  • Gate: filterToolsByClientCaps in src/agents/openclaw-tools.ts; assembly entry src/gateway/tool-resolution.ts.
  • Working transports for comparison: embedded runner (GatewayClientCaps on the message context → run params) and Codex app-server (extensions/codex/src/app-server/dynamic-tool-build.ts).
  • Surfaced by structured review on the widget PR; documented as a known limitation in docs/tools/show-widget.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.enhancementNew feature or requestimpact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.maintainerMaintainer-authored PRmaturity:stableIssue affects a taxonomy feature currently scored M4/M5.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions