Skip to content

[Bug]: exec tool failure message format makes framework labels indistinguishable from agent-typed commands #97319

Closed

Description

@redasadki

Summary

When an exec tool call fails, the cron run history and chat surface render the failure as:

⚠️ 🛠️ `run python3 /path/to/script.py` failed

The leading verb run is inside the backticks adjacent to the actual command. This looks indistinguishable from an agent that literally typed run python3 /path/to/script.py (i.e., prepended the word run to a Python invocation).

It is in fact a framework display label for the exec tool call, not part of the command.

Environment

  • OpenClaw 2026.6.10
  • Surfaces: cron run history (cron action=runs → lastError), and the chat tool-failure card

Real debugging cost

Debugging a daily-cost-audit cron failure today, this misled diagnosis for ~45 minutes:

  1. The error read ⚠️ 🛠️ \run python3 /path/to/daily-cost-audit.py` failed`
  2. I initially concluded the agent was prepending the word run to its command and rewrote the cron prompt twice with explicit "do not prepend run" forbiddens
  3. Neither rewrite helped because the agent was never prepending anything
  4. The actual cause was unrelated — the exec tool was raising on the script's exit code 1

Only re-running the actual command in a shell exposed the false signal.

Suggested fix

Change the display format so the framework verb is clearly outside the literal command, e.g.:

  • Current: ⚠️ 🛠️ `run python3 /path/to/script.py` failed
  • Proposed (any of):
    • ⚠️ exec failed: `python3 /path/to/script.py` (exit 1)
    • ⚠️ tool exec call failed: `python3 /path/to/script.py`
    • ⚠️ exec call `python3 /path/to/script.py` failed

Including the exit code in the message, when available, would also help.

Severity

Low — debugging quality-of-life, no functional impact. Pairs with the exec nonzero-exit issue being filed separately; together they made a real failure hard to diagnose.

Activity

  1. redasadki commented on Jun 27, 2026

    @redasadki
    Author

    Related: #97318 (exec nonzero-exit semantics — the underlying cause of the failure this message described) and #97317 (cron defaults — the context in which both surfaced).

  2. clawsweeper commented on Jun 27, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 27, 2026, 4:28 PM ET / 20:28 UTC.

    Summary
    Keep open: current main and v2026.6.10 still compose exec/bash failure warnings by wrapping a command-like framework summary in markdown and appending failed, so the reported cron/chat ambiguity remains a focused presentation bug.

    Reproducibility: yes. at source level: current main still builds warning text as ⚠️ ${toolSummary} failed, and exec/bash summaries can contain markdown-wrapped run python3 ... text. I did not execute a live cron/chat run in this read-only review.

    Root-cause cluster
    Relationship: canonical
    Canonical: #97319
    Summary: This issue is canonical for the narrow exec failure-text ambiguity; the linked exec nonzero-exit and cron-defaults reports are adjacent context with distinct fixes.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    This is a narrow existing presentation bug with source-reproducible paths and focused regression tests; no new API, config, or product policy is required.

    Review details

    Best possible solution:

    Update the shared tool-failure presentation path so exec/bash warnings name the tool failure separately while rendering only the literal command as command text, with focused tests for payload warnings, cron diagnostics, and any affected chat display.

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

    Yes, at source level: current main still builds warning text as ⚠️ ${toolSummary} failed, and exec/bash summaries can contain markdown-wrapped run python3 ... text. I did not execute a live cron/chat run in this read-only review.

    Is this the best way to solve the issue?

    Yes: a shared presentation-layer fix is the narrowest maintainable solution, while the linked exec nonzero-exit semantics report should remain separate.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No live cron or chat run was executed during this read-only review; the source path and existing tests are strong enough to keep the issue open and queue a focused fix.

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

    Label changes

    Label changes:

    • add maturity:stable: The issue affects gateway-runtime diagnostic behavior, and the maturity helper lists Gateway runtime as M4 Stable.

    Label justifications:

    • P3: The report describes low-severity diagnostic confusion without data loss, security, availability, or message-delivery failure in the item itself.
    • impact:other: The affected area is user-facing cron/chat diagnostics and debugging clarity, which is maintainer-visible but outside the more specific owned impact categories.
    • maturity:stable: The issue affects gateway-runtime diagnostic behavior, and the maturity helper lists Gateway runtime as M4 Stable.
    Evidence reviewed

    Acceptance criteria:

    • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/payloads.errors.test.ts src/cron/run-diagnostics.test.ts src/cron/isolated-agent.helpers.test.ts src/agents/tool-display.test.ts
    • node scripts/run-vitest.mjs ui/src/ui/chat/tool-cards.test.ts

    What I checked:

    • Repository policy read: Root AGENTS.md and relevant scoped guides for agent, runner, channel, and UI surfaces were read and applied to this review. (AGENTS.md:1, c29e1fe764f3)
    • Issue report and related context: The reporter gives a concrete v2026.6.10 example where ⚠️ 🛠️ run python3 ... failed was read as a literal agent command, and links separate reports for exec nonzero-exit semantics and cron defaults as adjacent context.
    • Current warning construction: Current main builds visible tool failure warnings as ⚠️ ${toolSummary} failed, so the shared tool summary determines whether the command-like run ... text is visually separate from the failure label. (src/agents/embedded-agent-runner/run/payloads.ts:553, c29e1fe764f3)
    • Exec aggregate omits explicit tool label: For exec/bash with metadata, the aggregate formatter uses only the tool emoji as the prefix and then markdown-wraps the metadata, which produces a compact command-like warning instead of Exec failed: <command>. (src/auto-reply/tool-meta.ts:19, c29e1fe764f3)
    • Python exec summaries include framework verb: The exec display formatter summarizes Python script commands as run ${bin} ${script}, so a command like python3 /path/to/script.py becomes framework wording that can be mistaken for the literal command when backticked. (src/agents/tool-display-exec.ts:240, c29e1fe764f3)
    • Cron outcome consumes the warning text: Cron output normalization treats ⚠️ 🛠️ ... payloads as tool warnings and can carry the last error payload text into summary/output/error state, matching the reported cron lastError surface. (src/cron/isolated-agent/helpers.ts:216, c29e1fe764f3)

    Likely related people:

    • Bartok9: Authored recent merged work on src/agents/tool-display-exec.ts, the file that turns Python exec commands into the run python3 ... display summary involved here. (role: recent exec-display contributor; confidence: high; commits: 4d9cd7d22755; files: src/agents/tool-display-exec.ts)
    • vincentkoc: Recent history shows direct commits and coauthorship across tool display and auto-reply aggregate formatting, including the exec/bash compact summary area. (role: recent display/aggregate contributor; confidence: high; commits: 4552ea7ba0be, 60612ff492b1, ccc1ad4c7448; files: src/agents/tool-display-exec.ts, src/auto-reply/tool-meta.ts)
    • chenyangjun-xy: Authored merged work on src/agents/embedded-agent-runner/run/payloads.ts, the surface that appends failed to the formatted tool summary. (role: recent payload-warning contributor; confidence: medium; commits: e6f391234791; files: src/agents/embedded-agent-runner/run/payloads.ts)
    • mushuiyu886: Authored recent heartbeat exec detail work on the same embedded-runner payload warning path and appears in the checked-out blame boundary for current warning lines. (role: adjacent exec warning-policy contributor; confidence: medium; commits: b2c1de77acc7, 65fec9d787e3; files: src/agents/embedded-agent-runner/run/payloads.ts, src/agents/tool-display-exec.ts, src/auto-reply/tool-meta.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.
  3. added
    P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.
    impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.
    no-staleExclude from stale automation
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.
    on Jun 27, 2026
  4. locked as resolved and limited conversation to collaborators on Jul 17, 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

    P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions