Repository navigation
Description
Bug report
Description
new files do not show up in @ file mentions until opencode is restarted.
existing indexed files can be found with @, but files created after startup are missing from the picker. after restart, the same files appear.
code read suggests stale search state: tui @ calls v2.fs.find, then filesystem.find, then filesystemsearch. on windows, opencode_disable_fff defaults to true, so ripgreplayer is used. it builds state.files / state.directories once at startup, and find() fuzzy-searches that cached state. i could not find code that updates this index after new files are created.
Plugins
none.
OpenCode version
1.17.8
Steps to reproduce
- start opencode in a workspace.
- create a new file, e.g.
new-file.md. - type
@new-filein the prompt. - the file is not suggested.
- restart opencode.
- type
@new-fileagain. - the file is suggested.
Expected behavior
new files should appear in @ file mentions without restart.
Actual behavior
new files only appear in @ file mentions after restart.
Regression
this did not happen in older versions. from my testing, 1.15 and 1.16 did not have this issue.
Screenshot and/or share link
n/a.
Operating System
windows 11.
Terminal
windows terminal.
Possible cause
likely stale ripgreplayer state in packages/core/src/filesystem/search.ts.
git history points to a regression path:
- in
v1.16.2,filesystem.findcallsscan()for each request, andscan()runsripgrep.files(...), so newly-created files can be picked up on the next@search. a0409e64d/ refactor(core): unify filesystem search service #31566 (refactor(core): unify filesystem search service) introducedfilesystem/search.tsand aripgreplayerthat buildsstate.files/state.directoriesonce when the location service starts.e4300e9b7(fix(core): disable fff by default on windows) changedopencode_disable_fffto default true on windows, starting inv1.17.2. this makes windows useripgreplayerby default instead of fff.- as a result, on windows
@file search now uses a startup snapshot and misses files created after startup.
relevant files:
packages/tui/src/component/prompt/autocomplete.tsxpackages/core/src/filesystem.tspackages/core/src/filesystem/search.tspackages/core/src/filesystem/watcher.tspackages/core/src/flag/flag.ts
possible fix: update/invalidate ripgreplayer state on file add/unlink watcher events, or rebuild the search index before find().
note: this is based on code inspection, not a runtime trace. external file creation may also be affected by the root watcher being disabled by default, but even when watcher events exist, i could not find code that updates the @ search index.
Related issues checked
- File view not updated immediately, requires restart to show newly created files #22134: similar restart symptom, but about file view, not
@mentions. - Dekstop Windows the newly created file is not updating real time! #26060: similar realtime refresh symptom, closed for missing details.
- Bug: File tree and editor do not auto-refresh when changes are made externally #27333 / File refresh not working in opencode-desktop #28393: file tree/editor refresh issues, not
@search index. - @file autocomplete fails completely on Windows due to path separator mismatch #23144 / @ file mention never shows project files on Windows — only agents (general/explore) appear #28824 / @ file mentions always return "No matching items" even though files are accessible (Windows, v1.16.2) #31075 /
@is not listing the available files #6618:@autocomplete issues where existing files are not listed at all. this issue is narrower: files created after startup are missing until restart.
Activity
ovftank commentedon Jun 17, 2026
extra git check / possible workaround:
this looks like a regression introduced by the new filesystem search service plus the windows fff default.
v1.16.2,filesystem.findcallsscan()per request, andscan()runsripgrep.files(...). so a file created after startup can be seen by the next@search.a0409e64d/ refactor(core): unify filesystem search service #31566 (refactor(core): unify filesystem search service) introducedpackages/core/src/filesystem/search.ts. theripgreplayerthere buildsstate.files/state.directoriesonce when the location search service starts, thenfind()fuzzy-searches that in-memory snapshot.e4300e9b7(fix(core): disable fff by default on windows) makesopencode_disable_fffdefault to true on windows starting inv1.17.2.opencode_disable_fff || !fff.available() ? ripgreplayer : ffflayer.so on windows,
v1.17.2+defaults to the cachedripgreplayer, which explains why new files are missing from@until restart.possible user workaround:
or in cmd:
this should force the
ffflayerpath instead of the cachedripgreplayer, but only iffff.available()is true for that install/runtime. if fff is unavailable, opencode still falls back toripgreplayer.possible code fix options:
ripgreplayer.find()rescan with ripgrep likev1.16.2did, at least on windows.ripgreplayerstate on file add/unlink watcher events.ripgreplayerunless it can refresh after file changes.pyao12 commentedon Jun 18, 2026
same problem. opencode tui works well
GDVE commentedon Jun 22, 2026
same problem, i try on it on WSL and native Windows 11 (with npm)
bibendi commentedon Jun 22, 2026
Same issue on OpenCode Desktop
GDVE commentedon Jun 22, 2026
I added
OPENCODE_DISABLE_FFF = falseto the system variables, so far it works without problems, but this mode, in theory, indexes all files with each request via @tbarron-xyz commentedon Jun 24, 2026
Experiencing this on Macbook M1 MacOs 26.5.1 (25F80) Opencode 1.17.9
ovftank commentedon Jun 24, 2026
working with me(TUI)
Viktor-01 commentedon Jul 5, 2026
I hit the same issue on WSL because my working directory was under
/mnt, whereinotifyisn't supported — andfffLayerdepends on it. Moving the project to/homefixed it.Cleroth commentedon Jul 9, 2026
Quite sad to see opencode is joining the ranks of breaking basic features and then leaving them broken for weeks.
tbarron-xyz commentedon Jul 14, 2026
Seems fixed in 1.18.0
adyingdeath commentedon Jul 25, 2026
This works, which can be a temporary workaround.
adyingdeath commentedon Jul 25, 2026
I am currently using 1.18.5 tui and the problem still exists.
antag0n1st commentedon Jul 27, 2026
This is very annoying , its a dealbreaker to use the opencode desktop. This should have a higher priority to fix it.
voktorok commentedon Jul 29, 2026
Same problem on
Windows 11 25H2 (26200.7623), opencode1.18.8in WSL. @Viktor-01's diagnosis checks out: project folders under/mnttrigger it, moving them to/homefixes it.I can't move all my projects to
/home, so I'd appreciate a proper fix for this.HWZen commentedon Sep 6, 2026
Still reproducible on v1.18.11 (
opencode serveweb UI, Windows 11), so this was not fully fixed in 1.18.0 as suggested above (also still broken in 1.18.5 per @adyingdeath).Clean reproduction verified today:
D:\temp.@replcorrectly suggests the pre-existingreplace.py— autocomplete itself works.bugtest_new_file.mdon disk while the server was running (equivalent to the agent writing it mid-session).@bugtestin the same session shows "No matching items" — no restart in between.GET /find/file?query=bugtest→[](file exists on disk)GET /find/file?query=repl→["replace.py"]A few source findings that go beyond the earlier analysis in this thread:
packages/core/src/filesystem/watcher.ts(@parcel/watcher) only publishes file events to the event bus; nothing consumes those events to refreshstate.filesin the ripgrep layer, and the layer is memoized per location for the lifetime of the process — so the snapshot can never recover without a full restart.packages/core/src/filesystem/fff.node.tshardcodesavailable()tofalse("fff unavailable on node runtime"), so any Node-runtime install is affected on any platform, not just Windows.flag.tsdefaultsOPENCODE_DISABLE_FFFtotrue, so the official build always takes the stale-snapshot path.Real-world impact — this is the worst part of daily usage: a very common workflow is "ask the agent to draft
plan.md, then open a new session and@plan.mdto start implementing". Because of this bug, I can't just open the new session — I have to fully quit and relaunch opencode first, every single time the agent produces a new file I want to reference. Every agent-generated artifact is unreferenceable until a full restart. This alone makes the tool feel broken day to day; please prioritize.A proper fix would be incrementally updating the ripgrep layer from the already-published watcher events (or invalidating/rebuilding the search layer after write/edit tools run).
DarkFalc0n commentedon Sep 9, 2026
Reproducible on Windows 11, Opencode TUI with Powershell.
wizcas commentedon Sep 22, 2026
Confirming this on Windows with opencode
1.18.31, and adding the runtime evidence to the code-level analysis above.Environment: Windows, opencode
1.18.31(Scoop install), git project onE:\.Root cause (matches the OP's analysis):
packages/core/src/flag/flag.ts—OPENCODE_DISABLE_FFFdefaults totrueon Windows:OPENCODE_DISABLE_FFF: fff === undefined ? process.platform === "win32" : truthy("OPENCODE_DISABLE_FFF").So on Windows
FileSystemSearchalways selectsripgrepLayer, neverfffLayer.packages/core/src/filesystem/search.ts(ripgrepLayer) — the list is built once at layer init viaripgrep.find({ pattern: "*" })and stored instate.files/state.directories.find()only fuzzy-searches that in-memory snapshot with fuzzysort. Nothing ever mutates those arrays, and the layer has no dependency on the file watcher.packages/core/src/filesystem/watcher.ts— the watcher only publishescreate/update/deleteevents for the file browser and diff; it never touches the search index. It is also gated behindOPENCODE_EXPERIMENTAL_FILEWATCHER, which defaults tofalse.autocomplete.tsx→sdk.client.v2.fs.find()→ serverfindFilehandler →FileSystem.find→FileSystemSearch.find→ staleripgrepLayersnapshot.Runtime evidence from
~/.local/share/opencode/log/opencode.log:and there is no
failed to initialize fffentry — fff is skipped outright on win32 rather than attempted, which confirmsripgrepLayeris the active implementation.Result: any file created after the location layer is first initialized (by the agent or externally, e.g. in an editor) is absent from
@until opencode restarts. Restarting re-runs the one-time ripgrep scan and the files then appear.Possible fixes:
find()run ripgrep on demand, or incrementally merge new entries into the snapshot.FileSystemSearchto the existing watcher and updatestate.files/state.directorieson create/delete./refreshcommand (see [FEATURE]: Add a Refresh file index command that forces a search-index rescan #40392, [FEATURE]:Add /refresh or /sync command to rescan new files during TUI session #46417).Related: #38065, #44123.
@autocomplete does not detect newly created files until OpenCode is restarted #38065 as a duplicate of this issuelighscent commentedon Oct 10, 2026
please fix that
MorganMarshall commentedon Oct 11, 2026
Still experiencing this issue, I'm not getting any younger
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊
Hona commentedon Oct 11, 2026
looking
fix(core): revalidate file search index per search session
fix(core): pick up new files in file search without a restart