FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[Bug] `@file` mentions cannot find files inside symlinked directories · Issue #29080 · anomalyco/opencode · GitHub

[Bug] @file mentions cannot find files inside symlinked directories #29080

Description

Description

@file mentions cannot find or autocomplete any files located inside symlinked directories within the workspace. This makes it impossible to reference files via @file if they reside in a symlinked subtree.

For example, in a project like:

workspace/
  .agents-global/  →  /Users/user/.agents/    (symlink)
    skills/
      skill-foo/SKILL.md

Typing @file .agents-global/skills/skill-foo/SKILL.md does not resolve or autocomplete the file. The same issue applies to any symlinked directory — files are simply missing from the search index.

Root Cause

The file search cache is built by File.scan() which calls rg.files({ cwd: ctx.directory }) without the follow option. Ripgrep by default does not traverse symlinked directories unless --follow is explicitly passed.

Affected code paths:

  • packages/opencode/src/file/index.ts:378 — rg.files({ cwd }) missing follow: true
  • packages/opencode/src/file/ripgrep.ts:199-210 — filesArgs() only adds --follow when input.follow is truthy
  • packages/opencode/src/file/index.ts:570-610 — list() maps symlink entries as "file" not "directory", so symlinked dirs also can't be browsed in the file tree

Suggested Fix

Add follow: true to the rg.files() call in scan():

// file/index.ts line 378
const files = yield* rg.files({ cwd: ctx.directory, follow: true }).pipe(

Plugins

No response

OpenCode version

1.15.10

Steps to reproduce

  1. Create a symlink inside an OpenCode workspace:

    cd /path/to/workspace
    ln -s /some/external/directory my-symlink
    
  2. Open the workspace in OpenCode.

  3. In the chat input, type @file my-symlink/ and observe no autocomplete suggestions for files within.

  4. Try to reference a specific file: @file my-symlink/foo.ts — the file is not found/attached.

Screenshot and/or share link

No response

Operating System

macOS 15.6 (Darwin 24.6.0 x86_64)

Terminal

Ghostty (xterm-ghostty)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL