Skip to content

[Bug]: Tool stdout leaks to chat + reply generation interrupted #91432

Closed as not planned

Description

@smarthse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Two issues after tool execution: (1) stdout messages from internal scripts leak into chat channel;
(2) final LLM response generation gets cut off after all tools succeed, showing 'Agent could not generate a response'

Steps to reproduce

Issue 1: Agent runs internal Python scripts (e.g. output_gate.py) via exec tool. Scripts print status to stdout. Messages appear in chat channel as visible replies instead of being suppressed.

Issue 2: Agent executes tool calls. All tools return successfully. During final response generation, LLM stream cuts off. User sees error: 'Agent could not generate a response. Note: some tool actions may have already been executed - please verify before retrying.' Reproduced twice at 19:46 and 19:51 CST on 2026-06-08.

Expected behavior

Issue 1: Internal script stdout should not be forwarded to external chat channels.

Issue 2: After all tool calls succeed, the LLM should complete response generation and deliver the reply to the user.

Actual behavior

Issue 1: BLOCK/WARN status messages from output_gate.py appear in WeChat chat.

Issue 2: All 3 tool calls succeeded (file write), but final response never arrived. Error message displayed instead.

OpenClaw version

2026.6.1

Operating system

Windows11

Install method

npm global

Model

deepseek/deepseek-v4-flash

Provider / routing chain

openclaw -> deepseek

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Issue 1: Affects all users. Medium severity. Internal status text leaks to chat, confusing users.

Issue 2: Affects agent reply reliability. High severity. Blocked replies require retry.

Additional information

Each issue can be reproduced independently. Issue 1 workaround: redirect script output to stderr.

Activity

  1. clawsweeper commented on Jun 8, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 12:34 PM ET / 16:34 UTC.

    Summary
    Keep open: current main and v2026.6.9 still contain the generic verbose/full command-output path and the replay-unsafe incomplete-turn error path. The final-response half overlaps #88657, but the internal stdout visibility concern is distinct and still needs maintainer policy/security review.

    Reproducibility: Partially: current-main source and tests show the verbose command-output delivery path and the replay-unsafe incomplete-turn error path. The exact WeChat stdout leak and DeepSeek final-stream cutoff have not been live-reproduced from this report because logs, screenshots, provider payloads, and transcript evidence are missing.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    Next step
    Manual review is needed because the stdout behavior is a product/security boundary and the final-response cutoff needs replay-policy and live provider evidence.

    Security
    Needs attention: The issue is security-sensitive because current source allows command/tool stdout to become chat-visible under verbose/full behavior, and the desired suppression boundary is not yet defined.

    Review details

    Best possible solution:

    Split the work into a maintainer-defined core policy for internal stdout visibility and the replay-safety/provider investigation already centered on #88657.

    Do we have a high-confidence way to reproduce the issue?

    Partially: current-main source and tests show the verbose command-output delivery path and the replay-unsafe incomplete-turn error path. The exact WeChat stdout leak and DeepSeek final-stream cutoff have not been live-reproduced from this report because logs, screenshots, provider payloads, and transcript evidence are missing.

    Is this the best way to solve the issue?

    Unclear: suppressing all stdout would conflict with documented verbose-full behavior, while retrying every replaySafe=no turn could duplicate side effects. The maintainable fix needs a narrower maintainer-approved policy boundary for internal output and replay-safe recovery.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The exact WeChat leak and DeepSeek run still lack live logs, screenshots, provider payloads, stop reasons, and transcript evidence in this issue.
    • Suppressing all exec stdout would conflict with documented verbose-full behavior unless maintainers define a narrower internal-script or channel-visibility boundary.
    • Retrying every replaySafe=no final turn could duplicate side-effectful tools, so the recovery policy needs maintainer approval.
    • The WeChat runtime lives in the external openclaw-weixin plugin, so core evidence proves the generic delivery path but not the plugin-specific live symptom.

    Codex review notes: model internal, reasoning high; reviewed against c2ee9b0be8ae.

    Label changes

    Label justifications:

    • P2: The issue affects chat-visible tool output and post-tool reply reliability, but the remaining fix is bounded and policy-sensitive rather than a core outage.
    • impact:security: Internal command or tool stdout reaching an external chat can expose private operational details or command output.
    • impact:message-loss: The final-response cutoff leaves the user without the expected assistant reply after tool actions complete.
    • impact:auth-provider: The second symptom is tied to a specific provider/model route through DeepSeek and incomplete provider turns.
    Evidence reviewed

    Security concerns:

    • [medium] Internal stdout can cross into chat-visible progress — src/agents/embedded-agent-subscribe.handlers.tools.ts:1107
      Current source emits exec output through command_output callbacks and later resolves visible tool payloads for channel delivery; maintainers should define which internal script output must never be forwarded to external chats.
      Confidence: 0.74

    Acceptance criteria:

    • Capture a redacted live WeChat or equivalent channel repro showing whether verbose/full or default output settings are involved.
    • Capture provider stop reason, payload count, tool count, replay metadata, and transcript evidence for the DeepSeek final-response failure.
    • Run focused regression tests around src/agents/embedded-agent-subscribe.handlers.tools.ts, src/auto-reply/reply/dispatch-from-config.ts, and src/agents/embedded-agent-runner/run/incomplete-turn.ts after maintainers choose the policy.

    What I checked:

    • Live issue state: The issue is still open, has no linked closing pull request, and the durable ClawSweeper comment already separated the stdout visibility half from the DeepSeek incomplete-turn half.
    • Current command-output visibility gate: Current main still emits command/tool output streams only when verbose resolves to full, so suppressing all internal stdout would change documented verbose-full behavior rather than close a simple already-fixed bug. (src/auto-reply/reply/agent-runner-helpers.ts:83, c2ee9b0be8ae)
    • Current exec stdout event path: Current main extracts live exec output and emits a command_output callback when detailed live updates are enabled, which is the source-backed path for command stdout to leave the tool layer. (src/agents/embedded-agent-subscribe.handlers.tools.ts:1107, c2ee9b0be8ae)
    • Current visible delivery path: Current main resolves a visible tool delivery payload and sends it to the originating channel when progress delivery is not suppressed, so the generic core path can still reach external channel delivery. (src/auto-reply/reply/dispatch-from-config.ts:2951, c2ee9b0be8ae)
    • Documented verbose-full behavior: Docs still say verbose full forwards tool outputs after completion as separate bubbles, which makes a blanket stdout suppression a product/security boundary decision. Public docs: docs/tools/thinking.md. (docs/tools/thinking.md:89, c2ee9b0be8ae)
    • Security docs warn about verbose output exposure: Security docs explicitly warn that verbose output can expose internal reasoning, tool output, or plugin diagnostics and should be treated as debug-only in groups. Public docs: docs/gateway/security/index.md. (docs/gateway/security/index.md:725, c2ee9b0be8ae)

    Likely related people:

    • steipete: Commit 99dd428 introduced the verbose tool feedback helper, and Peter Steinberger merged the adjacent post-tool incomplete-turn recovery pull request. (role: verbose feedback introducer and adjacent merger; confidence: high; commits: 99dd4288622a, 77a682c5def2; files: src/auto-reply/reply/agent-runner-helpers.ts, src/auto-reply/reply/dispatch-from-config.ts, src/agents/embedded-agent-runner/run/incomplete-turn.ts)
    • vincentkoc: Current-line blame in this checkout maps the inspected command-output, verbose gate, and incomplete-turn lines to Vincent Koc, and recent commits touched adjacent agent/runtime surfaces. (role: recent area contributor; confidence: medium; commits: 89a73d08c805, c2ee9b0be8ae, 6a324f640034; files: src/agents/embedded-agent-subscribe.handlers.tools.ts, src/auto-reply/reply/agent-runner-helpers.ts, src/agents/embedded-agent-runner/run.ts)
    • fuller-stack-dev: Authored the merged empty post-tool final-turn recovery work on the same incomplete-turn and replay-safety boundary. (role: adjacent recovery contributor; confidence: high; commits: 77a682c5def2; files: src/agents/embedded-agent-runner/run/incomplete-turn.ts, src/agents/embedded-agent-runner/run.ts, src/agents/embedded-agent-runner/run.empty-error-retry.test.ts)
    • joelnishanth: Authored the merged length-limited response fix that changed nearby incomplete-turn classification and tests while explicitly preserving existing toolUse behavior. (role: adjacent incomplete-turn contributor; confidence: medium; commits: 81924cfd5e61; files: src/agents/embedded-agent-runner/run/incomplete-turn.ts, src/agents/embedded-agent-runner/run.incomplete-turn.test.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P2Normal backlog priority with limited blast radius.
    impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR 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.
    on Jun 8, 2026
  3. added
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    on Jun 19, 2026
  4. openclaw-barnacle commented on Jul 6, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  5. openclaw-barnacle commented on Jul 14, 2026

    @openclaw-barnacle

    Closing due to inactivity.
    If this is still an issue, please retry on the latest OpenClaw release and share updated details.
    If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.

  6. locked as resolved and limited conversation to collaborators on Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper: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: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.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.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