Skip to content

fix(editor): normalize paths for consistent cache keys#503

Open
wangwangbobo wants to merge 1 commit into
strands-agents:mainfrom
wangwangbobo:fix/editor-cache-path-normalization
Open

fix(editor): normalize paths for consistent cache keys#503
wangwangbobo wants to merge 1 commit into
strands-agents:mainfrom
wangwangbobo:fix/editor-cache-path-normalization

Conversation

@wangwangbobo

Copy link
Copy Markdown
Contributor

Summary

Fix editor tool cache using non-normalized paths (fixes #345).

Problem

The editor tool cache uses raw path strings as keys, so the same file accessed via relative vs absolute paths creates separate cache entries. This causes stale content to be returned after modifications.

Solution

Normalize paths with at the start of the editor function, ensuring consistent cache keys regardless of path format.

Changes

  • : Changed line 317 from to

Impact

  • Agents no longer retry edits unnecessarily due to stale cache content
  • Consistent behavior regardless of how paths are specified (relative vs absolute)
  • Single line change, low risk

Use os.path.abspath() alongside expanduser() to ensure the same file
always maps to the same cache key, regardless of relative vs absolute
path format. Fixes strands-agents#345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] editor tool cache uses non-normalized paths

1 participant