Skip to content

Subagent completion output leaks internal tool-failure reasoning to requester session #39032

@cryptopoly

Description

@cryptopoly

Summary

When a subagent encounters a tool failure (e.g. calling message with a session key instead of a Telegram chat ID), the agent's internal reasoning about the failure leaks into the auto-announce completion output delivered to the requester session.

Steps to reproduce

  1. Spawn a subagent with sessions_spawn
  2. Subagent attempts to use message tool with a session key (e.g. agent:main:main) instead of a Telegram chat ID
  3. Tool fails with an error
  4. Subagent writes internal reasoning: "The message tool needs a Telegram chat ID, not a session key..."
  5. This reasoning appears verbatim in the auto-announce output delivered back to the parent session

Expected behaviour

Subagent completion output should only include the final task result, not internal tool-failure reasoning or debugging thoughts.

Actual behaviour

Internal reasoning / error-handling thoughts from the subagent are forwarded to the requester as part of the completion announcement.

Impact

  • Confuses end users who receive raw internal agent reasoning in their chat
  • Exposes implementation details (session keys, tool names, error messages)
  • Occurs reliably whenever a subagent misuses a channel tool

Proposed fixes

  1. Strip tool-failure reasoning from subagent completion output before delivering to requester session
  2. OR gate message tool in subagent context so it cannot be called with session key format (validate input, reject early with helpful error)
  3. Longer term: Separate internal monologue from task result in subagent output pipeline

Workaround

Updated all subagent AGENTS.md files with explicit rule: use sessions_send (not message tool) for inter-agent communication. This prevents the trigger but doesn't fix the underlying leak.

Environment

  • OpenClaw version: 2026.3.2
  • Runtime: subagent (sessions_spawn)
  • Affected tool: message (channel tool)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.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: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.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions