Skip to content

[Bug]: A chat file link fails when the same file belongs to two projects #39141

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

Not sure

Steps to reproduce

  1. Add a repository as a project.
  2. Add a subfolder containing a text file from that repository as another project on the same machine.
  3. Open a thread in a third project that does not contain the file.
  4. Click a chat file link that cites the file by filename alone.

Expected behavior

The file preview shows the cited file from the repository.

Actual behavior

The preview looks for the file in the thread's project and reports it missing.

citation in overlapping projects

failure

Impact

Minor bug or occasional failure. Users who register a repository and one of its subfolders can hit this whenever a chat in another project links to a file found by both searches.

Version or commit

main at 470ca63499. The cause is at packages/client-runtime/src/workspaceBasenameLookup.ts:137.

Environment

Linux x64 boat.dev default machine, a fresh checkout.

Logs or stack traces

Handoff notes from the shared file
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/scripts/scenarios/citation-finds-file-in-overlapping-projects.e2e.ts b/scripts/scenarios/citation-finds-file-in-overlapping-projects.e2e.ts
new file mode 100644
index 0000000000..4c7495bed6
--- /dev/null
+++ b/scripts/scenarios/citation-finds-file-in-overlapping-projects.e2e.ts
@@ -0,0 +1,49 @@
+/// <reference lib="dom" />
+import { expect } from "e2e";
+
+import { T3_HOME } from "../e2e.config.ts";
+import { makeState, runPromise, test, WEB } from "./t3.ts";
+
+const FILE = "quarterly-handoff.txt";
+const CONTENT = "Handoff notes from the shared file";
+
+test(
+  "A citation finds one file listed by two overlapping projects",
+  WEB,
+  async ({ t3, app, browser, screen }) => {
+    const repository = await t3.project("reports", { [`docs/${FILE}`]: CONTENT });
+    const nested = `${repository}/docs`;
+    const project = await t3.project("planning");
+    const thread = await t3.thread({
+      project,
+      title: "Find the report",
+      messages: [`See :codex-file-citation{path="${FILE}" line_range_start="1"}`],
+    });
+    const { cli } = makeState(T3_HOME);
+    await runPromise(cli(["project", "add", nested, "--title", "Report docs"]));
+    try {
+      await t3.open(thread);
+      await screen.getByRole("button", /^Agent See/).tap();
+      await screen.getByRole("link", /^quarterly-handoff\.txt/).tap();
+
+      try {
+        await expect
+          .poll(() =>
+            browser.evaluate(() => {
+              const panel = document.querySelector("[data-right-panel-surface-content]");
+              for (const host of panel?.querySelectorAll("*") ?? []) {
+                const content = host.shadowRoot?.querySelector("[data-content]");
+                if (content) return content.textContent ?? "";
+              }
+              return panel?.textContent ?? "";
+            }),
+          )
+          .toContain(CONTENT);
+      } finally {
+        await app.screenshot("citation-in-overlapping-projects");
+      }
+    } finally {
+      await runPromise(cli(["project", "remove", nested]));
+    }
+  },
+);
pnpm scenarios:prove scripts/scenarios/citation-finds-file-in-overlapping-projects.e2e.ts --base main

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions