anomalyco / anomalyco/opencode

@ file mention only searches directory names, never file names

Open
#40,391 0 comments 0 reactions 1 assignee View on GitHub

@Hona is already working on this.

Since Aug 4, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

The @ file mention in the prompt input only fuzzy-matches against directory names — it never matches file names.

Repro

  1. Open any project.
  2. Create a new file, e.g. FooBar.ts.
  3. Type @FooBar in the prompt input.
  4. Expected: FooBar.ts appears in the mention list.
  5. Actual: it does not appear.

Root cause

packages/app/src/context/file.tsx maps searchFilesAndDirectories to the backend find with type: "directory", so the server only searches the directory index.

This is a regression from the v2 migration (feat(app): migrate discovery workflows): the old client find.files({ dirs: true }) searched files + directories, but the new mapping collapsed it to directories only.

Verified against the core search service:

type=file       -> can find the new file
type=directory  -> empty
type=undefined  -> can find it (files + directories mixed)

Related issues

  • #38065, #32747 — @ autocomplete does not detect newly created files. This issue is a distinct code-level cause that also contributes to that symptom (the search only ever queries directory names, so no newly created file is ever matched by filename).

Suggested fix

searchFilesAndDirectories should omit type so the server runs the mixed (file + directory) search; the server find already treats type === undefined as files + directories.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.