[Bug]: `@` workspace search ignores `.gitignore` because `WorkspaceEntriesLive` is wired without `GitCoreLive` #2077
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
Create a repo with an ignored directory:
mkdir repro && cd repro git init printf ".venv/\n" > .gitignore mkdir -p .venv/lib printf "ignored\n" > .venv/lib/test.txt printf "tracked\n" > tracked.txt git add .gitignore tracked.txtStart T3 against that repo and select the repo root as the project root.
In the chat composer, type
@.venvor search fortest.txt.Observe that the ignored path can appear in the picker / search results.
Expected behavior#
Paths ignored by Git should not be returned by @ workspace search when the selected project root is inside a Git worktree and the repo's .gitignore excludes those paths.
Actual behavior#
@ workspace search can include ignored files and directories.
The likely root cause is in apps/server/src/server.ts:183, where WorkspaceLayerLive is built like this:
const WorkspaceLayerLive = Layer.mergeAll(
WorkspacePathsLive,
WorkspaceEntriesLive.pipe(Layer.provide(WorkspacePathsLive)),
WorkspaceFileSystemLive.pipe(
Layer.provide(WorkspacePathsLive),
Layer.provide(WorkspaceEntriesLive.pipe(Layer.provide(WorkspacePathsLive))),
),
);
But WorkspaceEntries resolves Git through Effect.serviceOption(GitCore) in apps/server/src/workspace/Layers/WorkspaceEntries.ts:177:
const gitOption = yield* Effect.serviceOption(GitCore);
That same file only uses the Git-backed index when GitCore is present:
buildWorkspaceIndexFromGit(...)returnsnullwhenOption.isNone(gitOption)atapps/server/src/workspace/Layers/WorkspaceEntries.ts:199buildWorkspaceIndex(...)then falls back tobuildWorkspaceIndexFromFilesystem(...)atapps/server/src/workspace/Layers/WorkspaceEntries.ts:381
So the server appears to have the Git-aware implementation, but WorkspaceEntriesLive is not receiving GitCoreLive in this layer composition, which causes the Git-aware path to be disabled in practice.
The fix that worked locally was to wire GitCoreLive directly into WorkspaceEntriesLive and reuse that wired layer for WorkspaceFileSystemLive, for example:
const WorkspaceEntriesLayerLive = WorkspaceEntriesLive.pipe(
Layer.provide(WorkspacePathsLive),
Layer.provideMerge(GitCoreLive),
);
const WorkspaceFileSystemLayerLive = WorkspaceFileSystemLive.pipe(
Layer.provide(WorkspacePathsLive),
Layer.provide(WorkspaceEntriesLayerLive),
);
const WorkspaceLayerLive = Layer.mergeAll(
WorkspacePathsLive,
WorkspaceEntriesLayerLive,
WorkspaceFileSystemLayerLive,
);
Impact#
Major degradation or frequent failure
Version or commit#
3e07f5a6a412be551e1d74fe4600a31e5ef557c4
Environment#
Linux, Runtime used during repro: Node 22.22.0, Installed CLI observed here: t3 0.0.17
Logs or stack traces#
Screenshots, recordings, or supporting files#
No response
Workaround#
There does not appear to be a clean repo-side workaround when this wiring bug is present.
The workaround that succeeded locally was to patch the installed runtime so WorkspaceEntriesLive is provided GitCoreLive, then restart the T3 server. After that change, ignored paths stopped appearing in @ workspace search.
nmharmon8(GitHub profile, opens in a new tab) added labelsbug
nmharmon8(GitHub profile, opens in a new tab) added labelsneeds-triage
juliusmarminge closed this
Sign in to join this conversation.
Opened PR #2078 with a fix and regression test for this.