openclaw - ✅(Solved) Fix [Bug]: Agent fabricates successful output after exec tool failure instead of reporting error [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60497Fetched 2026-04-08 02:50:20
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1

When the exec tool fails with "command not found", the agent discards the error and outputs fabricated file creation confirmations and fake execution results instead of reporting the failure.

Error Message

the error and outputs fabricated file creation confirmations and fake Agent reports the exact tool error and stops. It should not proceed Agent ignores the error and outputs fabricated statistics, column

Root Cause

When the exec tool fails with "command not found", the agent discards the error and outputs fabricated file creation confirmations and fake execution results instead of reporting the failure.

Fix Action

Fixed

PR fix notes

PR #60507: feat(security): add destructive-commands.ts — catalog of HIL-required exec patterns for agentic workloads

Description (problem / solution / changelog)

Summary

Adds src/security/destructive-commands.ts — a curated catalog of command patterns that should require Human-in-the-Loop (HIL) approval when running in agentic contexts.

Motivation

When autonomous agents run in agentic workflows (sub-agent spawning, background cron jobs, multi-step orchestration), they can inadvertently execute destructive commands like kubectl delete, terraform destroy, or rm -rf without the user realizing it's happening.

OpenClaw already has an excellent exec approval system (ask=on-miss, security=allowlist). This PR adds a canonical reference catalog of patterns that should not be on any default allowlist.

What's in the catalog

Patterns organized by tool category, each with a comment explaining rationale:

  • Kubernetes: kubectl delete, kubectl drain, kubectl apply (state changes), scale, rollout restart/undo
  • Terraform: terraform apply, terraform destroy, taint, import, state mutations
  • GCP gcloud: create, delete, update, set, deploy, disable/enable operations
  • Filesystem: rm, rmdir, shred, dd, truncate
  • Git: push --force, push to main/master/production, reset --hard, filter-branch
  • Database: DROP, TRUNCATE, DELETE, ALTER via psql/mysql/sqlite3
  • Process: kill -9, killall, pkill -9
  • SSH: remote destructive sudo commands

Design — safe operations explicitly excluded

  • kubectl get/describe/logs/rollout status → NOT in the list (read-only)
  • terraform plan/init/validate → NOT in the list (read-only)
  • gcloud * list/describe/get → NOT in the list (read-only)
  • Normal git push → NOT in the list (only force variants)

Usage with existing approval system

import { ALL_DESTRUCTIVE_PATTERNS } from './security/destructive-commands.js';

// Example: in exec approval policy initialization
const requiresHIL = ALL_DESTRUCTIVE_PATTERNS.some(pattern =>
  matchAllowlist(command, [{ pattern }])
);

With security=allowlist + ask=on-miss in exec-approvals.json, any command not on the safe allowlist automatically triggers the approval flow — including anything matching these patterns.

Tests

src/security/destructive-commands.test.ts covers:

  • Safe kubectl/terraform operations are NOT matched
  • Destructive operations ARE matched
  • No duplicates in the full pattern set

Related

Companion to issue #60497 (agent fabricates success after exec failure). Requiring approval before destructive commands run is the proactive complement to fail-closed exec behavior after the fact.

Also complements:

  • dangerous-tools.ts (tool-level deny list)
  • exec-safe-bin-policy.ts (safe binary allowlist)

Contributed by a user running BMAD agentic orchestration on a 200-core bare-metal Hive cluster. We hit these failure modes the hard way and built these patterns from production incidents.

Changed files

  • src/security/destructive-commands.test.ts (added, +76/-0)
  • src/security/destructive-commands.ts (added, +172/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When the exec tool fails with "command not found", the agent discards the error and outputs fabricated file creation confirmations and fake execution results instead of reporting the failure.

Steps to reproduce

  1. Start an OpenClaw session (NemoClaw sandbox, NVIDIA Endpoints inference)
  2. Run: openclaw agent --agent main --local
    -m "write a python script that reads a CSV file and outputs basic statistics"
  3. Observe agent output
  4. Verify filesystem: ls -la /sandbox/csv_stats.py 2>/dev/null || echo "FILE NOT FOUND"

Expected behavior

Agent reports the exact tool error and stops. It should not proceed or simulate output after a failed tool call.

Actual behavior

exec tool returns: [tools] exec failed: /bin/bash: line 1: python: command not found

Agent ignores the error and outputs fabricated statistics, column names, and row counts, then confirms "the script is ready to use and saved in your workspace." Filesystem check returns FILE NOT FOUND for both csv_stats.py and sample.csv.

OpenClaw version

2026.3.11 (29dc654)

Operating system

Ubuntu 24.04 (Brev cloud instance)

Install method

NemoClaw installer (npm global via nemoclaw onboard)

Model

nvidia/nemotron-3-super-120b-a12b

Provider / routing chain

openclaw -> NemoClaw plugin -> NVIDIA Endpoints (build.nvidia.com)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

Related: NVIDIA/NemoClaw#1452 (sandbox-side python symlink fix already merged as PR #1455, agent loop behavior flagged upstream here)

extent analysis

TL;DR

The agent should be modified to properly handle and report errors from the exec tool instead of discarding them and outputting fabricated results.

Guidance

  • Review the error handling mechanism in the agent to ensure it correctly captures and reports errors from the exec tool, such as the "command not found" error.
  • Verify that the agent stops execution and reports the error when the exec tool fails, instead of proceeding with fabricated output.
  • Check the implementation of the openclaw agent command to ensure it properly handles errors and exceptions, and consider adding additional logging or debugging statements to help diagnose issues.
  • Investigate the relationship between the agent's error handling and the NVIDIA Endpoints inference plugin, as well as the NemoClaw plugin, to ensure that errors are properly propagated and reported.

Example

No specific code snippet can be provided without more information about the agent's implementation, but a general example of improved error handling might involve using try-except blocks to catch and report exceptions:

try:
    # exec tool call
except Exception as e:
    # report error and stop execution
    print(f"Error: {e}")
    sys.exit(1)

Notes

The issue seems to be related to the agent's error handling mechanism, and fixing it may require modifications to the agent's implementation. Additionally, the related issue NVIDIA/NemoClaw#1452 and the merged PR #1455 may provide useful context and insights into the problem.

Recommendation

Apply workaround: Modify the agent to properly handle and report errors from the exec tool, as this will allow for more accurate and reliable output. This change can help prevent the agent from discarding errors and outputting fabricated results, and will provide a more robust and reliable experience for users.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Agent reports the exact tool error and stops. It should not proceed or simulate output after a failed tool call.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING