Skip to content

[Bug]: Find in Thread misses the line range shown on a file link #39307

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

packages/contracts or packages/shared

Steps to reproduce

  1. In a project with src/notes.ts, ask the agent to reply with the Markdown link [src/notes.ts](src/notes.ts#L42-L64).
  2. Open Find in Thread.
  3. Search for L42–64 as shown on the file link.

Expected behavior

Find in Thread finds and highlights the line range on the link.

Actual behavior

The counter shows zero matches even though the link displays L42–64.

file range find result

failure

Impact

Minor bug or occasional failure. Anyone looking up a displayed file-link range by its full label encounters this.

Version or commit

main at 9246c3235e. The cause is at packages/shared/src/threadFindText.ts:183.

Environment

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

Logs or stack traces

Find in thread counts the displayed line range as a match
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/thread-find-matches-file-line-range.e2e.ts b/scripts/scenarios/thread-find-matches-file-line-range.e2e.ts
new file mode 100644
index 0000000000..abc5eeb6d4
--- /dev/null
+++ b/scripts/scenarios/thread-find-matches-file-line-range.e2e.ts
@@ -0,0 +1,38 @@
+import { expect } from "e2e";
+
+import { test, WEB } from "./t3.ts";
+
+test(
+  "Find in thread matches the displayed line range of a file link",
+  WEB,
+  async ({ t3, app, screen, browser }) => {
+    const project = await t3.project("demo", { "src/notes.ts": "// Notes\n".repeat(64) });
+    const thread = await t3.thread({
+      project,
+      title: "File review",
+      messages: ["See [src/notes.ts](src/notes.ts#L42-L64)"],
+    });
+    await t3.open(thread);
+    await screen.getByRole("button", /^Agent See/).tap();
+    await browser
+      .locator("[data-user-message-body]")
+      .getByText("notes.ts · L42–64", { exact: true })
+      .waitFor();
+
+    await browser.keyboard.press("Control+f");
+    await screen.getByRole("searchbox", "Find in thread").fill("L42–64");
+    try {
+      await expect
+        .poll(
+          () =>
+            browser.evaluate<string>(
+              'document.querySelector("[data-thread-find-bar] span[aria-hidden]")?.textContent ?? ""',
+            ),
+          { message: "Find in thread counts the displayed line range as a match" },
+        )
+        .toBe("1/1");
+    } finally {
+      await app.screenshot("file-range-find-result");
+    }
+  },
+);
pnpm scenarios:prove scripts/scenarios/thread-find-matches-file-line-range.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