[PR #7015] fix(core): normalize file paths in read tool output #12204

Open
opened 2026-02-16 18:17:07 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7015

State: open
Merged: No


Closes #12394

Summary

  • Show clean relative paths for files inside the worktree
  • Show absolute paths for files outside the worktree instead of ugly ../../../../../../ paths

Changes

Modified the read tool to check if a file is within the worktree before deciding how to display the path:

  • Inside worktree: Show relative path (e.g., src/tool/read.ts)
  • Outside worktree: Show absolute path (e.g., /home/user/other/file.ts)

This improves UX by avoiding confusing paths like read ../../../../../../home/scarf/foo/bar/baz.ts.

Testing

Verified that lsp_diagnostics passes on the modified file.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7015 **State:** open **Merged:** No --- Closes #12394 ## Summary - Show clean relative paths for files inside the worktree - Show absolute paths for files outside the worktree instead of ugly `../../../../../../` paths ## Changes Modified the read tool to check if a file is within the worktree before deciding how to display the path: - **Inside worktree**: Show relative path (e.g., `src/tool/read.ts`) - **Outside worktree**: Show absolute path (e.g., `/home/user/other/file.ts`) This improves UX by avoiding confusing paths like `read ../../../../../../home/scarf/foo/bar/baz.ts`. ## Testing Verified that `lsp_diagnostics` passes on the modified file.
yindo added the pull-request label 2026-02-16 18:17:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12204