Skip to content

fix(opencode): preserve grep symlink paths#38581

Merged
rekram1-node merged 1 commit into
anomalyco:devfrom
remixz:grep-symlink-path
Jul 24, 2026
Merged

fix(opencode): preserve grep symlink paths#38581
rekram1-node merged 1 commit into
anomalyco:devfrom
remixz:grep-symlink-path

Conversation

@remixz

@remixz remixz commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #38582

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Grep canonicalized symlinked search paths and returned the real target path in its output. Subsequent tool calls could then fail external-directory permission checks configured for the original symlink path.

This keeps the canonical path for running ripgrep, but formats results relative to the path requested by the user.

How did you verify your code works?

Added regression coverage for searching through a directory symlink and verified that results contain the symlink path rather than the real path.

Ran bun test test/tool/grep.test.ts and verified with bun dev on a local build that the grep tool did indeed return the resolved path instead of real path.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title grep: Preserve symlink paths doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 24, 2026
@remixz remixz changed the title grep: Preserve symlink paths fix(opencode): preserve grep symlink paths Jul 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Jul 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path reconstruction is scoped correctly: ripgrep still runs against the canonical cwd, while displayed matches are rebased onto the user-requested directory (or its parent for file inputs). The regression assertions cover both sides of the symlink-path invariant. No blocking issues found.

pull Bot pushed a commit to sams-git-195/opencode that referenced this pull request Jul 24, 2026
Co-authored-by: Zach Bruggeman <zbruggeman@ramp.com>
@rekram1-node
rekram1-node merged commit f516651 into anomalyco:dev Jul 24, 2026
17 of 18 checks passed
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.

Grep returns resolved target paths for symlinked directories

2 participants