Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(backend): prevent graph execution stuck + steer SDK away from bash_exec (#12548)

Zamil Majdy336114f21762
diff --git a/autogpt_platform/backend/backend/copilot/prompting.py b/autogpt_platform/backend/backend/copilot/prompting.py
index 816802a2ad..c42179c86d 100644
--- a/autogpt_platform/backend/backend/copilot/prompting.py
+++ b/autogpt_platform/backend/backend/copilot/prompting.py
@@ -205,9 +205,10 @@ Important files (code, configs, outputs) should be saved to workspace to ensure
### SDK tool-result files
When tool outputs are large, the SDK truncates them and saves the full output to
a local file under `~/.claude/projects/.../tool-results/`. To read these files,
-always use `read_file` or `Read` (NOT `read_workspace_file`).
-`read_workspace_file` reads from cloud workspace storage, where SDK
-tool-results are NOT stored.
+always use `Read` (NOT `bash_exec`, NOT `read_workspace_file`).
+These files are on the host filesystem — `bash_exec` runs in the sandbox and
+CANNOT access them. `read_workspace_file` reads from cloud workspace storage,
+where SDK tool-results are NOT stored.
{_SHARED_TOOL_NOTES}{extra_notes}"""
diff --git a/autogpt_platform/backend/backend/data/execution.py b/autogpt_platform/backend/backend/data/execution.py
index 46f8d88c81..f4b341291b 100644
--- a/autogpt_platform/backend/backend/data/execution.py
+++ b/autogpt_platform/backend/backend/data/execution.py
@@ -342,6 +342,7 @@ class GraphExecution(GraphExecutionMeta):
if (
(block := get_block(exec.block_id))
and block.block_type == BlockType.INPUT
+ and "name" in exec.input_data
)
}
),
@@ -360,8 +361,10 @@ class GraphExecution(GraphExecutionMeta):
outputs: CompletedBlockOutput = defaultdict(list)
for exec in complete_node_executions:
if (
- block := get_block(exec.block_id)
- ) and block.block_type == BlockType.OUTPUT:
+ (block := get_block(exec.block_id))
+ and block.block_type == BlockType.OUTPUT
+ and "name" in exec.input_data
+ ):
outputs[exec.input_data["name"]].append(exec.input_data.get("value"))
return GraphExecution(