From f01c23ad407ad1b87ad5a00bca1e44100e6fcde0 Mon Sep 17 00:00:00 2001 From: RC-CHN <1051989940@qq.com> Date: Thu, 26 Feb 2026 10:33:22 +0800 Subject: [PATCH] fix(agent): enforce relative paths for neo sandbox tools append a Shipyard Neo-specific system prompt note for filesystem tool calls so paths are provided relative to the workspace root. this prevents models from prepending `/workspace` and causing tool path resolution failures --- astrbot/core/astr_main_agent.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/astrbot/core/astr_main_agent.py b/astrbot/core/astr_main_agent.py index c8da25a1b..216c73909 100644 --- a/astrbot/core/astr_main_agent.py +++ b/astrbot/core/astr_main_agent.py @@ -831,6 +831,15 @@ def _apply_sandbox_tools( req.func_tool.add_tool(FILE_DOWNLOAD_TOOL) if booter == "shipyard_neo": + # Neo-specific path rule: filesystem tools operate relative to sandbox + # workspace root. Do not prepend "/workspace". + req.system_prompt += ( + "\n[Shipyard Neo File Path Rule]\n" + "When using sandbox filesystem tools (upload/download/read/write/list/delete), " + "always pass paths relative to the sandbox workspace root. " + "Example: use `baidu_homepage.png` instead of `/workspace/baidu_homepage.png`.\n" + ) + # Determine sandbox capabilities from an already-booted session. # If no session exists yet (first request), capabilities is None # and we register all tools conservatively.