openclaw - 💡(How to fix) Fix [Bug]: subagent failed to execute or produce output [2 comments, 3 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#51062Fetched 2026-04-08 01:04:46
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
0
Timeline (top)
commented ×2labeled ×2cross-referenced ×1mentioned ×1

Environment:

  • OpenClaw Version: (Please provide your current OpenClaw version, e.g., 'openclaw status' output)
  • Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
  • User: Kelvin
  • cad Subagent Configuration (from openclaw.json):
    {
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }
  • cad Subagent agent.sh content (latest test version):
    #!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail
    
    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp

Issue Description: The cad subagent, when spawned using sessions_spawn with runtime="subagent", fails to execute its agent.sh script, produce any standard output, or write any files to its designated workspace. This indicates a fundamental issue with the OpenClaw subagent runtime's environment setup or process management for this specific agent.

Steps to Reproduce:

  1. Ensure the cad subagent is configured as above, with the provided agent.sh script in /home/kelvin/.openclaw/agents/cad/agent/ and made executable (chmod +x).
  2. From the main agent, execute the following command: sessions_spawn(agentId='cad', mode='run', runtime='subagent', task='Test message for CAD agent.')
  3. After the subagent's completion event (which reports "no output"), attempt to read the test_output.txt file from the cad subagent's workspace: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will fail, reporting "No such file or directory")
  4. (Optional for comparison) Manually execute the agent.sh script from the main agent, simulating the subagent's environment: cd /home/kelvin/.openclaw/workspace-cad && export TASK='Manual script execution test' && /home/kelvin/.openclaw/agents/cad/agent/agent.sh 2>&1
  5. After manual execution, verify the test_output.txt file and its contents: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will succeed, showing the script's output and current working directory)

Expected Behavior: When the cad subagent is spawned, its agent.sh script should execute, produce standard output (which should be returned to the parent session), and successfully create/write to files within its /home/kelvin/.openclaw/workspace-cad directory.

Actual Behavior: The cad subagent, when spawned, returns "no output". No files (test_output.txt or output.txt) are created or written to within /home/kelvin/.openclaw/workspace-cad, indicating that the agent.sh script is not executing at all within the subagent runtime.

Diagnostics Performed:

  • Confirmed agent.sh script exists and is executable.
  • Confirmed cad subagent is listed in openclaw.json as an allowed agent.
  • Attempted to run echo commands and detailed debugging scripts within agent.sh, with and without exec &> "$OUTPUT_FILE" redirection. All attempts resulted in "no output" from the subagent and no file creation.
  • Crucially, when agent.sh was executed directly from the main agent (simulating the subagent's environment with cd and export TASK), it executed successfully, produced output, and created test_output.txt in /home/kelvin/.openclaw/workspace-cad/ with the correct content and permissions.

Root Cause (Identified): The issue is not with the agent.sh script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the cad agent's script or capture its stdout/stderr when spawned via sessions_spawn with runtime="subagent". It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Workaround: Currently, CAD tasks are successfully performed by the main agent directly executing write-scad and render-scad tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.


You can copy and paste this text to submit your bug report. Please remember to fill in your current OpenClaw version at the top.

Root Cause

Root Cause (Identified): The issue is not with the agent.sh script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the cad agent's script or capture its stdout/stderr when spawned via sessions_spawn with runtime="subagent". It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Fix Action

Fix / Workaround

Workaround: Currently, CAD tasks are successfully performed by the main agent directly executing write-scad and render-scad tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.


Workaround:
Currently, CAD tasks are successfully performed by the main agent directly executing `write-scad` and `render-scad` tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.

Workaround: Currently, CAD tasks are successfully performed by the main agent directly executing write-scad and render-scad tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.

Code Example

{
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }

---

#!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail

    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp

---

You can copy and paste this text to submit your bug report. Please remember to fill in your current OpenClaw version at the top.

### Steps to reproduce



Environment:
*   OpenClaw Version: (Please provide your current OpenClaw version, e.g., 'openclaw status' output)
*   Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
*   User: Kelvin
*   `cad` Subagent Configuration (from `openclaw.json`):

---

*   `cad` Subagent `agent.sh` content (latest test version):

---

Issue Description:
The `cad` subagent, when spawned using `sessions_spawn` with `runtime="subagent"`, fails to execute its `agent.sh` script, produce any standard output, or write any files to its designated workspace. This indicates a fundamental issue with the OpenClaw subagent runtime's environment setup or process management for this specific agent.

Steps to Reproduce:
1.  Ensure the `cad` subagent is configured as above, with the provided `agent.sh` script in `/home/kelvin/.openclaw/agents/cad/agent/` and made executable (`chmod +x`).
2.  From the main agent, execute the following command:
    `sessions_spawn(agentId='cad', mode='run', runtime='subagent', task='Test message for CAD agent.')`
3.  After the subagent's completion event (which reports "no output"), attempt to read the `test_output.txt` file from the `cad` subagent's workspace:
    `cat /home/kelvin/.openclaw/workspace-cad/test_output.txt`
    (This command will fail, reporting "No such file or directory")
4.  (Optional for comparison) Manually execute the `agent.sh` script from the main agent, simulating the subagent's environment:
    `cd /home/kelvin/.openclaw/workspace-cad && export TASK='Manual script execution test' && /home/kelvin/.openclaw/agents/cad/agent/agent.sh 2>&1`
5.  After manual execution, verify the `test_output.txt` file and its contents:
    `cat /home/kelvin/.openclaw/workspace-cad/test_output.txt`
    (This command will succeed, showing the script's output and current working directory)

Expected Behavior:
When the `cad` subagent is spawned, its `agent.sh` script should execute, produce standard output (which should be returned to the parent session), and successfully create/write to files within its `/home/kelvin/.openclaw/workspace-cad` directory.

Actual Behavior:
The `cad` subagent, when spawned, returns "no output". No files (`test_output.txt` or `output.txt`) are created or written to within `/home/kelvin/.openclaw/workspace-cad`, indicating that the `agent.sh` script is not executing at all within the subagent runtime.

Diagnostics Performed:
*   Confirmed `agent.sh` script exists and is executable.
*   Confirmed `cad` subagent is listed in `openclaw.json` as an allowed agent.
*   Attempted to run `echo` commands and detailed debugging scripts within `agent.sh`, with and without `exec &> "$OUTPUT_FILE"` redirection. All attempts resulted in "no output" from the subagent and no file creation.
*   Crucially, when `agent.sh` was executed directly from the main agent (simulating the subagent's environment with `cd` and `export TASK`), it executed successfully, produced output, and created `test_output.txt` in `/home/kelvin/.openclaw/workspace-cad/` with the correct content and permissions.

Root Cause (Identified):
The issue is not with the `agent.sh` script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the `cad` agent's script or capture its `stdout`/`stderr` when spawned via `sessions_spawn` with `runtime="subagent"`. It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Workaround:
Currently, CAD tasks are successfully performed by the main agent directly executing `write-scad` and `render-scad` tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.

---

{
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }

---

#!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail

    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp

---

You can copy and paste this text to submit your bug report. Please remember to fill in your current OpenClaw version at the top.

### Actual behavior



Environment:
*   OpenClaw Version: (Please provide your current OpenClaw version, e.g., 'openclaw status' output)
*   Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
*   User: Kelvin
*   `cad` Subagent Configuration (from `openclaw.json`):

---

*   `cad` Subagent `agent.sh` content (latest test version):

---

Issue Description:
The `cad` subagent, when spawned using `sessions_spawn` with `runtime="subagent"`, fails to execute its `agent.sh` script, produce any standard output, or write any files to its designated workspace. This indicates a fundamental issue with the OpenClaw subagent runtime's environment setup or process management for this specific agent.

Steps to Reproduce:
1.  Ensure the `cad` subagent is configured as above, with the provided `agent.sh` script in `/home/kelvin/.openclaw/agents/cad/agent/` and made executable (`chmod +x`).
2.  From the main agent, execute the following command:
    `sessions_spawn(agentId='cad', mode='run', runtime='subagent', task='Test message for CAD agent.')`
3.  After the subagent's completion event (which reports "no output"), attempt to read the `test_output.txt` file from the `cad` subagent's workspace:
    `cat /home/kelvin/.openclaw/workspace-cad/test_output.txt`
    (This command will fail, reporting "No such file or directory")
4.  (Optional for comparison) Manually execute the `agent.sh` script from the main agent, simulating the subagent's environment:
    `cd /home/kelvin/.openclaw/workspace-cad && export TASK='Manual script execution test' && /home/kelvin/.openclaw/agents/cad/agent/agent.sh 2>&1`
5.  After manual execution, verify the `test_output.txt` file and its contents:
    `cat /home/kelvin/.openclaw/workspace-cad/test_output.txt`
    (This command will succeed, showing the script's output and current working directory)

Expected Behavior:
When the `cad` subagent is spawned, its `agent.sh` script should execute, produce standard output (which should be returned to the parent session), and successfully create/write to files within its `/home/kelvin/.openclaw/workspace-cad` directory.

Actual Behavior:
The `cad` subagent, when spawned, returns "no output". No files (`test_output.txt` or `output.txt`) are created or written to within `/home/kelvin/.openclaw/workspace-cad`, indicating that the `agent.sh` script is not executing at all within the subagent runtime.

Diagnostics Performed:
*   Confirmed `agent.sh` script exists and is executable.
*   Confirmed `cad` subagent is listed in `openclaw.json` as an allowed agent.
*   Attempted to run `echo` commands and detailed debugging scripts within `agent.sh`, with and without `exec &> "$OUTPUT_FILE"` redirection. All attempts resulted in "no output" from the subagent and no file creation.
*   Crucially, when `agent.sh` was executed directly from the main agent (simulating the subagent's environment with `cd` and `export TASK`), it executed successfully, produced output, and created `test_output.txt` in `/home/kelvin/.openclaw/workspace-cad/` with the correct content and permissions.

Root Cause (Identified):
The issue is not with the `agent.sh` script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the `cad` agent's script or capture its `stdout`/`stderr` when spawned via `sessions_spawn` with `runtime="subagent"`. It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Workaround:
Currently, CAD tasks are successfully performed by the main agent directly executing `write-scad` and `render-scad` tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.

---



---

{
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }

---

#!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail

    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

Environment:

  • OpenClaw Version: (Please provide your current OpenClaw version, e.g., 'openclaw status' output)
  • Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
  • User: Kelvin
  • cad Subagent Configuration (from openclaw.json):
    {
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }
  • cad Subagent agent.sh content (latest test version):
    #!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail
    
    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp

Issue Description: The cad subagent, when spawned using sessions_spawn with runtime="subagent", fails to execute its agent.sh script, produce any standard output, or write any files to its designated workspace. This indicates a fundamental issue with the OpenClaw subagent runtime's environment setup or process management for this specific agent.

Steps to Reproduce:

  1. Ensure the cad subagent is configured as above, with the provided agent.sh script in /home/kelvin/.openclaw/agents/cad/agent/ and made executable (chmod +x).
  2. From the main agent, execute the following command: sessions_spawn(agentId='cad', mode='run', runtime='subagent', task='Test message for CAD agent.')
  3. After the subagent's completion event (which reports "no output"), attempt to read the test_output.txt file from the cad subagent's workspace: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will fail, reporting "No such file or directory")
  4. (Optional for comparison) Manually execute the agent.sh script from the main agent, simulating the subagent's environment: cd /home/kelvin/.openclaw/workspace-cad && export TASK='Manual script execution test' && /home/kelvin/.openclaw/agents/cad/agent/agent.sh 2>&1
  5. After manual execution, verify the test_output.txt file and its contents: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will succeed, showing the script's output and current working directory)

Expected Behavior: When the cad subagent is spawned, its agent.sh script should execute, produce standard output (which should be returned to the parent session), and successfully create/write to files within its /home/kelvin/.openclaw/workspace-cad directory.

Actual Behavior: The cad subagent, when spawned, returns "no output". No files (test_output.txt or output.txt) are created or written to within /home/kelvin/.openclaw/workspace-cad, indicating that the agent.sh script is not executing at all within the subagent runtime.

Diagnostics Performed:

  • Confirmed agent.sh script exists and is executable.
  • Confirmed cad subagent is listed in openclaw.json as an allowed agent.
  • Attempted to run echo commands and detailed debugging scripts within agent.sh, with and without exec &> "$OUTPUT_FILE" redirection. All attempts resulted in "no output" from the subagent and no file creation.
  • Crucially, when agent.sh was executed directly from the main agent (simulating the subagent's environment with cd and export TASK), it executed successfully, produced output, and created test_output.txt in /home/kelvin/.openclaw/workspace-cad/ with the correct content and permissions.

Root Cause (Identified): The issue is not with the agent.sh script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the cad agent's script or capture its stdout/stderr when spawned via sessions_spawn with runtime="subagent". It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Workaround: Currently, CAD tasks are successfully performed by the main agent directly executing write-scad and render-scad tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.


You can copy and paste this text to submit your bug report. Please remember to fill in your current OpenClaw version at the top.

### Steps to reproduce



Environment:
*   OpenClaw Version: (Please provide your current OpenClaw version, e.g., 'openclaw status' output)
*   Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
*   User: Kelvin
*   `cad` Subagent Configuration (from `openclaw.json`):
    ```json
    {
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }
    ```
*   `cad` Subagent `agent.sh` content (latest test version):
    ```bash
    #!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail

    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp
    ```

Issue Description:
The `cad` subagent, when spawned using `sessions_spawn` with `runtime="subagent"`, fails to execute its `agent.sh` script, produce any standard output, or write any files to its designated workspace. This indicates a fundamental issue with the OpenClaw subagent runtime's environment setup or process management for this specific agent.

Steps to Reproduce:
1.  Ensure the `cad` subagent is configured as above, with the provided `agent.sh` script in `/home/kelvin/.openclaw/agents/cad/agent/` and made executable (`chmod +x`).
2.  From the main agent, execute the following command:
    `sessions_spawn(agentId='cad', mode='run', runtime='subagent', task='Test message for CAD agent.')`
3.  After the subagent's completion event (which reports "no output"), attempt to read the `test_output.txt` file from the `cad` subagent's workspace:
    `cat /home/kelvin/.openclaw/workspace-cad/test_output.txt`
    (This command will fail, reporting "No such file or directory")
4.  (Optional for comparison) Manually execute the `agent.sh` script from the main agent, simulating the subagent's environment:
    `cd /home/kelvin/.openclaw/workspace-cad && export TASK='Manual script execution test' && /home/kelvin/.openclaw/agents/cad/agent/agent.sh 2>&1`
5.  After manual execution, verify the `test_output.txt` file and its contents:
    `cat /home/kelvin/.openclaw/workspace-cad/test_output.txt`
    (This command will succeed, showing the script's output and current working directory)

Expected Behavior:
When the `cad` subagent is spawned, its `agent.sh` script should execute, produce standard output (which should be returned to the parent session), and successfully create/write to files within its `/home/kelvin/.openclaw/workspace-cad` directory.

Actual Behavior:
The `cad` subagent, when spawned, returns "no output". No files (`test_output.txt` or `output.txt`) are created or written to within `/home/kelvin/.openclaw/workspace-cad`, indicating that the `agent.sh` script is not executing at all within the subagent runtime.

Diagnostics Performed:
*   Confirmed `agent.sh` script exists and is executable.
*   Confirmed `cad` subagent is listed in `openclaw.json` as an allowed agent.
*   Attempted to run `echo` commands and detailed debugging scripts within `agent.sh`, with and without `exec &> "$OUTPUT_FILE"` redirection. All attempts resulted in "no output" from the subagent and no file creation.
*   Crucially, when `agent.sh` was executed directly from the main agent (simulating the subagent's environment with `cd` and `export TASK`), it executed successfully, produced output, and created `test_output.txt` in `/home/kelvin/.openclaw/workspace-cad/` with the correct content and permissions.

Root Cause (Identified):
The issue is not with the `agent.sh` script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the `cad` agent's script or capture its `stdout`/`stderr` when spawned via `sessions_spawn` with `runtime="subagent"`. It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Workaround:
Currently, CAD tasks are successfully performed by the main agent directly executing `write-scad` and `render-scad` tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.

You can copy and paste this text to submit your bug report. Please remember to fill in your current OpenClaw version at the top.

Expected behavior

Environment:

  • OpenClaw Version: (Please provide your current OpenClaw version, e.g., 'openclaw status' output)
  • Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
  • User: Kelvin
  • cad Subagent Configuration (from openclaw.json):
    {
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }
  • cad Subagent agent.sh content (latest test version):
    #!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail
    
    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp

Issue Description: The cad subagent, when spawned using sessions_spawn with runtime="subagent", fails to execute its agent.sh script, produce any standard output, or write any files to its designated workspace. This indicates a fundamental issue with the OpenClaw subagent runtime's environment setup or process management for this specific agent.

Steps to Reproduce:

  1. Ensure the cad subagent is configured as above, with the provided agent.sh script in /home/kelvin/.openclaw/agents/cad/agent/ and made executable (chmod +x).
  2. From the main agent, execute the following command: sessions_spawn(agentId='cad', mode='run', runtime='subagent', task='Test message for CAD agent.')
  3. After the subagent's completion event (which reports "no output"), attempt to read the test_output.txt file from the cad subagent's workspace: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will fail, reporting "No such file or directory")
  4. (Optional for comparison) Manually execute the agent.sh script from the main agent, simulating the subagent's environment: cd /home/kelvin/.openclaw/workspace-cad && export TASK='Manual script execution test' && /home/kelvin/.openclaw/agents/cad/agent/agent.sh 2>&1
  5. After manual execution, verify the test_output.txt file and its contents: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will succeed, showing the script's output and current working directory)

Expected Behavior: When the cad subagent is spawned, its agent.sh script should execute, produce standard output (which should be returned to the parent session), and successfully create/write to files within its /home/kelvin/.openclaw/workspace-cad directory.

Actual Behavior: The cad subagent, when spawned, returns "no output". No files (test_output.txt or output.txt) are created or written to within /home/kelvin/.openclaw/workspace-cad, indicating that the agent.sh script is not executing at all within the subagent runtime.

Diagnostics Performed:

  • Confirmed agent.sh script exists and is executable.
  • Confirmed cad subagent is listed in openclaw.json as an allowed agent.
  • Attempted to run echo commands and detailed debugging scripts within agent.sh, with and without exec &> "$OUTPUT_FILE" redirection. All attempts resulted in "no output" from the subagent and no file creation.
  • Crucially, when agent.sh was executed directly from the main agent (simulating the subagent's environment with cd and export TASK), it executed successfully, produced output, and created test_output.txt in /home/kelvin/.openclaw/workspace-cad/ with the correct content and permissions.

Root Cause (Identified): The issue is not with the agent.sh script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the cad agent's script or capture its stdout/stderr when spawned via sessions_spawn with runtime="subagent". It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Workaround: Currently, CAD tasks are successfully performed by the main agent directly executing write-scad and render-scad tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.


You can copy and paste this text to submit your bug report. Please remember to fill in your current OpenClaw version at the top.

### Actual behavior



Environment:
*   OpenClaw Version: (Please provide your current OpenClaw version, e.g., 'openclaw status' output)
*   Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
*   User: Kelvin
*   `cad` Subagent Configuration (from `openclaw.json`):
    ```json
    {
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }
    ```
*   `cad` Subagent `agent.sh` content (latest test version):
    ```bash
    #!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail

    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp
    ```

Issue Description:
The `cad` subagent, when spawned using `sessions_spawn` with `runtime="subagent"`, fails to execute its `agent.sh` script, produce any standard output, or write any files to its designated workspace. This indicates a fundamental issue with the OpenClaw subagent runtime's environment setup or process management for this specific agent.

Steps to Reproduce:
1.  Ensure the `cad` subagent is configured as above, with the provided `agent.sh` script in `/home/kelvin/.openclaw/agents/cad/agent/` and made executable (`chmod +x`).
2.  From the main agent, execute the following command:
    `sessions_spawn(agentId='cad', mode='run', runtime='subagent', task='Test message for CAD agent.')`
3.  After the subagent's completion event (which reports "no output"), attempt to read the `test_output.txt` file from the `cad` subagent's workspace:
    `cat /home/kelvin/.openclaw/workspace-cad/test_output.txt`
    (This command will fail, reporting "No such file or directory")
4.  (Optional for comparison) Manually execute the `agent.sh` script from the main agent, simulating the subagent's environment:
    `cd /home/kelvin/.openclaw/workspace-cad && export TASK='Manual script execution test' && /home/kelvin/.openclaw/agents/cad/agent/agent.sh 2>&1`
5.  After manual execution, verify the `test_output.txt` file and its contents:
    `cat /home/kelvin/.openclaw/workspace-cad/test_output.txt`
    (This command will succeed, showing the script's output and current working directory)

Expected Behavior:
When the `cad` subagent is spawned, its `agent.sh` script should execute, produce standard output (which should be returned to the parent session), and successfully create/write to files within its `/home/kelvin/.openclaw/workspace-cad` directory.

Actual Behavior:
The `cad` subagent, when spawned, returns "no output". No files (`test_output.txt` or `output.txt`) are created or written to within `/home/kelvin/.openclaw/workspace-cad`, indicating that the `agent.sh` script is not executing at all within the subagent runtime.

Diagnostics Performed:
*   Confirmed `agent.sh` script exists and is executable.
*   Confirmed `cad` subagent is listed in `openclaw.json` as an allowed agent.
*   Attempted to run `echo` commands and detailed debugging scripts within `agent.sh`, with and without `exec &> "$OUTPUT_FILE"` redirection. All attempts resulted in "no output" from the subagent and no file creation.
*   Crucially, when `agent.sh` was executed directly from the main agent (simulating the subagent's environment with `cd` and `export TASK`), it executed successfully, produced output, and created `test_output.txt` in `/home/kelvin/.openclaw/workspace-cad/` with the correct content and permissions.

Root Cause (Identified):
The issue is not with the `agent.sh` script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the `cad` agent's script or capture its `stdout`/`stderr` when spawned via `sessions_spawn` with `runtime="subagent"`. It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Workaround:
Currently, CAD tasks are successfully performed by the main agent directly executing `write-scad` and `render-scad` tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.

You can copy and paste this text to submit your bug report. Please remember to fill in your current OpenClaw version at the top.

OpenClaw version

2026.3.13

Operating system

linux 6.6.87.2

Install method

docker

Model

deepseek

Provider / routing chain

not no

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

Environment:

  • OpenClaw Version: (Please provide your current OpenClaw version, e.g., 'openclaw status' output)
  • Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
  • User: Kelvin
  • cad Subagent Configuration (from openclaw.json):
    {
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }
  • cad Subagent agent.sh content (latest test version):
    #!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail
    
    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp

Issue Description: The cad subagent, when spawned using sessions_spawn with runtime="subagent", fails to execute its agent.sh script, produce any standard output, or write any files to its designated workspace. This indicates a fundamental issue with the OpenClaw subagent runtime's environment setup or process management for this specific agent.

Steps to Reproduce:

  1. Ensure the cad subagent is configured as above, with the provided agent.sh script in /home/kelvin/.openclaw/agents/cad/agent/ and made executable (chmod +x).
  2. From the main agent, execute the following command: sessions_spawn(agentId='cad', mode='run', runtime='subagent', task='Test message for CAD agent.')
  3. After the subagent's completion event (which reports "no output"), attempt to read the test_output.txt file from the cad subagent's workspace: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will fail, reporting "No such file or directory")
  4. (Optional for comparison) Manually execute the agent.sh script from the main agent, simulating the subagent's environment: cd /home/kelvin/.openclaw/workspace-cad && export TASK='Manual script execution test' && /home/kelvin/.openclaw/agents/cad/agent/agent.sh 2>&1
  5. After manual execution, verify the test_output.txt file and its contents: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will succeed, showing the script's output and current working directory)

Expected Behavior: When the cad subagent is spawned, its agent.sh script should execute, produce standard output (which should be returned to the parent session), and successfully create/write to files within its /home/kelvin/.openclaw/workspace-cad directory.

Actual Behavior: The cad subagent, when spawned, returns "no output". No files (test_output.txt or output.txt) are created or written to within /home/kelvin/.openclaw/workspace-cad, indicating that the agent.sh script is not executing at all within the subagent runtime.

Diagnostics Performed:

  • Confirmed agent.sh script exists and is executable.
  • Confirmed cad subagent is listed in openclaw.json as an allowed agent.
  • Attempted to run echo commands and detailed debugging scripts within agent.sh, with and without exec &> "$OUTPUT_FILE" redirection. All attempts resulted in "no output" from the subagent and no file creation.
  • Crucially, when agent.sh was executed directly from the main agent (simulating the subagent's environment with cd and export TASK), it executed successfully, produced output, and created test_output.txt in /home/kelvin/.openclaw/workspace-cad/ with the correct content and permissions.

Root Cause (Identified): The issue is not with the agent.sh script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the cad agent's script or capture its stdout/stderr when spawned via sessions_spawn with runtime="subagent". It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Workaround: Currently, CAD tasks are successfully performed by the main agent directly executing write-scad and render-scad tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.


You can copy and paste this text to submit your bug report. Please remember to fill in your current OpenClaw version at the top.

extent analysis

Fix Plan

To resolve the issue with the cad subagent failing to execute its agent.sh script when spawned using sessions_spawn with runtime="subagent", follow these steps:

  1. Verify Subagent Configuration: Ensure the cad subagent is correctly configured in openclaw.json with the necessary fields (id, name, workspace, agentDir, and model).
  2. Check Script Executability: Confirm that the agent.sh script is executable by running chmod +x /home/kelvin/.openclaw/agents/cad/agent/agent.sh.
  3. Environment Variable Setup: Before executing the agent.sh script, ensure the TASK environment variable is set. This can be done by modifying the sessions_spawn command to include environment variable setup or by modifying the agent.sh script to handle the case when TASK is not set.
  4. Subagent Runtime Environment: Investigate the environment setup for the subagent runtime. Ensure that the working directory is correctly set to the subagent's workspace (/home/kelvin/.openclaw/workspace-cad) before executing the agent.sh script.
  5. Capture stdout/stderr: Modify the agent.sh script to capture both stdout and stderr to ensure that any output or errors are properly logged and visible.

Example modifications to the agent.sh script to capture stdout and stderr and handle the TASK environment variable:

#!/usr/bin/env bash
set -euo pipefail

TEST_FILE="test_output.txt"
pwd > "$TEST_FILE" # Write current working directory to the test file

# Check if TASK environment variable is set
if [ -z "${TASK}" ]; then
  echo "TASK environment variable is not set." >> "$TEST_FILE"
else
  echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
fi

echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp

# Capture stdout and stderr
exec &> "$TEST_FILE"

Verification

To verify that the fix worked:

  1. Spawn the cad subagent using sessions_spawn with the modified agent.sh script.
  2. Check the test_output.txt file in the subagent's workspace for the expected output, including the task message and timestamp.
  3. Verify that the TASK environment variable is correctly set and used within the agent.sh script.

Extra Tips

  • Ensure all dependencies and required tools are correctly installed and configured for the cad subagent.
  • Regularly review and update the openclaw.json configuration to reflect any changes in subagent setups or dependencies.
  • Consider implementing additional logging and monitoring for sub

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

Environment:

  • OpenClaw Version: (Please provide your current OpenClaw version, e.g., 'openclaw status' output)
  • Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (x64)
  • User: Kelvin
  • cad Subagent Configuration (from openclaw.json):
    {
      "id": "cad",
      "name": "cad",
      "workspace": "/home/kelvin/.openclaw/workspace-cad",
      "agentDir": "/home/kelvin/.openclaw/agents/cad/agent",
      "model": "ollama/deepseek-coder:latest"
    }
  • cad Subagent agent.sh content (latest test version):
    #!/usr/bin/env bash
    # agent.sh for cad subagent - Minimal File Write Test
    set -euo pipefail
    
    TEST_FILE="test_output.txt"
    pwd > "$TEST_FILE" # Write current working directory to the test file
    echo "CAD Agent task received: ${TASK}" | tee -a "$TEST_FILE" # Append task to the test file
    echo "Script executed at $(date)" | tee -a "$TEST_FILE" # Append timestamp

Issue Description: The cad subagent, when spawned using sessions_spawn with runtime="subagent", fails to execute its agent.sh script, produce any standard output, or write any files to its designated workspace. This indicates a fundamental issue with the OpenClaw subagent runtime's environment setup or process management for this specific agent.

Steps to Reproduce:

  1. Ensure the cad subagent is configured as above, with the provided agent.sh script in /home/kelvin/.openclaw/agents/cad/agent/ and made executable (chmod +x).
  2. From the main agent, execute the following command: sessions_spawn(agentId='cad', mode='run', runtime='subagent', task='Test message for CAD agent.')
  3. After the subagent's completion event (which reports "no output"), attempt to read the test_output.txt file from the cad subagent's workspace: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will fail, reporting "No such file or directory")
  4. (Optional for comparison) Manually execute the agent.sh script from the main agent, simulating the subagent's environment: cd /home/kelvin/.openclaw/workspace-cad && export TASK='Manual script execution test' && /home/kelvin/.openclaw/agents/cad/agent/agent.sh 2>&1
  5. After manual execution, verify the test_output.txt file and its contents: cat /home/kelvin/.openclaw/workspace-cad/test_output.txt (This command will succeed, showing the script's output and current working directory)

Expected Behavior: When the cad subagent is spawned, its agent.sh script should execute, produce standard output (which should be returned to the parent session), and successfully create/write to files within its /home/kelvin/.openclaw/workspace-cad directory.

Actual Behavior: The cad subagent, when spawned, returns "no output". No files (test_output.txt or output.txt) are created or written to within /home/kelvin/.openclaw/workspace-cad, indicating that the agent.sh script is not executing at all within the subagent runtime.

Diagnostics Performed:

  • Confirmed agent.sh script exists and is executable.
  • Confirmed cad subagent is listed in openclaw.json as an allowed agent.
  • Attempted to run echo commands and detailed debugging scripts within agent.sh, with and without exec &> "$OUTPUT_FILE" redirection. All attempts resulted in "no output" from the subagent and no file creation.
  • Crucially, when agent.sh was executed directly from the main agent (simulating the subagent's environment with cd and export TASK), it executed successfully, produced output, and created test_output.txt in /home/kelvin/.openclaw/workspace-cad/ with the correct content and permissions.

Root Cause (Identified): The issue is not with the agent.sh script's content, its executability, or directory permissions. The problem lies within OpenClaw's subagent runtime, which is failing to properly execute the cad agent's script or capture its stdout/stderr when spawned via sessions_spawn with runtime="subagent". It appears the subagent's process is either not being initiated correctly or is being isolated in a way that prevents any communication or filesystem interaction.

Workaround: Currently, CAD tasks are successfully performed by the main agent directly executing write-scad and render-scad tools, as demonstrated by the creation of 20mm cube and Samsung S23 phone stand models.


You can copy and paste this text to submit your bug report. Please remember to fill in your current OpenClaw version at the top.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: subagent failed to execute or produce output [2 comments, 3 participants]