Skip to content

sessions_send blocked by visibility guard even when a2a policy allows cross-agent messaging #57447

Description

@zijiess

Problem

When tools.sessions.visibility is set to tree (the default) and tools.agentToAgent.enabled=true with appropriate allow patterns, sessions_send is still blocked for cross-agent messaging. The visibility guard in createSessionVisibilityGuard rejects all cross-agent access when visibility !== "all", regardless of the a2a policy.

This forces operators into an all-or-nothing choice:

  • visibility=all → send works, but list/history also exposes cross-agent sessions (data leak risk)
  • visibility=tree → data isolation preserved, but send is blocked despite a2a policy allowing it

Use Case

Multi-agent deployments where:

  • Each agent runs in a sandbox with sessionToolsVisibility=spawned
  • Agents need to send messages to each other (sidecar → platform, partner → coordinator)
  • Agents must not list or read each other's session history

This is the standard model for platforms hosting multiple tenant agents on a single OpenClaw instance, where a2a policy defines the trust boundary for messaging.

Root Cause

createSessionVisibilityGuard (sessions-access.ts) applies the same visibility check to all actions:

if (isCrossAgent) {
  if (params.visibility !== "all") {  // ← blocks send even when a2a allows it
    return { allowed: false, status: "forbidden", ... };
  }
  // a2a policy check comes after — never reached
}

Additionally, restrictToSpawned in sessions-send-tool.ts adds spawnedBy to label resolution, which prevents resolving cross-agent session targets entirely.

Proposal

Let the a2a policy serve as the authorization gate for sessions_send, independent of the visibility setting that governs list/history/status.

Conceptually:

action gate rationale
list visibility controls what you can see
history visibility controls what you can read
status visibility controls what you can inspect
send a2a policy controls what you can message — sending does not require seeing

This could be implemented as:

  1. Per-action visibility exception: skip the visibility gate for send when a2a policy explicitly allows the target agent, or
  2. New visibility level: e.g. tree+a2a-send that preserves tree isolation for read operations but allows a2a-gated sends, or
  3. Separate config key: tools.sessions.sendVisibility that defaults to a2a while keeping the existing visibility for other actions

Option 1 is the simplest and aligns with the existing a2a policy design — the policy already validates requester→target agent pairs, so it provides equivalent or stronger authorization than visibility alone.

Security Analysis

With option 1 (a2a policy gates send):

scenario current proposed security
send cross-agent, a2a allows ❌ blocked ✅ allowed a2a policy validates
send cross-agent, a2a denies ❌ blocked ❌ blocked unchanged
list cross-agent ❌ blocked ❌ blocked unchanged
history cross-agent ❌ blocked ❌ blocked unchanged

No new attack surface is introduced — send already requires a2a policy approval, which is a stricter check than visibility=all (which allows everything).

Related

Environment

  • OpenClaw v2026.3.24+ (tree visibility default)
  • Multi-agent deployment with sandbox, a2a enabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for 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:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions