-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Description
Problem
The Edit tool (used for precise file edits) does not expand ~ in file_path/path parameters. This causes File not found errors when targeting files like ~/.codex/config.toml.
Other tools handle this fine:
exec— shell expands~naturallyRead— resolves~to$HOME
The Edit tool bypasses shell expansion, so ~ is treated as a literal character.
Impact
- Agents have a SOUL.md rule saying "never use
~in tool calls" but it's not sticky across sessions — the error recurs regularly - LLMs naturally generate
~paths since it's standard Unix convention - Every occurrence wastes a tool call (Edit fails → fallback to
sedor retry with absolute path)
Expected behavior
Edit should resolve ~ to $HOME (or the agent's home directory) before attempting the file operation, consistent with Read and other file-access tools.
Reproduction
Edit(file_path="~/.codex/config.toml", old_string="foo", new_string="bar")
→ Error: File not found: ~/.codex/config.toml
Works fine with absolute path:
Edit(file_path="/home/user/.codex/config.toml", old_string="foo", new_string="bar")
→ Success
Environment
- OpenClaw v2026.2.19-2
- Ubuntu 24.04 (WSL2)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels