mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(backend/copilot): use working_dir in prompt examples instead of hardcoded /home/user
The storage supplement template and _persist_and_summarize had hardcoded
/home/user/ paths in save_to_path examples. In local (bubblewrap) mode
the working dir is /tmp/copilot-<session>/, not /home/user/. Use the
{working_dir} template variable in prompting.py and a generic
<working_dir> placeholder in base.py so the model gets correct paths
regardless of execution mode.
This commit is contained in:
@@ -221,7 +221,7 @@ def _build_storage_supplement(
|
||||
|
||||
### Moving files between storages
|
||||
- **{file_move_name_1_to_2}**: `write_workspace_file(filename="output.json", source_path="/path/to/local/file")`
|
||||
- **{file_move_name_2_to_1}**: `read_workspace_file(path="tool-outputs/data.json", save_to_path="/home/user/data.json")`
|
||||
- **{file_move_name_2_to_1}**: `read_workspace_file(path="tool-outputs/data.json", save_to_path="{working_dir}/data.json")`
|
||||
|
||||
### File persistence
|
||||
Important files (code, configs, outputs) should be saved to workspace to ensure they persist.
|
||||
@@ -235,7 +235,7 @@ To read these files, use `Read` — it reads from the host filesystem.
|
||||
When a tool output contains `<tool-output-truncated workspace_path="...">`, the
|
||||
full output is in workspace storage (NOT on the local filesystem). To access it:
|
||||
- Use `read_workspace_file(path="...", offset=..., length=50000)` for reading sections.
|
||||
- To process in the sandbox, use `read_workspace_file(path="...", save_to_path="/home/user/file.json")` first, then use `bash_exec` on the local copy.
|
||||
- To process in the sandbox, use `read_workspace_file(path="...", save_to_path="{working_dir}/file.json")` first, then use `bash_exec` on the local copy.
|
||||
{_SHARED_TOOL_NOTES}{extra_notes}"""
|
||||
|
||||
|
||||
|
||||
@@ -92,9 +92,9 @@ async def _persist_and_summarize(
|
||||
f"Use read_workspace_file("
|
||||
f'path="{file_path}", offset=<char_offset>, length=50000) '
|
||||
f"to read any section. "
|
||||
f"To process the file in the sandbox, use "
|
||||
f"To process the file in the sandbox/working dir, use "
|
||||
f"read_workspace_file("
|
||||
f'path="{file_path}", save_to_path="/home/user/{tool_call_id}.json") '
|
||||
f'path="{file_path}", save_to_path="<working_dir>/{tool_call_id}.json") '
|
||||
f"first, then use bash_exec to work with the local copy."
|
||||
)
|
||||
# Use workspace:// prefix so the model doesn't confuse the workspace path
|
||||
|
||||
Reference in New Issue
Block a user