Skip to content

fix(core): never build fff index for workspace locations - #44563

Merged
kitlangton merged 2 commits into
v2from
search-layer-guard
Aug 24, 2026
Merged

kitlangton merged 2 commits into
v2from
search-layer-guard

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

FileSystemSearch chose its implementation from process-local facts only (platform, location.vcs, Protected.isHome), ignoring workspace placement. For a Location with workspaceID set, the fff layer built an in-process native index of location.directory on the server (packages/core/src/filesystem/search.ts:122-127) — an empty or foreign local directory — and served silently wrong search results while the real files live in the remote sandbox.

How

  • layer in packages/core/src/filesystem/search.ts:184-196 now resolves Location.Service first and forces ripgrepLayer whenever location.workspaceID is set, before the platform/option/vcs checks. Ripgrep routes through the Location environment spawner (packages/core/src/ripgrep.ts:117-118), so it is the placement-correct seam.
  • Added a focused test in packages/core/test/filesystem/search.test.ts that places a workspace-backed Location on a vcs+non-home directory (the combination that would otherwise pick fff on this platform), plants a server-local file, and asserts search results come from the ripgrep seam — not from an fff index of the server directory. The test fails without the guard.

Scope

This is the mechanical guard half of #44553 only. Until #44552 (executable identity) lands, remote ripgrep spawns can fail — this PR converts silently wrong results into an honest spawn failure, which is a strict improvement. Explicitly deferred:

Refs #44553

Testing

From packages/core:

bun run test test/filesystem/search.test.ts
bun typecheck
bunx prettier --check src/filesystem/search.ts test/filesystem/search.test.ts

All pass; the new test was verified to fail with the guard reverted.

@kitlangton
kitlangton enabled auto-merge (squash) August 24, 2026 00:50
@kitlangton
kitlangton merged commit c6f4fa0 into v2 Aug 24, 2026
10 of 11 checks passed
@kitlangton
kitlangton deleted the search-layer-guard branch August 24, 2026 01:00
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant