Skip to content

[Bug]: A chat citation opens the wrong file when several projects have a match #40985

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 project containing notes/HANDOFF.txt and a second project containing current/Handoff.txt and archive/HANDOFF.txt on the same environment.
  2. Open a thread in a third project that has no handoff.txt.
  3. Click a chat citation for handoff.txt with no folder in its path.

Expected behavior

The preview leaves the citation unresolved because more than one file matches.

Actual behavior

The preview opens notes/HANDOFF.txt from the first project and silently ignores both matches in the second.

ambiguous handoff citation

failure

Impact

Minor bug or occasional failure. This can send someone reading a chat citation to the wrong file whenever one other project has a single case-insensitive match and another has several.

Version or commit

main at 6972026121. The cause is at packages/client-runtime/src/workspaceBasenameLookup.ts:153.

Environment

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

Logs or stack traces

The file could not be accessed or read. It may be missing or inaccessible.
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-skips-ambiguous-project-files.e2e.ts b/scripts/scenarios/citation-skips-ambiguous-project-files.e2e.ts
new file mode 100644
index 0000000000..6cfbafc6c4
--- /dev/null
+++ b/scripts/scenarios/citation-skips-ambiguous-project-files.e2e.ts
@@ -0,0 +1,37 @@
+import { expect } from "e2e";
+
+import { test, WEB } from "./t3.ts";
+
+const FILE = "handoff.txt";
+
+test(
+  "A bare citation leaves the file unresolved when other projects contain several matches",
+  WEB,
+  async ({ t3, app, browser, screen }) => {
+    const project = await t3.project("planning");
+    await t3.project("reports", { "notes/HANDOFF.txt": "Report handoff" });
+    await t3.project("support", {
+      "current/Handoff.txt": "Current support handoff",
+      "archive/HANDOFF.txt": "Archived support handoff",
+    });
+    const thread = await t3.thread({
+      project,
+      title: "Find the handoff",
+      messages: [`See :codex-file-citation{path="${FILE}" line_range_start="1"}`],
+    });
+
+    await t3.open(thread);
+    await screen.getByRole("button", /^Agent See/).tap();
+    await screen.getByRole("link", /^handoff\.txt/).tap();
+
+    try {
+      await expect(
+        browser
+          .locator("[data-right-panel-surface-content]")
+          .getByText("The file could not be accessed or read. It may be missing or inaccessible."),
+      ).toBeVisible();
+    } finally {
+      await app.screenshot("ambiguous-handoff-citation");
+    }
+  },
+);
pnpm scenarios:prove scripts/scenarios/citation-skips-ambiguous-project-files.e2e.ts --base main

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 22, 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